memory_management: CUDA Memory Management

Description Usage Arguments Details References

Description

CUDA memory management utilities.

Usage

1
2
3
4
5
6
7
8
9
cudaFree(dev_ptr)

cudaMalloc(count, size)

cudaMemcpy(dst, src, count, size, kind)

cudaMemGetInfo()

cudaMemset(dev_ptr, value, count, size)

Arguments

dev_ptr

Pointer to device memory, i.e. an object returned from cudaMalloc().

count

Number of elements (NOT BYTES).

size

A standin for sizeof(). Acceptable values are "int", "float", and "double". Values are case insensitive.

dst, src

Device/host vectors. dst-src should be one of device-host, host-device, or device-device. Host vectors should be integer, float, or double.

kind

Description of the kind of copy. Acceptable values are "DeviceToHost", "HostToDevice", and "DeviceToDevice". Values are case insensitive.

value

Integer value. Probably 0.

Details

cudaFree() Manually frees device memory. Does not destroy the R object (so calling this will make the pointer managed by the R object invalid). Use of this function will not cause a double free when the R object is gc'd.

cudaMalloc() allocates device memory and returns an external pointer. This memory is managed by the R garbage collector.

cudaMemcpy() copies memory host-to-device, device-to-host, or device-to-device.

cudaMemGetInfo() returns a list containing the number of free bytes and the number of total bytes of memory on the current device.

cudaMemset() memset for device memory.

References

NVIDIA CUDA Runtime API https://docs.nvidia.com/cuda/cuda-runtime-api/index.html


wrathematics/cur documentation built on May 21, 2019, 10:14 a.m.