Rate this Page
★ ★ ★ ★ ★

torch.cuda.green_contexts.get_num_sms_per_locality_domain#

torch.cuda.green_contexts.get_num_sms_per_locality_domain(device_id=None)[source]#

Return CUDA’s nominal SM count per locality domain, excluding supplemental SMs.

Requires CUDA driver and bindings 13.4+. Raises when the required software is unavailable rather than returning an inferred SM count. Supplemental SMs can increase the size of individual domain partitions beyond this count.

Initializes the CUDA driver. With an explicit device_id, does not create a context or initialize PyTorch CUDA state. Invalid devices and failed queries raise. Driver initialization can prevent CUDA use in subsequently forked children.

Parameters:

device_id (int, optional) – Device index. When None, uses the current PyTorch device, initializing PyTorch CUDA state if necessary.

Return type:

int