3

I have a simple source code (sum of 2 vectors) for testing OpenCL the problem is the following: when I run th executable file I get this error:

Error: clGetPlatformIDs(-1001)

Also, if i run the command clinfo I get the following error:

terminate called after throwing an instance of 'cl::Error'
`what():  clGetPlatformIDs`
`Aborted (core dumped)`

What's the problem?

I use:

  1. Linux Ubuntu 14.04.4 LTS;

  2. I have NO NVIDIA graphic card but I have:

    *ASPEED Technology, Inc. ASPEED Graphics Family* (rev 10) (prog-if 00 [VGA controller])
    Subsystem: ASPEED Technology, Inc. ASPEED Graphics Family
    Flags: medium devsel, IRQ 23
    Memory at fe000000 (32-bit, non-prefetchable) [size=8M]
    Memory at fdfe0000 (32-bit, non-prefetchable) [size=128K]
    I/O ports at c800 [size=128]
    Expansion ROM at <unassigned> [disabled]
    Capabilities: <access denied>
    Kernel driver in use: ast
    
  3. AMD Processor.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Joseph86
  • 43
  • 1
  • 5

2 Answers2

1

Since I have not enough rep for a comment I put this as an answer.

What is the output of 'ldd clinfo'? This will tell us which libraries clinfo is using. You might have to search for the absolute path of the clinfo executable first.

Can you provide the content of the directory /etc/OpenCL/vendors/ . File names and content would be useful for a start.

serbap
  • 93
  • 3
  • 1
    Hi thanks for your reply! The output of `ldd clinfo` is the following: `ldd: ./clinfo: No such file or directory`, while the content of the directory /etc/OpenCL/vendors/ is the following: **amdocl32.icd amdocl64.icd inteocl.icd nvidia.icd** – Joseph86 Oct 27 '16 at 14:05
  • 1
    ok. then try to move 3 of the vendors file out of /etc/OpenCL/vendors/ into e.g. your home directory and run clinfo again. If it does still not work, move this *.icd file in your home directory and try another one. I had the same problem and it was one of the drivers that caused the error. With this method I could figure out which one it is. – serbap Oct 27 '16 at 15:27
  • 1
    By the way I think it is the intel driver causing problems. Try removing that one first. – serbap Oct 27 '16 at 15:29
  • 1
    Thank You very much @serbap and sorry for my delay but I was waiting for server's administrator, however I have tested your suggestion but it doesn't work. – Joseph86 Nov 10 '16 at 14:01
  • I can answer your questions for my scenario, which is the same (`clinfo` works, `clGetPlatformIds` in my program errors with -1001, "no platforms"). `ldd $(which clinfo)` says exactly the same `/lib/x86_64-linux-gnu/libOpenCL.so.1` as `ldd my-program`. `clpeak` also works fine. I used `pkg-config OpenCL --libs` which gave me `-lOpenCL` and nothing for `--cflags`. `/etc/OpenCL/vendors/nvidia.icd` is the only file in that `vendors` directory, its content is `libnvidia-opencl.so.1` which exists at `/usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1` – doug65536 Mar 26 '23 at 08:30
0

I figured it out for my scenario: compiling with -fsanitize=address breaks the ICD loader. Removing it from my build makes clGetPlatformIDs work as expected. -fsanitize=undefined was okay, though.

doug65536
  • 6,562
  • 3
  • 43
  • 53