开发者

Can you begin programming OpenCL without downloading an SDK?

开发者 https://www.devze.com 2023-03-11 19:33 出处:网络
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 Windo

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?


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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号