-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I add HIP support to existing cmake project ? #231
Comments
Easiest approach would be to change the compiler to "hipcc" - this will automatically detect the plaform and use the right compiler/includes/define for either ROCm or CUDA. With this approach, code will be compiled with HIPCC. Another approach sometimes used for large projects is to partition the files which define or call GPU kernels and compile only those files with hipcc, and the rest with a different host compiler such as g++. |
Thanks, will give that a try. |
Solution from cmake user group is to include a find_package for hcc, because it doesn't lie on a default path:
and then set the compiler in cmake:
Perhaps this can be added to the documentation somewhere ? |
Thats just for the hcc runtime. You can do
|
Personally, it'd be nice to see a section in https://rocm-documentation.readthedocs.io/en/latest/Programming_Guides/HIP-porting-guide.html on how to port a CUDA-oriented CMakeLists.txt to be HCC-centric. Of course, many things would be nice.... |
@ragerdl please check https://github.com/ROCm-Developer-Tools/HIP/tree/master/samples/2_Cookbook/12_cmake_hip_add_executable We can refer this from porting guide. |
I have cmake project - would like to add some HIP files to it. So, I guess the compiler needs
to change for the project ? What is the best way of doing this ?
The text was updated successfully, but these errors were encountered: