Two Different GPUs Reporting the Same Name
Two Different GPUs Reporting the Same Name
Search
Ask the AI

Two Different GPUs Reporting the Same Name

Setting up a JAX compute environment on a Windows box with two different GPUs turned up a series of traps that all share one shape: what you can observe is not what is actually there. The clearest of them is jax.devices() reporting the same model name for two different cards — route work by that name and a 16 GB batch lands on the 8 GB card.

1. Saving you two days: WSL2 is a requirement, not a preference

To run JAX with CUDA on Windows, first check package availability for native Windows Python and WSL2:

jax-cuda12-pjrt and jax-cuda13-pjrt publish only manylinux wheels on PyPI. There is no win_amd64 build.

Installing plain jax can supply a CPU jaxlib: the code runs, while jax.devices() lists only a CPU. Explicitly requesting a CUDA plugin without a Windows wheel normally produces a no-matching-distribution error; it does not imply a silent CPU fallback. This deployment uses WSL2 for Linux CUDA packages. That is the selected Windows route; native Linux is another option.

When deciding whether WSL can be avoided, check exactly this: go to PyPI and see whether the package ships a wheel for your platform. Whether CUDA is present, whether driver versions line up, whether environment variables are set — all of that comes after.

2. Two different cards reporting the same name

This machine has one 16 GB card and one 8 GB card, different models. Under WSL2:

import jax
for d in jax.devices():
    print(d.id, d.device_kind)

# 0 NVIDIA RTX 4080
# 1 NVIDIA RTX 4080     <- actually the 8 GB card, a different model

device_kind reports the same model for both cards.

Routing by card name assigns large batches to a reported 4080. A task needing 16 GB can then land on the 8 GB card and raise an OOM, whose message does not identify the mistaken device selection.

The real mapping, measured, follows PCI address order:

device[0]  ->  PCI 01:00.0  ->  the 16 GB card
device[1]  ->  PCI 06:00.0  ->  the 8 GB card

First check GPU UUID, PCI address and capacity, then map them to the current process’s device ids. Ordering can change with CUDA_VISIBLE_DEVICES, CUDA_DEVICE_ORDER, drivers or runtime configuration, so recheck after environment changes. /usr/lib/wsl/lib/nvidia-smi supplies driver-side information, but NVML queries have limitations in WSL; not every field is an independent capacity measurement.

Use checked identifiers and actual available memory for resource decisions. A model description helps diagnosis but does not alone establish the memory visible to the current process. Record GPU UUID, current device id and capacity together.

3. Background processes are killed silently, logs stop mid-file

In this environment I started a long job with nohup inside WSL and found it terminated after closing the associated wsl.exe window. That is the observation from this run. Whether closing a terminal stops a distribution depends on WSL version, other processes and the host lifecycle.

That much is unsurprising. What surprises is how it dies: the process vanishes, the log file stops mid-way, and there is no termination record anywhere. Worse, transient units started with systemd-run vanish too, leaving nothing in the journal either. What you come back to is a log that stops at 40% with no way to tell whether it crashed, was killed, or the machine rebooted.

Distribution shutdown can terminate both nohup jobs and systemd-managed processes. nohup changes hangup-signal handling, not the VM lifecycle. Correlate Windows/WSL state, boot IDs and persistent journals to distinguish shutdown, process exit and unflushed logs. Microsoft states that systemd services do not themselves keep a WSL instance alive; a permanent service is not a keepalive guarantee over a systemd-run transient unit.

Two things that work:

  • Keep the Windows-side wsl.exe invocation that starts the distribution running, then verify the job and instance after closing interactive terminals. A Linux SSH service or connection alone is not a keepalive guarantee across WSL versions.
  • Use a systemd service for task management and restart policy, with Windows-side distribution startup and keepalive arranged separately. Enabling a service starts it with the distribution; it does not independently start or permanently preserve that distribution.

A queue process inside the distribution stops with it; durable queue data can survive for recovery after restart. This machine uses a scheduled task running wsl --exec sleep infinity to retain a Windows-side invocation. Host shutdown, sleep, task termination and WSL failures can still interrupt it, so retain task status and recovery records.

4. The first scheduling policy starved the big card

The first version of the job scheduler used best fit: sort cards by remaining capacity and place each job on the smallest card that can hold it. That is the textbook bin-packing heuristic, aimed at reducing fragmentation.

