Skip to content

Commit

Permalink
CI: NVHPC for CUDA (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l authored Sep 29, 2021
1 parent 3eb5af6 commit b11479d
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,47 @@ jobs:
cmake --build build -j 2
# Build libamrex and all tests with NVHPC (recent supported)
tests-nvhpc21-9-nvcc:
name: [email protected] NVCC/NVC++ C++17 Release [tests]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Dependencies
run: .github/workflows/dependencies/dependencies_nvhpc21-9.sh
- name: Build & Install
run: |
source /etc/profile.d/modules.sh
module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/21.9
which nvcc || echo "nvcc not in PATH!"
which nvc++ || echo "nvc++ not in PATH!"
which nvc || echo "nvc not in PATH!"
which nvfortran || echo "nvfortran not in PATH!"
nvcc --version
nvc++ --version
nvc --version
nvfortran --version
cmake --version
cmake -S . -B build \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DAMReX_ENABLE_TESTS=ON \
-DAMReX_PARTICLES=ON \
-DAMReX_FORTRAN=OFF \
-DAMReX_GPU_BACKEND=CUDA \
-DCMAKE_C_COMPILER=$(which nvc) \
-DCMAKE_CXX_COMPILER=$(which nvc++) \
-DCMAKE_CUDA_HOST_COMPILER=$(which nvc++) \
-DCMAKE_Fortran_COMPILER=$(which nvfortran) \
-DCMAKE_CUDA_STANDARD=17 \
-DCMAKE_CXX_STANDARD=17 \
-DAMReX_CUDA_ARCH=8.0 \
-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON
cmake --build build -j 2
# Build 3D libamrex cuda build with configure
configure-3d-cuda:
name: [email protected] [email protected] [configure 3D]
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/dependencies/dependencies_nvhpc21-9.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
#
# Copyright 2021 Axel Huebl
#
# License: BSD-3-Clause-LBNL

set -eu -o pipefail

sudo apt-get -qqq update
sudo apt-get install -y \
build-essential \
ca-certificates \
cmake \
environment-modules \
gnupg \
pkg-config \
wget

wget -q https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc-21-9_21.9_amd64.deb \
https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc-2021_21.9_amd64.deb
sudo apt-get update
sudo apt-get install -y ./nvhpc-21-9_21.9_amd64.deb ./nvhpc-2021_21.9_amd64.deb
rm -rf ./nvhpc-21-9_21.9_amd64.deb ./nvhpc-2021_21.9_amd64.deb

# things should reside in /opt/nvidia/hpc_sdk now

# activation via:
# source /etc/profile.d/modules.sh
# module load /opt/nvidia/hpc_sdk/modulefiles/nvhpc/21.9
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BLBackTrace.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct BLBackTrace

static std::stack<std::pair<std::string, std::string> > bt_stack;
// threadprivate here doesn't work with Cray and Intel
#if defined(AMREX_USE_OMP) && !defined(_CRAYC) && !defined(__INTEL_COMPILER) && !defined(__PGI)
#if defined(AMREX_USE_OMP) && !defined(_CRAYC) && !defined(__INTEL_COMPILER) && !defined(__PGI) && !defined(__NVCOMPILER)
#pragma omp threadprivate(bt_stack)
#endif
};
Expand Down
8 changes: 8 additions & 0 deletions Src/Base/AMReX_Extension.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#define AMREX_CXX_CRAY
#elif defined(__PGI)
#define AMREX_CXX_PGI
#elif defined(__NVCOMPILER)
#define AMREX_CXX_NVHPC
#elif defined(__NEC__)
#define AMREX_CXX_NEC
#elif defined(__ibmxl__)
Expand Down Expand Up @@ -61,6 +63,9 @@
#elif defined(__PGI)
#define AMREX_PRAGMA_SIMD _Pragma("loop ivdep")

#elif defined(__NVCOMPILER)
#define AMREX_PRAGMA_SIMD _Pragma("loop ivdep")

#elif defined(__NEC__)
#define AMREX_PRAGMA_SIMD

Expand Down Expand Up @@ -94,6 +99,9 @@
#elif defined(__PGI)
#define AMREX_FORCE_INLINE inline

#elif defined(__NVCOMPILER)
#define AMREX_FORCE_INLINE inline

#elif defined(__NEC__)
#define AMREX_FORCE_INLINE inline

Expand Down
2 changes: 2 additions & 0 deletions Tools/CMake/AMReXGenerateConfigHeader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function ( generate_config_header )
set(COMPILER_ID_MACRO __CRAYC)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI" )
set(COMPILER_ID_MACRO __PGI)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "NVHPC" )
set(COMPILER_ID_MACRO __NVCOMPILER)
elseif ( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) OR
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" ) OR
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "ROCMClang" ) OR
Expand Down

0 comments on commit b11479d

Please sign in to comment.