You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following function implements the filter operation:
public void method(final int sizeIn) {
final int[] vectorIn = new int[sizeIn];
Random random = new Random();
for (int x = 0; x < sizeIn; x++) {
vectorIn[x] = random.nextInt(sizeIn);
}
Array<Int32> array = new Array<Int32>(vectorIn, Int32.class);
Array<Int32> output = (Array<Int32>) array.par().filter(new Filter<Int32>() {
@Override
public boolean function(Int32 element) {
boolean ret = false;
for(int i=0;i<sizeIn;i++){
if(element.value > vectorIn[i]){
ret = true;
}
}
return ret;
}
});
}
But the generated code has some errors that had to correct in order to run:
It did not create the vectorIn and sizeIn buffers, it passed both directly to the setArg function.
Inside the kernel, it did not specify the expected type of vectorIn (int *).
Passing vector vectorIn as int [] in the argument, I changed to jintArray and created an interpolation to cast the int *
It was declared a boolean type inside the kernel, I changed it to int
Declared a static operator inside the kernel, I removed it
He was by setting the PM_dataPtr->length directly in setArg, I created a buffer for this.
The text was updated successfully, but these errors were encountered:
The following function implements the filter operation:
But the generated code has some errors that had to correct in order to run:
The text was updated successfully, but these errors were encountered: