tnorgd
tnorgd

Reputation: 1602

Error -1001 in clGetPlatformIDs Call !

I am trying to start working with OpenCL. I have two NVidia graphics card, I installed "developer driver" as well as SDK from NVidia website. I compiled the demos but when I run

./oclDeviceQuery

I see:

OpenCL SW Info:

Error -1001 in clGetPlatformIDs Call !!!

How can I fix it? Does it mean my nvidia cards cannot be detected? I am running Ubuntu 10.10 and X server works properly with nvidia driver.

I am pretty sure the problem is not related to file permissions as it doesn't work with sudo either.

Upvotes: 25

Views: 28728

Answers (12)

Richard Vodden
Richard Vodden

Reputation: 379

For me, I was missing the CUDA OpenCL library, Running sudo apt install cuda-opencl-dev-12-0 solved it.

Upvotes: 0

Gaslight Deceive Subvert
Gaslight Deceive Subvert

Reputation: 20418

This is because OpenCL has the same brain damaged one library per vendor setup that OpenGL has. A likely reason for the -1001 error is that you have compiled with a different library than the linker is trying to dynamically load.

So see if this is the problem run:

$ ldd oclDeviceQuery        
        ...
        libOpenCL.so.1 => important path here (0x00007fe2c17fb000)
        ...

Does the path point towards the NVidia-provided libOpenCL.so.1 file? If it doesn't, you should recompile the program with an -L parameter pointing towards the directory containing NVidia's libOpenCL.so.1. If you can't do that, you can override the linker's path like this:

$ LD_LIBRARY_PATH=/path/to/nvidias/lib ./oclDeviceQuery

Upvotes: 0

Vlad
Vlad

Reputation: 39

Run your program as root. In case of success: you have trouble with cl_khr_icd- extension to load the vendor driver. If you not running X11, you have to create device files manually or by (boot-)script: ERROR: clGetPlatformIDs -1001 when running OpenCL code (Linux)

Upvotes: 3

Sriram Murali
Sriram Murali

Reputation: 6244

This might be due to querying clGetPlatformIDs by multiple threads at the same time

Upvotes: -2

user4706374
user4706374

Reputation: 1

I just ran into this problem on ubuntu 14.04 and I could not find ANY working answers anywhere online including this thread (though this was the first to show up on google). What ended up working for me was to remove ALL previous nvidia software and then to reinstall it using the .run file provided on the nvidia website. Installing the components through apt-get seems to fail for some reason.

1) Download CUDA .run file: https://developer.nvidia.com/cuda-downloads

2) Purge all previous nvidia packages

sudo apt-get purge nvidia-*

3) Install all run file components (you will likely have to stop X or restart in recovery mode to run this)

sudo sh cuda_X.X.XX_linux.run

Upvotes: 0

EvgenijM86
EvgenijM86

Reputation: 2229

In my case I have solved it by installing nvidia-modprobe package available in ubuntu (utopic/multiverse). And the driver itself (v346) was installed from
https://launchpad.net/~mamarley/+archive/ubuntu/nvidia

Concretely, I have installed nvidia-opencl-icd-346, nvidia-libopencl1-346, nvidia-346-uvm, nvidia-346 and libcuda1-346. Not sure if they are all needed for OpenCL.

Upvotes: 9

masuch
masuch

Reputation: 345

I have solved it in Ubuntu 13.10 saucy for intel opencl by created link:

sudo ln -s /opt/intel/opencl-1.2-3.2.1.16712/etc/intel64.icd /etc/OpenCL/vendors/nvidia.icd

Upvotes: 0

Michael Aquilina
Michael Aquilina

Reputation: 5540

Dont know if you ever solved this problem, but I had the same issue and solved it in this post: ERROR: clGetPlatformIDs -1001 when running OpenCL code (Linux)

Hope it helps!

Upvotes: 1

ther
ther

Reputation: 888

Same problem for me on a Linux system. Solution is to add the user to the video group:

# sudo usermod -aG video your-user-name

Upvotes: 4

user1165115
user1165115

Reputation: 11

Since I just spend a couple of hours on this, I thought I would share: I got the error because I was connected to the machine per remote desktop (mstsc). On the machine itself everything worked fine.

I have been told that it should work with TeamViewer by the way.

Upvotes: 1

Kalinovsky Konstantin
Kalinovsky Konstantin

Reputation: 43

You should get number of platforms, allocate the memory for platforms, again get this platforms and then create context from this platform. There is good example: http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71

Upvotes: -2

joachimd
joachimd

Reputation: 71

This is a result of not installing the ICD portion of Nvidia's openCL runtime. The ICD profile will instruct your application of the different openCL implementations installed on the system as multiple implementations from different vendors can coexist. Whe your application does not find the ICD information it gives the Error -1001.

Upvotes: 7

Related Questions