cuda.bindings._v2.driver.mem_pool_create#
- cuda.bindings._v2.driver.mem_pool_create(pool_props) intptr_t#
Creates a memory pool.
Creates a CUDA memory pool and returns the handle in
pool. Thepool_propsdetermines the properties of the pool such as the backing device and IPC capabilities. To create a memory pool for HOST memory not targeting a specific NUMA node, applications must set setCUmemPoolProps::CUmemLocation::type toCU_MEM_LOCATION_TYPE_HOST.CUmemPoolProps::CUmemLocation::id is ignored for such pools. Pools created with the typeCU_MEM_LOCATION_TYPE_HOSTare not IPC capable andCUmemPoolProps.handleTypesmust be 0, any other values will result inCUDA_ERROR_INVALID_VALUE. To create a memory pool targeting a specific host NUMA node, applications must setCUmemPoolProps::CUmemLocation::type toCU_MEM_LOCATION_TYPE_HOST_NUMAandCUmemPoolProps::CUmemLocation::id must specify the NUMA ID of the host memory node. SpecifyingCU_MEM_LOCATION_TYPE_HOST_NUMA_CURRENTas theCUmemPoolProps::CUmemLocation::type will result inCUDA_ERROR_INVALID_VALUE. To create a memory pool targeting a specific device locality domain, applications must setCUmemPoolProps::CUmemLocation::type toCU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN,CUmemPoolProps::CUmemLocation::localized.deviceId must specify the device ID, andCUmemPoolProps::CUmemLocation::localized.localityDomainId must specify the locality domain ID. The locality domain ID must be a valid locality domain ID for the specified device. See alsocuDeviceGetAttributewith the attributeCU_DEVICE_ATTRIBUTE_LOCALITY_DOMAIN_COUNT. By default, the pool’s memory will be accessible from the device it is allocated on. In the case of pools created withCU_MEM_LOCATION_TYPE_HOST_NUMAorCU_MEM_LOCATION_TYPE_HOST, their default accessibility will be from the host CPU. Applications can control the maximum size of the pool by specifying a non-zero value forCUmemPoolProps.maxSize. If set to 0, the maximum size of the pool will default to a system dependent value. Applications that intend to useCU_MEM_HANDLE_TYPE_FABRICbased memory sharing must ensure: (1)nvidia-caps-imex-channelscharacter device is created by the driver and is listed under /proc/devices (2) have at least one IMEX channel file accessible by the user launching the application. When exporter and importer CUDA processes have been granted access to the same IMEX channel, they can securely share memory. The IMEX channel security model works on a per user basis. Which means all processes under a user can share memory if the user has access to a valid IMEX channel. When multi-user isolation is desired, a separate IMEX channel is required for each user. These channel files exist in /dev/nvidia-caps-imex-channels/channel* and can be created using standard OS native calls like mknod on Linux. For example: To create channel0 with the major number from /proc/devices users can execute the following command:mknod /dev/nvidia-caps-imex-channels/channel0 c <major number> 0. To create a managed memory pool, applications must setCUmemPoolProps::CUmemAllocationType to CU_MEM_ALLOCATION_TYPE_MANAGED.CUmemPoolProps::CUmemAllocationHandleType must also be set to CU_MEM_HANDLE_TYPE_NONE since IPC is not supported. For managed memory pools,CUmemPoolProps::CUmemLocation will be treated as the preferred location for all allocations created from the pool. An application can also set CU_MEM_LOCATION_TYPE_NONE to indicate no preferred location.CUmemPoolProps.maxSizemust be set to zero for managed memory pools.CUmemPoolProps.usageshould be zero as decompress for managed memory is not supported. For managed memory pools, all devices on the system must have non- zeroconcurrentManagedAccess. If not, this call returns CUDA_ERROR_NOT_SUPPORTED.- Parameters:
pool_props (intptr_t) – Memory pool properties.
- Returns:
Returned memory pool.
- Return type:
intptr_t
Note
On devices with a single locality domain, a memory pool created with
CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAINand localityDomainId 0 is equivalent to a full-device memory pool created withCU_MEM_LOCATION_TYPE_DEVICE. The pool will reportCU_MEM_LOCATION_TYPE_DEVICEforCU_MEMPOOL_ATTR_LOCATION_TYPEand -1 forCU_MEMPOOL_ATTR_LOCALITY_DOMAIN_ID.Note
Specifying CU_MEM_HANDLE_TYPE_NONE creates a memory pool that will not support IPC.
See also
cuMemPoolCreate