pub unsafe extern "C" fn cuDevSmResourceSplitByCount(
result: *mut CUdevResource,
nbGroups: *mut c_uint,
input: *const CUdevResource,
remainder: *mut CUdevResource,
flags: c_uint,
minCount: c_uint,
) -> CUresultExpand description
Splits CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM resources.
Splits CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM resources into nbGroups, adhering to the minimum SM count specified in minCount and the usage flags in flags. If result is NULL, the API simulates a split and provides the amount of groups that would be created in nbGroups. Otherwise, nbGroups must point to the amount of elements in result and on return, the API will overwrite nbGroups with the amount actually created. The groups are written to the array in result. nbGroups can be less than the total amount if a smaller number of groups is needed.
This API is used to spatially partition the input resource. The input resource needs to come from one of cuDeviceGetDevResource, cuCtxGetDevResource, or cuGreenCtxGetDevResource. A limitation of the API is that the output results cannot be split again without first creating a descriptor and a green context with that descriptor.
When creating the groups, the API will take into account the performance and functional characteristics of the input resource, and guarantee a split that will create a disjoint set of symmetrical partitions. This may lead to fewer groups created than purely dividing the total SM count by the minCount due to cluster requirements or alignment and granularity requirements for the minCount. These requirements can be queried with cuDeviceGetDevResource, cuCtxGetDevResource, and cuGreenCtxGetDevResource for CUdevResourceType::CU_DEV_RESOURCE_TYPE_SM, using the minSmPartitionSize and smCoscheduledAlignment fields to determine minimum partition size and alignment granularity, respectively.
The remainder set does not have the same functional or performance guarantees as the groups in result. Its use should be carefully planned and future partitions of the remainder set are discouraged.
The following flags are supported:
CUdevSmResourceSplitByCount_flags::CU_DEV_SM_RESOURCE_SPLIT_IGNORE_SM_COSCHEDULING: Lower the minimum SM count and alignment, and treat each SM independent of its hierarchy. This allows more fine grained partitions but at the cost of advanced features (such as large clusters on compute capability 9.0+).CUdevSmResourceSplitByCount_flags::CU_DEV_SM_RESOURCE_SPLIT_MAX_POTENTIAL_CLUSTER_SIZE: Compute Capability 9.0+ only. Attempt to create groups that may allow for maximally sized thread clusters. This can be queried post green context creation usingcuOccupancyMaxPotentialClusterSize.
A successful API call must either have:
- A valid array of
resultpointers of size passed innbGroups, withinputof typeCUdevResourceType::CU_DEV_RESOURCE_TYPE_SM. Value ofminCountmust be between 0 and the SM count specified ininput.remaindermay be NULL. - NULL passed in for
result, with a valid integer pointer innbGroupsandinputof typeCUdevResourceType::CU_DEV_RESOURCE_TYPE_SM. Value ofminCountmust be between 0 and the SM count specified ininput.remaindermay be NULL. This queries the number of groups that would be created by the API.
Note: The API is not supported on 32-bit platforms.
§Parameters
result: Output array ofCUdevResourceresources. Can be NULL to query the number of groups.nbGroups: This is a pointer, specifying the number of groups that would be or should be created as described below.input: Input SM resource to be split. Must be a validCUdevResourceType::CU_DEV_RESOURCE_TYPE_SMresource.remainder: If the input resource cannot be cleanly split amongnbGroups, the remainder is placed in here. Can be ommitted (NULL) if the user does not need the remaining set.flags: Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid for default behavior.minCount: Minimum number of SMs required.
§Return value
CUresult::CUDA_SUCCESSCUresult::CUDA_ERROR_DEINITIALIZEDCUresult::CUDA_ERROR_NOT_INITIALIZEDCUresult::CUDA_ERROR_INVALID_DEVICECUresult::CUDA_ERROR_INVALID_VALUECUresult::CUDA_ERROR_INVALID_RESOURCE_TYPECUresult::CUDA_ERROR_INVALID_RESOURCE_CONFIGURATION
See also: cuGreenCtxGetDevResource, cuCtxGetDevResource, cuDeviceGetDevResource.