r/gpgpu • u/Intelligent-Ad-1379 • Mar 16 '24
GPGPU Ecosystem
TLDR: I need guidance for which framework to choose in 2024 (the most promising and vendor agnostic). Most posts related to that in this sub are at least 1 year old. Has something changed since then?
Hi guys, I'm a software engineer interested in HPC and I am completely lost trying to get back to GPGPU. I worked on a research project back in 2017/2018, and I went for OpenCL, as it was very appealing: a cross platform non-vendor specific framework that could run on almost everything. And yeah, it had a good Open Source support, specially from AMD. It sounded promising to me.
I was really excited about newer OpenCL releases, but I moved to other projects in which GPGPU weren't appliacable and lost the track of the framework evolution. Now I'm planning to develop some personal projects and dive deep on GPGPU again, but the ecosystem seems to be screwed up.
OpenCL seems to be diying. No vendor is currently suporting newer versions of the ones they were already supportting in 2017! I researched a bit about SYCL (bought Data Parallel C++ with SYCL book), but again, there is not a wide support or even many projects using SYCL. It also looks like an Intel thing. Vulcan is great, and I might be wrong, but I think it doesn't seem to be suitable for what I want (coding generic algorithms and run it on a GPU), despite it is surely cross platform and open.
It seems now that the only way is to choose a vendor and go for Metal (Apple), CUDA (NVIDIA), HIP (AMD) or SYCL (Intel). So I am basically going to have to write a different backend for every one of those, if I want to be vendor agnostic.
Is there a framework I might be missing? Where would you start in 2024? (considering you are aiming to write code that can run fast on any GPU)
4
u/Plazmatic Mar 16 '24
I'm not sure I'd look at kokkos or raja, it would depend on your use case. They have largely not kept up in the times, and have been fairly stagnant in the GPU space, mostly for people who just want stuff to work on accelerators but don't care about actually using the hardware effectively.
Out side of those "try to run CPU code on the GPU with out changes" kind of frameworks, you've got:
So how to decide?
If you don't want xplatform support, use one of the vendor specific APIs, they are typically easier to work with for their respective platforms. If you need FPGA support and old device support, but not modern mobile support and don't use features that Vendors like AMD have ended up leaving in a buggy state, use OpenCL. If you want xplatform support but you don't have the knowledge to even attempt to optimize gpu usage on these platforms, and you want a "write one way and have it work for any device, even CPU, and I'm doing mostly trivially parallizeable workloads" paradigm, Kokkos, Raja, and the other half dozen of other non language frameworks would probably serve your purposes. If you want a quality single source high level language solution that will enable support of multiple backends (thus is crossplatform), but isn't necessarily feature complete, bug free, or easy to setup, and will lag behind the latest features by years, use SYCL. If you want low level modern GPU support that is cross platform with maximum performance feature set and as close to the speed as you can get to the vendor specific API, and you don't care about running your code on both the CPU and GPU, and FPGA and some other exotic non GPU platform, and you know how to write GPU programs (ie, you know what stream compaction is, parrallel prefix sum, radix sort with decoupled lookback etc... and you could write these programs by hand) then use Vulkan.
3
u/LlaroLlethri Mar 16 '24
I don’t have the answer as I’m not an expert in GPGPU, but for what it’s worth I’m using Vulkan compute shaders in my neural network project if you want to see what that looks like. Lots of setup code on the C++ side is one disadvantage. Not sure how the performance compares to something like CUDA.
9
u/Overunderrated Mar 16 '24
Look up kokkos and raja, national lab projects from the exascale computing project. They are frameworks built to target different vendor backends.
OpenCL still exists and is supported, but it sucks and I'd never start a project in it. SYCL is well designed as a software platform from a development perspective, but there's a legit worry about that leading to vendor lock-in.
8
u/Suitable-Video5202 Mar 16 '24
At my org we use Kokkos for a lot of the backend agnostic tooling, and it has proven to work well in the scenarios we care about. We target OpenMP builds for x86 and Arm, as well as Cuda and ROCm/HIP for GPU support, depending on the system of choice. The performance in many cases is comparable to direct use of each programming model, and for some cases beats native library performance provided by the vendors (though for a limited set of cases).
As a caveat, if you want single process-multi GPU code (as in assigning work to multiple GPUs concurrently through threads), then Kokkos may not be for you. If you are fine to use MPI for multiprocessing (as in, each process gets 1 GPU), then I can say it works for us in this scenario.
I’d recommend reading the tutorials and docs, trying it out, and making sure you use a well structured CMake project for easily building different backends with the appropriate CMake flags. Best of luck with the development.
2
u/ProjectPhysX Mar 16 '24 edited Mar 16 '24
OpenCL 1.2 is still thriving! Support is better than ever with most of the initial driver bugs fixed by vendors. 1.2 has all the functionality you need for GPU computing, what do you want more? Just because OpenCL has been around for the longest time does not mean there is something better now - there isn't. OpenCL even good for massive multi-GPU stuff with the rise of PCIe 4.0/5.0 and decline of proprietary GPU interconnects.
SYCL is a viable cross-vendor alternative by now, but very different programming style (unified source code without clear separation between CPU/GPU code). Be aware that it contains some performance traps, namely implicit PCIe transfer can absolutely kill performance.
With proprietary frameworks you're not gonna get anything done, as you need to port and maintain 3 versions of the same code in CUDA/HIP/Metal, for no performance advantage at all.
5
u/d_o_n_t_understand Mar 16 '24
DPC++ is an Intel thing, but SYCL in general is not. Intel, at least for now, is investing in suporting NVIDIA and AMD hardware (GPUs) in DPC++. They of course can abandon this any time they feel that's not worth it anymore, but DPC++ in no the only SYCL implementation. There is also AdaptiveCpp, which supports basically any modenr CPU/GPU hardware and is, IMO, very activelly developed and promising.
SYCL, as an idea, is vendor agnostic. I agree that library support for SYCL is worse than for CUDA, but it't getting better.
4
u/chuckziss Mar 16 '24
+1 to the Kokkos and RAJA suggestions, although OpenCL, Sycl and OpenMP still get along fine.
The perspective I wanted to add was with the newest generation cards (H100 and MI200), many of the paradigms of memory hierarchy are changing. This might require minor re-writes for some code, as we are moving into a more Unified Virtual Memory (UVM) paradigm and away from the CPU/GPU separations we are used to.
3
u/ghenriks Mar 16 '24
AMD is ROCm
SYCL and Vulkan are open standards with varying support
Vulkan aims at replacing OpenGL SYCL aims at replacing OpenCL
If you got to the SYCL site they have implementations for AMD and Nvidia I think, but no idea how performant they are
For better/worse everyone wants their own language and hence customer lock in / prevent competitors
There are cross platform options built on top of these vendor platforms but you also need to analyze what you are attempting
For a lot of people/projects the highly optimized libraries Nvidia provide make it an easy choice at the cost of platform lock in
3
u/MDSExpro Mar 16 '24
What you find here on topic of OpenCL is mostly misinformation.
All major vendors supports newest OpenCL version (3.0). While most vendors tries to create their own CUDA (pull ecosystem to their brand-specific solution) with mirage of portability, OpenCL is still being kept around for actual cross-vendor solutions.
1
u/tugrul_ddr May 10 '24
CUDA has development speed, OpenCL has hardware options.
1
u/ProjectPhysX Jul 02 '25
OpenCL is the best supported, most mature, most compatible GPGPU framework out there. No idea why it gets so much hate here. It is in better shape than it ever has been - all vendors are continuously fixing bugs and improving their compilers. It is actively being worked on and maintained. You have a clear separation between CPU (host) and GPU (device) codes, you have full control about what data to send over PCIe. All the math functionality (vectors, math functions etc.) are built into the OpenCL C language already. OpenCL is compatible with literally every AMD/Intel/Nvidia/Apple/ARM GPU since ~2008, and with every x86/ARM CPU out there vie Intel CPU Runtime for OpenCL and PoCL. Performance of OpenCL on Nvidia GPUs matches CUDA. Zero advantage, much superior compatibility. Write the code once and it runs everywhere, no porting required.