Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCL compile on linux

Tags:

nvidia

opencl

I'm a newbie in OpenCL.

From yesterday, I'm trying to use OpenCL for parallel programming instead of CUDA which is more familiar for me and experienced before.

Now I have NVIDIA GTX 580 GPU, Ubuntu Linux 12.04 OS and CUDA SDK 4.1 (already installed before because of CUDA programming).

In CUDA SDK folder, Some OpenCL header file and library are already included.

So I just downloaded OpenCL examples from NVIDIA's Developer zone. (Here is the link! https://developer.nvidia.com/opencl)

And I'm tried to compile some example by myself, but I couldn't.

I make Makefile by using -I I added path of header file, but I don't know how to added library path and what is the name of OpenCL library.

I searched on Google but someone said file named libOpenCL.so, but I only have OpenCL.lib.

Is Someone can help me?

like image 887
Umbrella Avatar asked Jun 07 '13 05:06

Umbrella


1 Answers

Install

The following steps have been tested on Ubuntu 12.04.

  1. Download the Intel SDK for Linux.
  2. Extract the RPM:

    $ tar zxvf intel_sdk_for_ocl_applications_2012_x64.tgz
    
  3. Convert to .deb and install:

    $ fakeroot alien --to-deb intel_ocl_sdk_2012_x64.rpm
    $ sudo dpkg -i intel-ocl-sdk_2.0-31361_amd64.deb
    
  4. Ensure that libOpenCL.so has been installed to /usr/lib/.

    $ sudo ln -s /usr/lib64/libOpenCL.so /usr/lib/libOpenCL.so
    $ sudo ldconfig
    

Compile

Simply link to the OpenCL library during compilation:

$ g++ main.cpp -lOpenCL
$ ./a.out
like image 144
Garee Avatar answered Sep 17 '22 01:09

Garee