9

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?

3 Answers3

10

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).

Community
  • 1
  • 1
virtuallinux
  • 996
  • 8
  • 13
  • so I should download an SDK and just not use any of its functions, just use the OpenCL information inside it? The main problem that I am having is that when I include the opencl.h file (VS2010, W7), it links to which is not defined if I include the headers into my program – Daniel Whiddon Jun 09 '11 at 16:15
  • Yes, and SDK is useful, just avoid the vendor's API. I'm unfortunately not very familiar with Visual Studio. I'm guessing that if you put the CL directory in the system include path (no idea what this is for VS), that the link to will resolve. If I have time, I'll look into this. – virtuallinux Jun 10 '11 at 01:17
  • Ok, I grabbed a copy of VS C++ 2010 Express. I was able to get the paths set up right by going to Project > project_name properties. Under Configuration Properties > VC++ Directories, I edited Include Directories, adding the path to the directory in which the CL directory resides (note that I did not specify the path to CL itself). Also, I mistakenly wrote that you should include , when in fact, what should be included is . All of the OpenCL headers should reside inside the CL directory. – virtuallinux Jun 10 '11 at 01:59
2

OpenCL is a standard. It only defines conventions. To use it, you need a driver for your graphical card. NVidia, AMD (ATI) and Apple all provide such drivers. You definitively need a SDK.

Charles Brunet
  • 21,797
  • 24
  • 83
  • 124
1

@virtuallinux alludes to the right answer: If you're worried about accidentally using some vendor-specific extensions, get the Khronos SDK.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720