Install OpenCL(AMD SDK kit) on linux without ROOT

2019-05-07 17:48发布

I am trying to install OpenCL(AMD) on linux, but I am stuck on the last step(install ICD)

It seems like ICD HAS to be installed at /etc/OpenCL/vendor, but I don’t have root access to the computer.

Is there any way to make OpenCL work without installing ICD? (or maybe through an environment variable to add search path for ICD files?)

It just seems really inconvenient for people like us when ICD file path is hardcoded.

3条回答
叼着烟拽天下
2楼-- · 2019-05-07 18:00

Here is a sketch of how to do a "user" or "local" install of the AMD OpenCL SDK without administrator privileges. Step 9 also provides a method to use the AMD OpenCL platform along with selected platforms installed system-wide.

The installation directory /local/install/path and current SDK version just need to be modified to suit.

  1. Download the AMD OpenCL SDK 64 bit.

  2. $ tar -xvzf AMD-APP-SDK-v2.8-RC-lnx64.tgz

  3. $ tar -xvzf icd-registration.tgz

  4. $ cd AMD-APP-SDK-v2.8-RC-lnx64

  5. $ mkdir /local/install/path

  6. $ cp -r lib /local/install/path

  7. $ cp -r include /local/install/path

  8. $ cp -r ../etc /local/install/path

  9. Optional: make symbolic links for desired system installed platforms: $ ln -s /etc/OpenCL/vendors/nvidia.icd /local/install/path/etc/vendors/nvidia.icd

  10. $ export OPENCL_VENDOR_PATH=/local/install/path/etc/vendors

  11. $ export LD_LIBRARY_PATH=/local/install/path/lib/x86_64:$LD_LIBRARY_PATH

  12. $ cc -I/local/install/path/include -L/local/install/path/lib/x86_64 -lOpenCL demo.c

  13. $ ./a.out

查看更多
啃猪蹄的小仙女
3楼-- · 2019-05-07 18:03

Just an update on this as I suddenly found myself having the same issue (again). I had to disable the buggy Mesa icd which apparently is crashing under non-root runs. Frustrating as it's more a problem with the API handling errors while listing each platform more than an error with permissions or clinfo. Make sure to disable each platform icd to isolate which one is having issues. Hope this helps someone later.

查看更多
Summer. ? 凉城
4楼-- · 2019-05-07 18:16

Put the ICD-files in /some/path/icd and then export the path like so:

export OPENCL_VENDOR_PATH=/some/path/icd

It used to work in previous versions at least. I would be surprised if they changed it.

查看更多
登录 后发表回答