Â Part of the content comes from the link: http://www.thebigblob.com/getting-started-with-opencl-and-gpu-computing/
Hardware: NVIDIA GTX650
OS: Ubuntu 12.04
1. Install the NVIDIA CUDA Toolkit and Display Driver
*Download the cuda_5.0.35_linux_64_ubuntu11.10-1.run from https://developer.nvidia.com/cuda-downloads or https://developer.nvidia.com/cuda-toolkit
*run the script at the directory where you store the above file: sudo .sh ./cuda_5.0.35_linux_64_ubuntu11.10-1.run.
This script will install 3 items for you:
a. CUDA toolkit
b. CUDA Samples
c. NVIDIA Display Driver
It is always needed to stop the X server to allow the NVIDIA display driver to be installed, by this command:
sudo stop lightdm
You may also meet the failure that the Smaples can not be installed, due to missing required libraries. The log file will tell you that “Missing the required library libglut.so”. To solve this problem, you need to do:
. sudo apt-get install freeglut3
. sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so
* After all the libs are installed, specify the PATH and LD_LIBRARY_PATH in ~/.bashrc by adding:
* Enter the ~/NVIDIA_CUDA-5.0_Samples to build the samples:
2. Install the NVIDIA GPU Computing SDK
Download the Computint SDK http://developer.download.nvidia.com/compute/cuda/4_0/sdk/gpucomputingsdk_4.0.17_linux.run from this website https://developer.nvidia.com/cuda-toolkit-40 as the previous sample does not have the OpenCL directory.
You can see the ~/NVIDIA_GPU_Computing_SDK directory and enter the OpenCL / to make
3. Verify the installation by the vector addition example
NOTE!!!! restart the computer before you verify.
cd ~/NVIDIA_GPU_Computing_SDK/OpenCL/bin/linux/release to run
If successfully passed, you can go ahead with your OpenCL on NVIDIA.
An example of vector addition can be used as your first exercise (see the attachment):
gcc -c -Wall -I /usr/local/cuda-5.0/include openclex.cc -o main.o
gcc main.o -o host -L /usr/local/cuda-5.0/lib64 -l OpenCL
1. Can not build some of the samples:
sudo apt-get install libxi-dev libxmu-dev
2. clgetplatformids return 1001 when running ./oclDeviceQuery:
restart the computer
or check the /ect/OpenCL/ to see if the .icd file exists, if not, reinstall the NVIDIA driver by sudo apt-get install nvidia-current, and reinstall the CUDA toolkit