Login  Register

Re: Maximum size of CLBuffer<FloatBuffer>

Posted by Wade Walker on Nov 18, 2014; 2:23am
URL: https://forum.jogamp.org/Maximum-size-of-CLBuffer-FloatBuffer-tp4033567p4033568.html

I'm not sure how we'd get around this, since java.nio.ByteBuffer.allocateDirect() takes an int size, and in Java int is always 32-bit signed two's complement. Even array indices in Java are 32-bit ints, so a one-dimensional array is no bigger. The native OpenCL clCreateBuffer() function can create bigger buffers if CL_DEVICE_ADDRESS_BITS from clGetDeviceInfo() is 64, but you can't create a CL buffer from a Java direct buffer that way, since JOCL uses the direct buffer's size to call clCreateBuffer() with :)

One option might be to subdivide your buffer into chunks of 1GB or so, and process the chunks one at a time. Even on a huge graphics card, you'd only have 12 chunks to deal with. You'd have to do something like this if your array is bigger than your physical memory anyway, which it sounds like you're getting close to.