| 45 | It appears that NVIDIA OpenCL SDK is missing shared library file libOpenCL.so which is needed at compile time. This library file comes with the kernel driver package which can be installed only when your machine has an NVIDIA Cuda-enabled GPU. Thus, any attempt to compile OpenCL sample codes on a non-cuda-enabled GPU machine might result in the following error: |
| 46 | {{{ |
| 47 | /usr/bin/ld: cannot find -lOpenCL |
| 48 | }}} |
| 49 | The Makefile for Linux is made with the assumption that the NVIDIA Cuda SDK is installed at the default location "$(ROOT)/home/USER_NAME/NVIDIA_GPU_Computing_SDK/". On my Linux machine, for example, it would be "$(ROOT)/home/tuanle/NVIDIA_GPU_Computing_SDK/". Since the absolute path is used in Makefile, you will probably need to edit file "common.mk" before compiling the sample app. Do so by looking for "/home/tuanle/NVIDIA_GPU_Computing_SDK" in file "common.mk" and replace this path with an appropriate path on your machine. |
| 50 | |
| 51 | * '''ATI Stream OpenCL''' (BOINC-ATIOpenCL sample app for Linux can be found at "/boin/samples/atiopencl/") |
| 52 | {{{ |
| 53 | Makefile; atiopencl.h; atiopencl.cpp; atiopencl_kernels; readme.txt |
| 54 | }}} |
| 55 | The Makefile for Linux is made with the assumption that the ATI Stream OpenCL SDK version 2.1 for 32-bit Linux and Boinc are installed in the same parent directory, i.e. "ati-stream-sdk-v.2.1-lnx32" directory and "boinc" directory are both installed at "$(ROOT)/home/" directory. If you are using the SDK v2.1 for 64-bit Linux, or if Boinc and the OpenCL SDK are not installed in the same parent directory, then Makefile needs to be edited prior to any compilation. Do so by looking for |
| 56 | {{{ |
| 57 | |
| 58 | CXXFLAGS2 = -g \ |
| 59 | ... |
| 60 | -L ../../../ati-stream-sdk-v2.1-lnx32/lib/x86 \ |
| 61 | -L ../../../ati-stream-sdk-v2.1-lnx32/TempSDKUtil/lib/x86 \ |
| 62 | |
| 63 | atiopencl.o: atiopencl.cpp atiopencl.hpp |
| 64 | ... |
| 65 | -I ../../../ati-stream-sdk-v2.1-lnx32/include \ |
| 66 | -I ../../../ati-stream-sdk-v2.1-lnx32/samples/opencl/SDKUtil |
| 67 | }}} |
| 68 | in file "Makefile" and replace these paths with appropriate paths on your machine. |
| 69 | |
| 70 | Most problems related to running the ATI Stream OpenCL executable files can be found in ATI_Stream_SDK_Installation_Notes.pdf section 2.2. Here are the two most common run-time errors: |
| 71 | |
| 72 | 1) ./atiopencl: error while loading shared libraries: libOpenCL.so: cannot open shared object file: No such file or directory -> Solution: |
| 73 | {{{ |
| 74 | Set the environment variable ATISTREAMSDKROOT |
| 75 | $ export ATISTREAMSDKROOT=<location where Stream SDK is extracted> |
| 76 | |
| 77 | Set the library path LD_LIBRARY_PATH |
| 78 | - For 32-bit systems: |
| 79 | $ export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86:$LD_LIBRARY_PATH |
| 80 | - For 64-bit systems: |
| 81 | $ export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH |
| 82 | - For the 32-bit SDK to run on 64-bit systems: |
| 83 | $ export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86:$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH |
| 84 | }}} |
| 85 | |
| 86 | 2) ./atiopencl: error CL_PLATFORM_NOT_FOUND -> Solution: |
| 87 | {{{ |
| 88 | Need to register the OpenCL ICD by following these steps: |
| 89 | - Download icd-registration.tgz at http://developer.amd.com/Downloads/icd-registration.tgz |
| 90 | - In the command shell, type "cd /" |
| 91 | - Type "ls", you will see a directory named "etc". The icd-registration.tgz needs to be unzipped to that directory. |
| 92 | - Now copy icd-registration.tgz to "cd /" by typing "sudo cp -r /home/tuanle/Downloads/icd-registration.tgz ." |
| 93 | - You will need to replace the specified path above with the appropriate path on your computer, and don't forget "sudo". Otherwise you will get a "Permission denied". |
| 94 | - Unzip by typing "sudo tar xzf icd-registration.tgz" |
| 95 | - Now you should be able to find an "OpenCL" directory in "etc". Check etc/OpenCL/vendors/, make sure there are "atiocl32.icd" and "atiocl64.icd" there. |
| 96 | - Done! |
| 97 | }}} |