arrayfire-rust: Possible bug in `sum_by_key`

I have used arrayfire::sum_by_key in its most basic test case and it still produces this error.

While there exists no example in the rust docs, from checking documentation at: http://arrayfire.org/docs/group__reduce__func__sum__by__key.htm

I cannot see a way to simplify my usage.

Attached test project: af_sum_by_key_test.zip

Code:

use arrayfire::{af_print,print_gen,Array,Dim4,sum_by_key};

fn main() {
    println!("Hello, world!");

    let keys = Array::<u32>::new(&[0,0,0,1,1,1],Dim4::new(&[6,1,1,1]));
    af_print!("keys:",keys);
    let vals = Array::<u32>::new(&[1,2,3,4,5,6],Dim4::new(&[6,1,1,1]));
    af_print!("vals:",vals);
    
    let sum_by_key = sum_by_key(&keys,&vals,0i32);
    af_print!("sum_by_key keys:",sum_by_key.0);
    af_print!("sum_by_key vals:",sum_by_key.1);
}

Full error:

thread 'main' panicked at 'Error message: Error either in ArrayFire or in a project upstream
Last error: OpenCL Error (-11): Build Program Failure when calling clBuildProgram', C:\Users\jonat\.cargo\registry\src\github.com-1ecc6299db9ec823\arrayfire-3.7.0\src\error.rs:40:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\debug\af_sum_by_key_test.exe` (exit code: 101)

Using windows. ArrayFire 3.7.1 installed. System environment variable AF_PATH_v3 set as C:\Program Files\ArrayFire\v3. System environment variable Path contains C:\Program Files\ArrayFire\v3\lib.

I apologise if this is not an error and it is my own mistake.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 37 (37 by maintainers)

Most upvoted comments

@JonathanWoollett-Light the change checks out fine on 2.0 card.

Our current ci jobs are green(passed), I held it up so that I can test on a OpenCL 2.0 device. I am building the opencl backend on my windows setup right now. I should be able to provide you with executable soon.

Alright, that is what we need. Thanks, will look into it.

Well, I was expecting some build log printout from opencl backend because it is failing while building the kernel as per the message we have had so far.

Last error: OpenCL Error (-11): Build Program Failure when calling clBuildProgram'

Let me show you how the build log failure output looks like. I have edited the kernel to have a syntax error on my system and here is the following output.

ptxas fatal   : Cannot take address of function 'get_ocal_id' 

 -cl-std=CL1.2 -D dim_t=long -D To=uint -D Tk=uint -D T=To -D DIMX=128 -D CPLX=0
OpenCL Error (-9999): Unknown OpenCL Error (-9999) when calling clBuildProgram
ArrayFire Exception (Internal error:998):

I am sorry for the re-runs. I have mistaken AF_JIT_KERNEL_TRACE with AF_OPENCL_SHOW_BUILD_INFO. Please set that to 1 as well. Now, you should see something like the above where compilation failed in kernel.

The devices are found. I expected some kind of build log, wonder why nothing showed up. I will look into it and get back to you. Thank you for reporting it.