The result was that two small jobs both landed on the 8 GB card while the 16 GB card sat completely idle.

The first policy placed both tasks on one card and left the other idle, wasting available parallel capacity. Whether throughput falls by exactly half depends on card speeds, concurrent execution and job durations. This article supplies no throughput comparison, so the placement observation does not establish a 50% loss.

The replacement is a two-level rule:

  1. Prefer a completely idle card;
  2. Only when no card is idle, pick the one with the most remaining capacity.

Note that the second rule also flipped from “smallest that fits” to “largest remaining.” With only two cards, the benefit of reducing fragmentation is far smaller than the benefit of keeping room for whatever arrives next.

Before reaching for a textbook heuristic, check that what it optimises is what you are actually short of. Best fit exists for memory fragmentation, and fragmentation was never the bottleneck here.

5. stdin pipes deadlock across the WSL/Windows boundary

The scheduler needs to invoke Windows-side commands from Linux. The instinctive form pipes data in through stdin:

echo "$payload" | powershell.exe -Command '$in = [Console]::In.ReadToEnd(); ...'

I observed this invocation hang. ReadToEnd() waits for input to end, but the record has no pipe-handle trace that establishes a lost EOF as the unique cause. The preserved command also contains an ellipsis: it illustrates the failure shape. A reproduction needs the completed command, PowerShell/WSL versions and a timeout exit status.

Because the process hangs without an error, an investigation can turn to PowerShell execution policy or quoting and miss the pipe-close problem.

This scheduler switched to a shared-path file to avoid the observed stdin hang: WSL’s /mnt/c/... corresponds to Windows C:\.... Use a distinct temporary file per request, finish and close it before the receiver opens it, and define completion, timeout and cleanup so concurrent jobs cannot overwrite one another.

6. A bridge that only exists while somebody is logged in

This deployment uses WSL2’s default NAT networking, whose IP can change on every start. Its Windows port forward exposes SSH to the LAN and needs refreshing after restart. Windows versions supporting mirrored networking offer another route; check listening addresses and Windows/Hyper-V firewall rules for that mode.

That is a script plus a scheduled task. I originally set the task’s trigger to “at user logon.”

The consequence: the machine is on, WSL is running, jobs are queued — but unless somebody has logged into the desktop, the bridge does not exist and nothing can connect. Everything about the machine is healthy; the only symptom is that you cannot reach it.

The fix is having a fallback path that depends on neither port forwarding nor a logon — forwarding in through the Windows host’s own SSH, which can also start the distribution if it has already shut down.

One related Windows sshd trap: if the login account belongs to the administrators group, Match Group administrators makes sshd read C:\ProgramData\ssh\administrators_authorized_keys instead of the user’s .ssh/authorized_keys. Keys written to the latter have no effect at all, and the log shows only an ordinary public-key authentication failure. That file’s ACL must also contain nothing but Administrators and SYSTEM — one extra entry and sshd refuses to use it.

7. The shape they all share

What you observe What is true
pip installed successfully it installed the CPU build; neither GPU is in use
device_kind says the same model one is 16 GB, one is 8 GB
the log stopped, no error the whole distribution was shut down
the scheduler says it fits it fits, and throughput is halved
the command is hanging EOF never crossed the pipe
machine up, services up no bridge, because nobody logged in
public-key auth failed sshd is reading a different file

The original summary table is retained. Read “throughput is halved” and “EOF never crossed the pipe” with the corrections above: the former has no timed throughput control, and the latter needs a pipe-handle trace. Stopped logs also require external state to establish a distribution shutdown.

The price of virtualisation and translation layers is not only performance — it is observability. Each layer adds another translation between “what the system tells you” and “what is happening,” and translations lose information. Under WSL2 the GPU arrives over a translated driver path, process lifetime hangs off a Windows-side session, the network is NAT’d, and the filesystem spans two worlds. Every trap above sits precisely on one of those seams.

Confirm facts used in resource decisions through a second, independent method. Query the driver for card capacity, check whether a process continues writing output, and test network reachability from outside the machine.

References

Related: three corrections to VRAM estimation (“parameter count is not memory” is the same class of observation error), local LLM deployment: models and inference engines, and the Gemma 4 variants.

Leave a Reply

Scroll down