Lahiru
Lahiru

Reputation: 2666

OpenCL memory allocation limit on GPU

When a memory allocation happens in OpenCL using clCreateBuffer and writing happen with clEnqueueWriteBuffer, how to decide which memory to allocate (CPU memory or GPU memory) If the GPU memory is being allocated, will the program fail if the allocation is greater than the memory limit? (or will there be something like paging)

Upvotes: 0

Views: 1997

Answers (1)

Kyle Lutz
Kyle Lutz

Reputation: 8036

clCreateBuffer() will return a null buffer and set the error code to CL_INVALID_BUFFER_SIZE if the requested buffer size is greater than the device's CL_DEVICE_MAX_MEM_ALLOC_SIZE (which can be queried with the clGetDeviceInfo() function).

See the documentation for clCreateBuffer() for more information.

Upvotes: 1

Related Questions