unilab.base.process_device.pin_genesis_device_before_cuda_init

unilab.base.process_device.pin_genesis_device_before_cuda_init(backend_type, *, devices=None, rank=0, local_rank=None, world_size=1, learner_device=None)[source]

Pin Genesis to its rank device before the first torch CUDA call.

torch.cuda.is_available() already latches CUDA_VISIBLE_DEVICES in the CUDA runtime, so the pin must run ahead of any torch CUDA query — entrypoints should call this before registry/bootstrap/device detection. Pure config topology (training.devices / LOCAL_RANK / an explicit cuda:N learner device) resolves without touching torch. Returns the in-process device the caller must use when a pin happened, else None.

Parameters:
Return type:

str | None