torch.cuda.green_contexts.get_num_locality_domains#
- torch.cuda.green_contexts.get_num_locality_domains(device_id=None)[source]#
Return the device’s locality-domain count reported by CUDA.
Returns
1when the required software is unavailable. With CUDA driver and bindings 13.4+, initializes the CUDA driver and queries the count. This query does not create a context whendevice_idis specified; invalid devices and failed driver queries raise an error. Initializing the driver can prevent CUDA use in subsequently forked children.