-
Notifications
You must be signed in to change notification settings - Fork 64
Add CMake HIP language support #740
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
Conversation
Add USE_HIPCXX option to build using CMake's support for the HIP language. This option requires CMake 3.21.3 or newer. The rocsolver clients shouldn't need to be built as HIP, but they require rocblas_is_complex, which is only provided by the rocblas headers when compiling as HIP. In the future, this could be corrected. Note that set_source_files_properties only affects the targets declared in the same CMake file as the call to set the properties. As such, it is difficult to use together with target_sources. All uses of latter have therefore been removed. The project declaration in the clients directory has also been removed so that PROJECT_SOURCE_DIR can always be used to refer to the root directory.
The project() call has been removed from clients/CMakeLists.txt, so the only project() call is at the rocsolver root. The references to the PROJECT_BINARY_DIR in that file can be replaced by CMAKE_CURRENT_BINARY_DIR.
This should not change anything about the rocsolver library unless users pass This was my test setup in an Ubuntu 24.04 docker container: apt-get -y update
apt-get -y upgrade
apt-get -y install gnupg2 wget sudo
sudo mkdir --parents --mode=0755 /etc/apt/keyrings
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.4 noble main" | sudo tee --append /etc/apt/sources.list.d/rocm.list
echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600
apt-get -y update
apt-get -y install rocm-dev rocblas-dev rocsparse-dev rocprim-dev build-essential cmake git libfmt-dev gfortran libopenblas-dev libgtest-dev
git clone https://github.com/cgmb/rocSOLVER.git -b use-cmake-hiplang
cd rocSOLVER
HIPCXX=/opt/rocm/llvm/bin/amdclang++ cmake -S. -Bbuild \
-DCMAKE_HIP_ARCHITECTURES=gfx906 \
-DBUILD_TESTING=ON \
-DROCSOLVER_FIND_PACKAGE_LAPACK_CONFIG=OFF \
-DUSE_HIPCXX=ON
make -j16 -C build Note that with |
@haampie, this is pretty much what I'm going to suggest for the various rocm libs. At some point, we can then make it the default. I'd also like to collect the flags used for AMD's official ROCm releases (e.g., CMAKE_INSTALL_PATH, CMAKE_INSTALL_RPATH, CMAKE_HIP_ARCHITECTURES, etc.), and move them into a centralized location that defines the flags for the builds of the packages that AMD provides. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Test failure is unrelated. I'm forcing the merge. |
Forcing the merge (for real this time) |
Add
USE_HIPCXX
option to build using CMake's support for the HIP language. This option requires CMake 3.21.3 or newer.The rocsolver clients shouldn't need to be built as HIP, but they require
rocblas_is_complex<T>
, which is only provided by the rocblas headers when compiling as HIP. In the future, this could be corrected.Note that
set_source_files_properties
only affects the targets declared in the same CMake file as the call to set the properties. As such, it is difficult to use together withtarget_sources
. All uses of latter have therefore been removed. The project declaration in the clients directory has also been removed so thatPROJECT_SOURCE_DIR
can always be used to refer to the root directory.