LLVM has a back end for both AMD and NVIDIA GPUS. Is it currently possible to compile c++ (or a subset) to GPU code with clang and run it? Obviously things like the standard library would be unavailable, as well as operator new and delete. I'm not looking for OpenCL or CUDA, I'm thinking of a fully ahead-of-time compiled program, even a trivial one.
No, you need some language like OpenCL or CUDA, because a GPGPU is not an ordinary computer and has a different programming model (grossly speaking, SIMD like). GPGPU compute kernels have specific constraints.
You might want to consider using OpenACC pragmas in your C++ code (and use a recent GCC compiler).
Download the Cuda toolkit. The download may take a while. Be patient. Do the express installation and extract to standard location. Once finished, click the start button and type in "visual studio." Not VS Code, but click the other one, the one that looks old. Mine is called Visual Studio 2022. Open it up, set it up, click "new project," and then click Cuda. Name it whatever you want, and then you now have your first project that will run on a GPU.
Alternatively, After installing Cuda toolkit, watch this video
© 2022 - 2024 — McMap. All rights reserved.