Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you begin programming OpenCL without downloading an SDK?

Tags:

c++

opencl

I am trying to get a program that will run on both ATI and NVidia, and as such, I want to avoid using either SDK. Is it possible to do this without an SDK, using only VS2010 and Windows (XP or 7)?

If so, how can I go about configuring VS2010 Linker so that it will work?

like image 481
Daniel Whiddon Avatar asked Jun 08 '11 23:06

Daniel Whiddon


People also ask

Is CUDA based on OpenCL?

As we have already stated, the main difference between CUDA and OpenCL is that CUDA is a proprietary framework created by Nvidia and OpenCL is open source.

What is OpenCL in GPU?

OpenCL™ (Open Computing Language) is a low-level API for heterogeneous computing that runs on CUDA-powered GPUs. Using the OpenCL API, developers can launch compute kernels written using a limited subset of the C programming language on a GPU.


1 Answers

Strictly speaking, no SDK is needed. In fact, no SDK is desired, as both the NVIDIA and AMD/ATI SDKs tie the code to their environments, and, by extension, their hardware. What you do need is:

1) A GPU that will run OpenCL code. See this Question: List of OpenCl Compliant CPU/GPU

2) The OpenCL library (libOpenCL.so on Linux); this is usually included and installed with the Graphics driver, which may be downloaded from AMD or NVIDIA.

3) The OpenCL header files. These may be obtained from Khronos.org, but are included with all OpenCL SDKs that I am aware of. On a Linux system these typically go in the directory /usr/include/CL

The NVIDIA and AMD SDKs provide a number of utilities and wrappers that make using the OpenCL API easier, but they are not required for writing OpenCL code, or for making API calls. These wrappers and utilities are not poratble. If you're interested in writing portable code, stick to the OpenCL spec, also available from Khronos.org.

To write code, all that you need to do is include opencl.h in your host program, and then make the API calls that are necessary to set up the OpenCL environment and run your OpenCL program. Also, don't forget to link against the OpenCL library (give gcc the -lOpenCL flag under Linux).

like image 185
virtuallinux Avatar answered Nov 09 '22 10:11

virtuallinux