Skip to content
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

Closed
boxerab opened this issue Oct 25, 2017 · 6 comments
Closed

How do I add HIP support to existing cmake project ? #231

boxerab opened this issue Oct 25, 2017 · 6 comments
Assignees

Comments

@boxerab
Copy link

boxerab commented Oct 25, 2017

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 ?

@bensander
Copy link
Contributor

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++.

@boxerab
Copy link
Author

boxerab commented Oct 25, 2017

Thanks, will give that a try.

@boxerab
Copy link
Author

boxerab commented Nov 20, 2017

Solution from cmake user group is to include a find_package for hcc, because it doesn't lie on a default path:

find_package(hcc PATHS /opt/rocm/hcc)

and then set the compiler in cmake:

CXX=hcc

Perhaps this can be added to the documentation somewhere ?

@pfultz2
Copy link
Contributor

pfultz2 commented Nov 20, 2017

Solution from cmake user group is to include a find_package for hcc, because it doesn't lie on a default path:

Thats just for the hcc runtime. You can do find_package(hip PATHS /opt/rocm) for the HIP runtime, but its only supported for hcc right now. If you want to support both cuda and hcc, you can just set the compiler to the hipcc wrapper with:

CXX=/opt/rocm/bin/hipcc cmake ..

@ragerdl
Copy link

ragerdl commented Jul 23, 2018

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....

@gargrahul
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants