Click here to Skip to main content
15,666,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm struggling to find informations on how to target GPUs with clang under Visual Studio.
My code compiles, it just doesn't create multiple threads nor omp_is_initial_device() returns a value different than zero.

Thanks in advance for any hints.

What I have tried:

I tried using Clang 12 downloaded from github and Visual Studio 2019 Community with LLVM Compiler Toolchain and I'm able to successfully target CPUs but not GPUs.
I've also installed NVidia Toolkit but the option --cuda-gpu-arch=sm_XX isn't recognized thus it's being ignored by clang.
I tried my compiled code on 2 notebooks and on a desktop pc equipped with a nvidia 1060.
Updated 8-May-21 7:35am

1 solution

when the code compiles the primary settings should be fine, so I suggest that you check the rror code of omp_is_initial_device() to find the details.
If it doesnt help you should try to contact some developers who really are in touch with that toolchain. It sounds like the settings for the GPU arent correct or the GPU isnt compatible or some installation issue (like driver version).
Share this answer
Member 4315396 11-May-21 10:37am    
First of all thanks.
I'm not sure about how to check the error code of omp_is_initial_device() since it just returns 0 or 1 (it's a boolean func) and I'm not aware of any function for that purpose.
I've seen that there are an irc and a discord channel to contact the team, so if they give me any hint I'll post my findings here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900