I am beginner with aparapi. I have a problem with getGlobalId. My code is very simple. I only want to add two arrays but the result is wrong. I debugged the program and i saw that getGlobalId is not taking the corrected values.
My code is:
int size = 3;
final float[] A = new float[size];
final float[] B = new float[size];
for (int i=0; i<size; i++) {
A[i] = (float) Math.random()*100;
B[i] = (float) Math.random()*100;
}
final float[] result = new float[size];
Kernel kernel = new Kernel() {
@Override
public void run() {
int i = getGlobalId();
result[i] = A[i] + B[i];
}
};
Range range = Range.create(result.length);
kernel.execute(range);
The result is:
28.15 + 85.24 = 0.00
74.07 + 80.04 = 0.00
15.51 + 98.64 = 0.00
And the error in console is:
com.aparapi.internal.opencl.OpenCLLoader SEVERE: Check your environment. Failed to load codegen native library or possibly failed to locate opencl native library (opencl.dll/opencl.so). Ensure that OpenCL is in your PATH (windows) or in LD_LIBRARY_PATH (linux).
Any solution about my problem?