From http://www.kimicat.com
Use opencl in Windows
Currently, both nvidia and AMD windows drivers support opencl (the official NVIDIA driver version starts with version 195.62, while amd starts with version 9.11 ). NVIDIA's official driver contains opencl. dll, which can be used directly. So far, amd still needs to install its SDK to have opencl. dll. However, in the latest SDK, nvidia and AMD use the same calling convention. That is to say, opencl compiled using amd SDK
Program, which can be operated directly under NVIDIA driver. The same is true.
AMD's opencl SDK is in amd stream SDK 2.0 and is currently in beta 4. NVIDIA's opencl SDK is included in the latest Cuda 3.0 SDK beta. The two sdks can be installed on the same computer at the same time, so there is basically no conflict.
Since the focus of opencl SDK is only on header file and library, it is very simple to set. In the amd SDK, an environment variable atistreamsdkroot is created. Header files are in the include directory, while the library file is in Lib. NVIDIA
The SDK is also similar. There is an environment variable nvsdkcompute_root. However, because the nvidia sdk also includes Cuda and opencl, its header files are in the opencl \ common \ Inc directory, while the library is in opencl \ common \ Lib.
Note that both AMD and NVIDIA provide 32 bits and 64 bits for 32 bits and 64 bits. In the nvidia sdk, 32 bits library is in the Win32 Directory under the lib directory, while 64 bits is in the x64 directory. AMD sdks are stored in the x86 and x86_64 directories.
The following is an example of using Visual Studio 2008 Express:
NVIDIA Cuda SDK:
Note that NVIDIA sdks are used to distinguish between 32 bits and 64 bits library directories (Win32 and x64) it is consistent with $ (platformname) created in Visual Studio 2008, so it can be used directly. AMD sdks must be set separately. In addition, if the SDK of 32 bits is used, the 64 bits library is not included. Therefore, you do not need to add $ (platformname) to the rule ).
The following describes how to configure the amd SDK:
Finally, add opencl. lib to the Library (this is the same for both sdks ):
Finally, let's mention a small place. In MacOS X 10.6, The opencl header should exist in the opencl directory, that is
# Include <opencl/opencl. h>
However, in Windows (and possibly all other operating systems ),
# Include <CL/Cl. h>
Therefore, if you want to compile the same code in a variety of operating systems at the same time, you are advised to write the code in the include file:
# Ifdef _ apple __
# Include <opencl/opencl. h>
# Else
# Include <CL/Cl. h>
# Endif
In this way, it can be used in both MacOS X 10.6 and other operating systems.