This module, when imported, automatically performs all the steps necessary to get CUDA ready for submission of compute kernels. When imported, this module will automatically initialize CUDA and create a pycuda.driver.Context on the device.
Return a pycuda.driver.Device instance chosen according to the following rules:
- If the environment variable CUDA_DEVICE is set, its integer value is used as the device number.
- If the file .cuda-device is present in the user’s home directory, the integer value of its contents is used as the device number.
- Otherwise, default is used as the device number.
Gives access to more information on a device than is available through pycuda.driver.Device.get_attribute(). If dev is None, it defaults to the device returned by pycuda.driver.Context.get_device().
Calculate occupancy for a given kernel workload characterized by
The functions pycuda.driver.mem_alloc() and pycuda.driver.pagelocked_empty() can consume a fairly large amount of processing time if they are invoked very frequently. For example, code based on pycuda.gpuarray.GPUArray can easily run into this issue because a fresh memory area is allocated for each intermediate result. Memory pools are a remedy for this problem based on the observation that often many of the block allocations are of the same sizes as previously used ones.
Then, instead of fully returning the memory to the system and incurring the associated reallocation overhead, the pool holds on to the memory and uses it to satisfy future allocations of similarly-sized blocks. The pool reacts appropriately to out-of-memory conditions as long as all memory allocations are made through it. Allocations performed from outside of the pool may run into spurious out-of-memory conditions due to the pool owning much or all of the available memory.
An object representing a DeviceMemoryPool-based allocation of linear device memory. Once this object is deleted, its associated device memory is freed. PooledDeviceAllocation instances can be cast to int (and long), yielding the starting address of the device memory allocated.
A memory pool for linear device memory as allocated using pycuda.driver.mem_alloc(). (see Memory Pools)
An object representing a PageLockedMemoryPool-based allocation of linear device memory. Once this object is deleted, its associated device memory is freed.
A memory pool for pagelocked host memory as allocated using pycuda.driver.pagelocked_empty(). (see Memory Pools)