OpenCL only works as root

No matter how I try to get OpenCL working (sgminer, cgminer, c programming examples, clinfo)

I only get a result when I run as root.

When I run clinfo not as root I get:

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

I am using the AMD opencl implementation, and the correct ICD file does exist under /etc/OpenCL/vendors. I have changing the permissions of various files with no success.

How can I get this to work without root access


make sure that your user is added to the video group:

sudo adduser $USER video

Follow steps 9-11 of this answer

  1. Optional: make symbolic links for desired system installed platforms: $ ln -s /etc/OpenCL/vendors/nvidia.icd /local/install/path/etc/vendors/nvidia.icd
  2. export OPENCL_VENDOR_PATH=/local/install/path/etc/vendors
  3. export LD_LIBRARY_PATH=/local/install/path/lib/x86_64:$LD_LIBRARY_PATH