rise-lang / shine

The Shine compiler for the RISE language
https://rise-lang.org
MIT License
73 stars 8 forks source link

[BUG] Unknown OpenCL error happened when running a cgo17 app example #237

Closed takatoyamada closed 2 years ago

takatoyamada commented 2 years ago

I recently started to touch on this project. I tried to run benchmarks.cgo17.mm just for verifying my build was properly done, but the following error happened. it seems to say OpenCL runtime has some trouble or the executor was linked with buggy OpenCL lib during the build. Is there anyone who knows about it?

[info] running (fork) benchmarks.cgo17.mm 
[error] [==DeviceList.cpp:114  000.000s ERROR] OpenCL error: unknown error (code: -1001) clGetPlatformIDs
[error] terminate called after throwing an instance of 'cl::Error*'
[error] Nonzero exit code returned from runner: 134
[error] (Compile / run) Nonzero exit code returned from runner: 134
[error] Total time: 6 s, completed Jun 3, 2022 8:38:42 AM
takatoyamada commented 2 years ago

I found more information. There is no device detected by OpenCL runtime. I just run the following fragments embedded into a C++ source in RISE.

// get all platforms and print
clGetPlatformIDs(0, NULL, &platformCount);
printf("platformCount: %lu\n", platformCount);
> platformCount: 0
Bastacyclop commented 2 years ago

Hi, most likely your OpenCL installation is not working properly, does clinfo show devices properly?

takatoyamada commented 2 years ago

@Bastacyclop Thanks! As you would suggest, the problem was OpenCL runtime cannot recognize the device. (I couldn't see any device by clinfo) Once I ran the following commands, it was solved.

apt-get install  ocl-icd-opencl-dev ocl-icd-libopencl1
mkdir -p /etc/OpenCL/vendors && \
    echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd