Skip to content

Commit

Permalink
GNU Make: add -pthread for HIP (#3294)
Browse files Browse the repository at this point in the history
It appears that hipcc no longer adds -pthread at link time since
rocm/5.5. So we need to add it.

Also add a CI test using GNU Make to compile HIP code that could have
caught this.
  • Loading branch information
WeiqunZhang committed May 3, 2023
1 parent 85a247b commit 0916f68
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/dependencies/dependencies_hip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ sudo apt-get install -y --no-install-recommends \
#
source /etc/profile.d/rocm.sh
hipcc --version
hipconfig --full
which clang
which clang++
which flang
32 changes: 31 additions & 1 deletion .github/workflows/hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,42 @@ jobs:
ccache -z
./configure --dim 2 --with-hip yes --enable-eb yes --enable-xsdk-defaults yes --with-mpi no --with-omp no --single-precision yes --single-precision-particles yes
make -j2 WARN_ALL=TRUE XTRA_CXXFLAGS="-fno-operator-names" CCACHE=ccache
make -j2 WARN_ALL=TRUE XTRA_CXXFLAGS="-fno-operator-names" AMD_ARCH=gfx90a CCACHE=ccache
make install
ccache -s
du -hs ~/.cache/ccache
# Build 3D EB hip with gnu make
hip-3d-eb-gmake:
name: HIP EB 3D GMake
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies_hip.sh
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Build & Install
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=60M
ccache -z
cd Tests/LinearSolvers/NodeEB
make -j2 USE_HIP=TRUE USE_MPI=FALSE BL_NO_FORT=TRUE WARN_ALL=TRUE WARN_ERROR=TRUE XTRA_CXXFLAGS=-fno-operator-names AMD_ARCH=gfx90a CCACHE=ccache
ccache -s
du -hs ~/.cache/ccache
save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Tests/LinearSolvers/NodeEB/MyTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ MyTest::solve ()

Real mlmg_err = mlmg.solve(amrex::GetVecOfPtrs(phi), amrex::GetVecOfConstPtrs(rhs),
1.e-11, 0.0);
amrex::ignore_unused(mlmg_err);

mlndlap.updateVelocity(amrex::GetVecOfPtrs(vel), amrex::GetVecOfConstPtrs(phi));

Expand Down
3 changes: 3 additions & 0 deletions Tools/GNUMake/comps/hip.mak
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ endif
# amd gpu target
HIPCC_FLAGS += --offload-arch=$(AMD_ARCH)

# pthread
HIPCC_FLAGS += -pthread

CXXFLAGS += $(HIPCC_FLAGS)

# add fopenmp targetting the gnu library
Expand Down

0 comments on commit 0916f68

Please sign in to comment.