cuda.bindings._v2.driver.dev_sm_resource_split_by_count#
- cuda.bindings._v2.driver.dev_sm_resource_split_by_count(
- input,
- unsigned int flags,
- unsigned int min_count,
Splits
CU_DEV_RESOURCE_TYPE_SMresources.Splits
CU_DEV_RESOURCE_TYPE_SMresources intonb_groups, adhering to the minimum SM count specified inmin_countand the usage flags inflags. Ifresultis NULL, the API simulates a split and provides the amount of groups that would be created innb_groups. Otherwise,nb_groupsmust point to the amount of elements inresultand on return, the API will overwritenb_groupswith the amount actually created. The groups are written to the array inresult.nb_groupscan 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 ofcuDeviceGetDevResource,cuCtxGetDevResource, orcuGreenCtxGetDevResource. 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 themin_countdue to cluster requirements or alignment and granularity requirements for the min_count. These requirements can be queried withcuDeviceGetDevResource,cuCtxGetDevResource, andcuGreenCtxGetDevResourceforCU_DEV_RESOURCE_TYPE_SM, using theminSmPartitionSizeandsmCoscheduledAlignmentfields to determine minimum partition size and alignment granularity, respectively. Theremainderset does not have the same functional or performance guarantees as the groups inresult. Its use should be carefully planned and future partitions of theremainderset are discouraged. The following flags are supported:.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+).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 innb_groups, withinputof typeCU_DEV_RESOURCE_TYPE_SM. Value ofmin_countmust be between 0 and the SM count specified ininput.remaindermay be NULL.NULL passed in for
result, with a valid integer pointer innb_groupsandinputof typeCU_DEV_RESOURCE_TYPE_SM. Value ofmin_countmust 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:
input (intptr_t) – Input SM resource to be split. Must be a valid
CU_DEV_RESOURCE_TYPE_SMresource.flags (unsigned int) – Flags specifying how these partitions are used or which constraints to abide by when splitting the input. Zero is valid for default behavior.
min_count (unsigned int) – Minimum number of SMs required.
- Returns:
- CUdevResource_v1: Output array of
CUdevResourceresources. Can be NULL to query the number of groups.
- CUdevResource_v1: Output array of
- CUdevResource_v1: If the input resource cannot be cleanly split
among
nb_groups, the remainder is placed in here. Can be ommitted (NULL) if the user does not need the remaining set.
- Return type:
A 2-tuple containing
See also
cuDevSmResourceSplitByCount