Why am I getting CL_MEM_OBJECT_ALLOCATION_FAILURE?

I allocate the cl_mem buffer on the GPU and work on it, which works fine until a certain size is exceeded. In this case, the distribution itself is successfully executed, but the execution or copying is not performed. I want to use the device’s memory for faster work, so I allocate as:

buf = clCreateBuffer (cxGPUContext, CL_MEM_WRITE_ONLY, buf_size, NULL, &ciErrNum); 

Now what I don't understand is the size limit. I am copying about 16 MB, but should be able to use about 128 MB (see CL_DEVICE_MAX_MEM_ALLOC_SIZE ).

Why are these numbers so different?


Here are some excerpts from oclDeviceQuery:

  CL_PLATFORM_NAME: NVIDIA CL_PLATFORM_VERSION: OpenCL 1.0 OpenCL SDK Version: 4788711 CL_DEVICE_NAME: GeForce 8600 GTS CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU CL_DEVICE_ADDRESS_BITS: 32 CL_DEVICE_MAX_MEM_ALLOC_SIZE: 128 MByte CL_DEVICE_GLOBAL_MEM_SIZE: 255 MByte CL_DEVICE_LOCAL_MEM_TYPE: local CL_DEVICE_LOCAL_MEM_SIZE: 16 KByte CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte 
+4
source share
2 answers

clCreateBuffer does not actually create a buffer on the device. This makes sense, because at the time of creation, the driver does not know which device will use the buffer (recall that a context can have several devices). A buffer will be created on the device itself when entering a record or when starting a kernel that takes a buffer as a parameter.

As for the 16 MB limit, are you using the latest driver (195.xx)? If so, you should contact NVIDIA either through forums or directly.

+3
source

Do not forget what other memory you used on the device (and, if it is also your video card, the memory that your display uses).

(Is there a way to get the current available memory or the largest fragment or something like that?)

+2
source

All Articles