2

I wanted to get started in GPU programming and since I have an AMD GPU I would like to start with OpenCL.

I have installed on my Windows 10 machine Visual Studio Code 2019 editor and I've also installed this https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK. I tried to put those variables inside the settings of VC2019 but nothing happened.

Can somebody help troubleshooting this problem? How did you manage to install OpenCL?

Thanks in advance

TrueStop16
  • 23
  • 2

1 Answers1

1

When compiling your code, you need to tell the linker where the OpenCL headers and lib file are located. I usually put the headers and lib file inside the project directory:

g++ *.cpp -o Test.exe -I./OpenCL/include -L./OpenCL/lib -lOpenCL

But you can also make the -Ipath/to/OpenCL/include -Lpath/to/OpenCL/lib paths point to the OCL-SDK directory.

For how to setup OpenCL with VS Community, see here: https://stackoverflow.com/a/57017982/9178992


For an easy start with OpenCL, I created a wrapper that vastly simplifies the OpenCL C++ bindings and eliminates the entire code overhead that comes with it. This includes the OpenCL headers and all Visual Studio Community project settings; no additional setup required: https://github.com/ProjectPhysX/OpenCL-Wrapper

ProjectPhysX
  • 4,535
  • 2
  • 14
  • 34
  • 1
    Wow that’s wonderful! – TrueStop16 Apr 20 '22 at 18:20
  • 1
    I managed to resolve my problem by putting the linker folder directly in visual studio code without using the environment variable. Its a shame I didn’t manage to find your amazing project before. I’ll look how to use it. – TrueStop16 Apr 20 '22 at 18:22
  • 1
    Did I upvote correctly? I think you have really helped me/given me a suggestion/idk how to call it. Sorry but actually I think this is the first or secondth stackoverflow question – TrueStop16 Apr 20 '22 at 18:50