Skip to content

Commit

Permalink
Add first try at NVHPC cpu CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherwharrop-noaa committed Aug 9, 2024
1 parent 3f5c428 commit 8b295bb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/linux_nvhpc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Linux NVHPC
# triggered events (push, pull_request) for the develop branch
# triggered events (push, pull_request) for the master branch
on:
push:
branches: [ develop ]
branches: [ master ]
pull_request:
branches: [ develop ]
branches: [ master ]
workflow_dispatch:

defaults:
Expand Down Expand Up @@ -34,11 +34,19 @@ jobs:
source /usr/share/lmod/lmod/init/bash
module list
# Install NVIDIA HPC SDK
#- name: Install NVIDIA HPC SDK
# run: |
# wget "$NVIDIA_HPC_SDK_URL1" "$NVIDIA_HPC_SDK_URL2"
# sudo apt-get install ./nvhpc-21-9_21.9_amd64.deb ./nvhpc-2021_21.9_amd64.deb

# Install NVIDIA HPC SDK
- name: Install NVIDIA HPC SDK
run: |
wget "$NVIDIA_HPC_SDK_URL1" "$NVIDIA_HPC_SDK_URL2"
sudo apt-get install ./nvhpc-21-9_21.9_amd64.deb ./nvhpc-2021_21.9_amd64.deb
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
sudo apt-get install -y nvhpc-24-7
# Check location of installed NVHPC compilers
- name: Check compiler install
Expand All @@ -63,8 +71,8 @@ jobs:
rm -rf build
mkdir build
cd build
export OMP_NUM_THREADS=4
cmake -DCMAKE_BUILD_TYPE=debug ..
#export OMP_NUM_THREADS=4
cmake -DCMAKE_BUILD_TYPE=debug -DENABLE_GPU=off ..
make
ctest --output-on-failure
Expand All @@ -78,7 +86,7 @@ jobs:
rm -rf build
mkdir build
cd build
export OMP_NUM_THREADS=4
cmake -DCMAKE_BUILD_TYPE=release ..
#export OMP_NUM_THREADS=4
cmake -DCMAKE_BUILD_TYPE=release -DENABLE_GPU=off ..
make
ctest --output-on-failure
4 changes: 4 additions & 0 deletions ref/cmake/gf_compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ elseif (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
include("compiler_flags_Intel_Fortran")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
include("compiler_flags_PGI_Fortran")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
include("compiler_flags_NVHPC_Fortran")
endif()

# Set flags depending on which compiler iis used
Expand All @@ -19,4 +21,6 @@ elseif (CMAKE_C_COMPILER_ID MATCHES "^Intel")
include("compiler_flags_Intel_C")
elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI")
include("compiler_flags_PGI_C")
elseif (CMAKE_C_COMPILER_ID STREQUAL "NVHPC")
include("compiler_flags_NVHPC_C")
endif()
8 changes: 6 additions & 2 deletions ref/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ add_test(NAME cpu_kernel
COMMAND bash -c "${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS} ../src/gf_kernel_cpu > test_output/gf_kernel_cpu.log")
add_test(NAME compare_cpu_kernel
COMMAND ${COMPARE_SH} test_output/gf_kernel_cpu.log test_output/output.test)
if ( CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" )
set_property(TEST cpu_kernel PROPERTY ENVIRONMENT "FORTRANOPT=no_minus_zero")
endif()

# Tests when GPU is enabled
if ( ENABLE_GPU )
Expand All @@ -30,7 +33,8 @@ if ( ENABLE_GPU )
COMMAND bash -c "${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS} ../src/gf_kernel_gpu > test_output/gf_kernel_gpu.log")
add_test(NAME compare_gpu_kernel
COMMAND ${COMPARE_SH} test_output/gf_kernel_gpu.log test_output/output.test)
if ( CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" )
set_property(TEST gpu_kernel PROPERTY ENVIRONMENT "FORTRANOPT=no_minus_zero")
endif()

endif()


0 comments on commit 8b295bb

Please sign in to comment.