Allocates and returns a pointer to pinned host memory. More...

template<typename T >
static T * pinned (size_t elements)
 Allocate pinned host memory of elements (see free()). More...
 

Detailed Description

Allocates and returns a pointer to pinned host memory.

Pinned memory allows DMA transfers for faster performance. This memory is not managed by the array therefor it needs to be deallocated using array:free(). This type of memory is expensive to allocate and a limited system resource.

These can be used in asynchronous transfers:

Function Documentation

static T* pinned ( size_t  elements)
static

Allocate pinned host memory of elements (see free()).

float *hptr = array::pinned<float>(10); // allocate 4*10=40 bytes
cudaMemcpyAsync(hptr, dptr, 10*sizeof(float), cudaMemcpyDeviceToHost);
See Also
alloc()