I am trying to use OpenCL (Java wrapper, using Eclipse) to execute a bunch of calculations on some data. The kernel itself doesn't contain the calculations; instead, it calls on other functions to do the work.
Now, there is one function that seems to be invalid or something. This runs fine:
int scaled(floatMemory fMem, int a, float b){
int result = indexAlloc(fMem);
float a0 = getf(fMem,a,0);
float a1 = getf(fMem,a,1);
float a2 = getf(fMem,a,2);
setf(fMem, result, a0, a1, a2);
return 0;
}
However, this code causes an internal error (see second to last statement):
int scaled(floatMemory fMem, int a, float b){
int result = indexAlloc(fMem);
float a0 = getf(fMem,a,0);
float a1 = getf(fMem,a,1);
float a2 = getf(fMem,a,2);
setf(fMem, result, a0*b, a1*b, a2*b);
return 0;
}
I tried some other logical tests, and I figure that something is wrong with the float value 'b' (i.e. infinite or null). Can anyone verify that for me?
PS: this is what's printed in the console:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x5a619b14, pid=7416, tid=12112
#
# JRE version: 7.0_25-b16
# Java VM: Java HotSpot(TM) Client VM (23.25-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [igdbcl32.dll+0x79b14] Delete+0x78a94
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# ~:\~\~\~\~\~\bin\hs_err_pid7416.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Sorry this is kind of late but maybe it could help somebody.
It turns out that I was trying to return a float that was getting deallocated once leaving the function, for example:
float sum(float a, float b) {
float x = a+b;
return x;
}
The variable x doesn't exist outside the function, so when I tried to access it from the caller function, I got an error. The solution was to set up my own buffer (a pain in the butt) so that the variables would retain integrity throughout the entire thread.