unilab.base.process_device.bind_genesis_process_device¶
- unilab.base.process_device.bind_genesis_process_device(resolved)[source]¶
Select the CUDA device used by an in-process Genesis worker.
Genesis initializes a process-wide session whose Quadrants CUDA runtime always binds the first entry of
CUDA_VISIBLE_DEVICES; torch’s current device alone is not honored (issue #1508). A non-zero request is therefore honored by pinning visibility to the target GPU before any CUDA context exists, after which the in-process device iscuda:0. The returned string is the device the rest of this process must actually use — callers that computed a pre-pin device (learner, probes, collectors) have to adopt the returned value. Binding must happen before constructing the backend (and beforegs.init), including in spawn-based collector processes, and remains in effect for the lifetime of the process.