Description Usage Arguments Value Author(s) References See Also Examples
mallocPitch
is similar to cudaMallocPitch
for allocating memory for 2-dimensionsal structures, i.e. matrices.
Unlike cudaMallocPitch
, this function takes the name of the
element type and determines the number of bytes of each element.
More than this, it returns an object that is similar to
what cudaMallocPitch
returns, but contains more information.
This allows us to directly assign an R object directly to the
allocated memory without having to explicitly call
cudaMemcpy2D
.
One has to keep in mind that R matrices are stored in column order but the Pitch mechanism is more focused on rows in CUDA.
1 | mallocPitch(width, height, elType = NA)
|
width |
the number of columns in the 2D object |
height |
the number of rows in the 2D object. |
elType |
the name of the element type of the array,
e.g. |
mallocPitch
returns a list with elements
devPtr |
a reference to the allocated memory on the GPU |
pitch |
the actual pitch value between the start of elements in consecutive rows. |
elType |
the value of |
elSize |
the number of bytes for a single element |
dim |
the dimension vector of the allocated space, i.e. |
This list has S3 class PitchMemory2D
.
Duncan Temple Lang
CUDA SDK e
cudaMallocPitch
and cudaMemcpy2D
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.