Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in filter operation code translation #30

Open
rcarvs opened this issue Jun 12, 2017 · 0 comments
Open

Errors in filter operation code translation #30

rcarvs opened this issue Jun 12, 2017 · 0 comments

Comments

@rcarvs
Copy link

rcarvs commented Jun 12, 2017

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant