0

I am trying to write Open CL programs in C++ using G++ compiler in Windows 10 but I am not able to find any SDK for my work.

Nvidia CUDA requires Visual Studio compilers to work and AMD AMP SDK seems to be discontinued saying that the libraries are included in the driver itself.

My PC has both AMD and Nvidia GPUs so any of the implementation should be fine with OpenCL. Can anyone suggest how can I carry on and also kindly clarify on how to use the libraries present in OpenCL driver in my C++ program as mentioned by AMD if possible?

Edit :

I found out that OpenCL libraries are already present in Windows as,

C:\Windows\System32\OpenCL.dll

We only need headers to compile our program using g++. It can be done as shown below.

Install OpenCL headers from below,

https://packages.msys2.org/package/mingw-w64-x86_64-opencl-headers

Once headers are present in include directory of MinGW64, I wrote my program normally and compiled the program using the below g++ command.

g++ main.cpp C:\Windows\System32\OpenCL.dll -o main.exe

And that's it. It worked !!!

http://arkanis.de/weblog/2014-11-25-minimal-opencl-development-on-windows was of great help to understand the OpenCL library implementation in Windows.

1 Answers1

0

You don't need to install anything besides Visual Studio Community with the C++ compiler, and GPU drivers (these already contain the OpenCL runtimes).

For OpenCL development, you only need the OpenCL header files and the lib file. To setup Visual Studio, see here. This works for any OpenCL device, including Nvidia/AMD/Intel GPUs and even Intel CPUs if the CPU runtime is installed.


Alternatively, you can use my lightweight OpenCL-Wrapper. This comes with all Visual Studio settings already in the project file. OpenCL learning and developing with the wrapper is so much simpler than with the cumbersome OpenCL bindings directly.

ProjectPhysX
  • 4,535
  • 2
  • 14
  • 34