I have a Java program that needs access to a large array from the GPU's local memory. I can declare and access a large array with a '@Local float[] mem = new float[1000000];' using Aparapi on a laptop with an AMD Radeon GPU and it works just fine, but when I try the same thing on a laptop with an Nvidia GeForce 1660 Ti I get an out of resources error from OpenCl. The Nvidia card has 3 Gigs of shared memory so I thought it should have no problem, but obviously not.
I have been searching for a solution to the problem with Google for a few hours now, but I am unable to find any relevant documents.
Here's the code that initializes the kernel memory:
public class MemoryKernel extends Kernel {
/** Working memory - each worker gets its own individual area of fixed memory. It is
* protected so that the test cases can access it. */
@Local protected final float[] mem;
/** Memory size in blocks */
final int memSize;
/** Size of a block of memory */
final int blockSize;
/** Number of worker items */
int workGroupSize;
/** A small buffer for testing purposes */
final float[] buf;
public MemoryKernel(int blockSize, int memSizeInBlocks, int workGroupSize) {
this.memSize = memSizeInBlocks;
this.blockSize = blockSize;
// A typical initialisation is 17 * 50 * 1000
mem = new float[memSizeInBlocks * blockSize * workGroupSize];
initMem(workGroupSize);
// A small buffer accessed only by the test cases in the gputrace.test package for testing
// the ray tracer's functions
buf = new float[blockSize];
setExplicit(true);
put(buf);
}
...