[GSoC 2024] Offloading libcxx (original) (raw)
February 26, 2024, 9:25pm 1
Description
Modern C++ defines parallel algorithms as part of the standard library, like std::transform_reduce(std::execution::par_unseq, vec.begin(), vec.end(), 0, std::plus, …)
. In this project we want to extend an implementation of those that is using OpenMP, including GPU offload, where reasonable. While some algorithms might be amenable to GPU offload via a pure (wrapper) runtime solution, we know others, especially those featuring user provided functors, will also require static program analysis and potentially transformation for additional data management. The goal of the project is to explore different algorithms and the options we have to execute them on the host as well as on accelerator devices, esp. GPUs, automatically via OpenMP.
Expected outcomes
Improvements to the prototype support of offloading in libcxx. Evaluations against other offloading approaches and documentation on the missing parts and shortcommings.
Confirmed mentors and their contacts
Required / desired skills
Required:
- Good understanding of C++ and C++ standard algorithms
- Familiarity with GPUs and (OpenMP) offloading
Desired:
- Experience with libcxx (development).
- Experience debugging and profiling GPU code.
Size of the project.
large
An easy, medium or hard rating if possible
medium
Hello, I am a final year CSE undergrad from India. I have good exposure to GPU Programming. I am excited to contribute to this project. Could you please tell me some tasks to get started with this project ?
(have also sent my resume/profile as a personal message to all mentors)
Great!
I’d suggest you look at, and locally apply, the current patch set:
Together with a OpenMP offload built you should be able to run the tests on the GPU.
The conversation there should also give you ideas about missing parts.
Once you have it setup and running, you can try what is working, and what is not working.
If you run into problems setting it up, the first “task” could be to improve the documentation (or setup process).
Hello, I didn’t have any exposure to GPU programming nor LLVM. but I would like to learn about them through this opportunity. Would you say it could be realistic to learn necessary materials to start this project before the coding officially begins?
Thank you very much.
I wouldn’t say it’s impossible, but strong C++ knowledge would then help. This is at the intersection of C++ library design/implementation and GPU offloading languages, so if both are new to you it will be really hard.
orion160 March 18, 2024, 2:42pm 6
Hi!
I am interested on implementing pstl on OpenMP. I could address algorithm offloading and also test performance regression in the platforms supported by libopenmptarget.
Cool. Do you have experience working on parts of LLVM? It’s always helpful to go through the progress even if the parts you worked on are unrelated to the project. I don’t know when the deadline is coming up but you’d need to write a proposal by then.
Ris-Bali March 19, 2024, 5:33pm 8
Hii, @jdoerfert apologies for the delay I had my college exams for the past 1.5 weeks.
- I have applied the local patch on my machine and have built it successfully using the new environment variables in the patch. However, I am unable to run the tests as the linker can’t detect the openmp runtime installed with LLVM I get the error
cannot find -lomp: No such file or directory
I tried adding<path_to_install _dir>/lib:<path_to_install_dir>/lib/x86_64-unknown-linux-gnu
to theLD_LIBRARY_PATH
but still get the same error. - I went through the PR and observed the following algorithms have been implemented fill, for_each, find_if, transform_Reduce, transform, any_of. Although some of these ops need to support more cases as mentioned in the review.
- I have also started preparing the proposal for this project and wanted to ask where can I upload it for review and discussion.
Did you built LLVM with openmp offloading support? Not finding libomp is either because you didn’t built it, which you can check by looking for libomp.so
in your build folder, or because your setup is not proper. Make sure to add openmp as a runtime to the cmake configuration, verify libomp.so
and libomptarget.so
are present in your build folder. Try a simple openmp and openmp offload program to verify clang finds everything. If not, consider a config file that points to the right include and library folder (via -I and -L).
Ris-Bali March 19, 2024, 5:54pm 10
find -name returns paths to both libomp.so
and libomptarget.so
in the install directory. I’ll add the config file with the paths. Thanks.
nursioi April 6, 2025, 6:48pm 11
Hi, I am first year from Kazakhstan.
Previously I’ve had good experience with algorithms in high school, participating in various national, international olympiads. Also, here is my codeforces account - https://codeforces.com/profile/Nurss.
Other than that I have little experience in normal programming other than competitive. Is it possible to me add something to this project If I could learn other things quickly myself?