Skip to content

Commit

Permalink
Add NVidia compiler support and CI (#3686)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Oct 18, 2023
1 parent fce7ce1 commit 65e1bd8
Show file tree
Hide file tree
Showing 16 changed files with 593 additions and 127 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/autotools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ jobs:
uses: ./.github/workflows/intel-auto.yml
with:
build_mode: "production"

call-release-auto-nvhpc:
name: "Autotools nvhpc Workflows"
uses: ./.github/workflows/nvhpc-auto.yml
with:
build_mode: "production"
6 changes: 6 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@ jobs:
uses: ./.github/workflows/intel-cmake.yml
with:
build_mode: "Release"

call-release-cmake-nvhpc:
name: "CMake nvhpc Workflows"
uses: ./.github/workflows/nvhpc-cmake.yml
with:
build_mode: "Release"
12 changes: 7 additions & 5 deletions .github/workflows/intel-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ permissions:

jobs:
Intel_build_and_test:
name: "Intel ${{ inputs.build_mode }} -Werror (build only)"
name: "Intel ${{ inputs.build_mode }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Dependencies
run: |
run: |
sudo apt-get update
sudo apt-get install autoconf automake libtool libtool-bin libaec-dev
- name: Add oneAPI to apt
shell: bash
run: |
Expand All @@ -39,9 +41,9 @@ jobs:
sudo apt install -y intel-oneapi-mpi-devel
sudo apt-get install doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
echo "CC=icx" >> $GITHUB_ENV
echo "CXX=icpx" >> $GITHUB_ENV
echo "FC=ifx" >> $GITHUB_ENV
echo "CC=icx" >> $GITHUB_ENV
echo "CXX=icpx" >> $GITHUB_ENV
echo "FC=ifx" >> $GITHUB_ENV
- name: Install oneAPI MKL library
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/intel-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

jobs:
Intel_build_and_test:
name: "Intel ${{ inputs.build_mode }} -Werror (build only)"
name: "Intel ${{ inputs.build_mode }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -30,9 +30,9 @@ jobs:
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt-get install ninja-build doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
sudo apt update
sudo apt-get install ninja-build doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
- name: install oneAPI dpcpp and fortran compiler
shell: bash
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/linux-nvhpc-auto.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/linux-nvhpc.yml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/nvhpc-auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: hdf5 dev autotools nvhpc

on:
workflow_call:
inputs:
build_mode:
description: "release vs. debug build"
required: true
type: string

permissions:
contents: read

jobs:
nvhpc_build_and_test:
name: "nvhpc ${{ inputs.build_mode }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install autoconf automake libtool libtool-bin libaec-dev
sudo apt-get install doxygen graphviz
sudo apt install -y zlib1g-dev libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev openssl build-essential
- name: Install NVHPC
shell: bash
run: |
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-23-7
echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV
echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV
echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc++" >> $GITHUB_ENV
echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc" >> $GITHUB_ENV
echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvfortran" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/lib" >> $GITHUB_ENV
echo "DESTDIR=/tmp" >> $GITHUB_ENV
- name: Autotools Configure
shell: bash
run: |
export RUNPARALLEL="mpiexec -np 2"
export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin:$PATH
sh ./autogen.sh
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
$GITHUB_WORKSPACE/configure \
FCFLAGS="-fPIC -fortranlibs" \
--enable-build-mode=${{ inputs.build_mode }} \
--enable-fortran \
--enable-shared \
--enable-parallel
#cat config.log
# BUILD
- name: Autotools Build
shell: bash
run: |
export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin:$PATH
make -j3
working-directory: ${{ runner.workspace }}/build

# RUN TESTS
# NORMAL
- name: Autotools Run Tests
run: |
export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin:$PATH
make check -j
working-directory: ${{ runner.workspace }}/build

# INSTALL (note that this runs even when we don't run the tests)
- name: Autotools Install
run: |
export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin:$PATH
make install
working-directory: ${{ runner.workspace }}/build

# - name: Autotools Verify Install
# run: |
# export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin:$PATH
# make check-install
# working-directory: ${{ runner.workspace }}/build
76 changes: 76 additions & 0 deletions .github/workflows/nvhpc-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: hdf5 dev CMake nvhpc

on:
workflow_call:
inputs:
build_mode:
description: "release vs. debug build"
required: true
type: string

permissions:
contents: read

jobs:
nvhpc_build_and_test:
name: "nvhpc ${{ inputs.build_mode }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Linux dependencies
shell: bash
run: |
sudo apt update
sudo apt-get install ninja-build doxygen graphviz
sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev
sudo apt install -y libaec-dev zlib1g-dev wget curl bzip2 flex bison cmake libzip-dev openssl build-essential
- name: Install NVHPC
shell: bash
run: |
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-23-7
echo "CC=nvc" >> $GITHUB_ENV
echo "FC=nvfortran" >> $GITHUB_ENV
echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV
echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc++" >> $GITHUB_ENV
echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc" >> $GITHUB_ENV
echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvfortran" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/cuda/12.2/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/lib" >> $GITHUB_ENV
echo "DESTDIR=/tmp" >> $GITHUB_ENV
- name: CMake Configure with nvc
shell: bash
run: |
export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin:$PATH
mkdir "${{ runner.workspace }}/build"
cd "${{ runner.workspace }}/build"
cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \
-DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \
-DHDF5_ENABLE_PARALLEL:BOOL=ON \
-DHDF5_BUILD_CPP_LIB:BOOL=OFF \
-DLIBAEC_USE_LOCALCONTENT=OFF \
-DZLIB_USE_LOCALCONTENT=OFF \
-DHDF5_BUILD_FORTRAN:BOOL=ON \
-DHDF5_ENABLE_ASSERTS:BOOL=ON \
-DMPIEXEC_MAX_NUMPROCS:STRING="2" \
$GITHUB_WORKSPACE
cat src/libhdf5.settings
# BUILD
- name: CMake Build
shell: bash
run: |
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
working-directory: ${{ runner.workspace }}/build

# RUN TESTS
# - name: CMake Run Tests
# shell: bash
# run: |
# ctest . --parallel 2 -C ${{ inputs.build_mode }} -V
# working-directory: ${{ runner.workspace }}/build
18 changes: 17 additions & 1 deletion config/cmake/HDFCXXCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED)
endif ()
endif ()

if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC" AND CMAKE_CXX_COMPILER_LOADED)
if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 11)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
endif ()
endif ()
if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Minform=warn")
if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
endif ()
else ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Mbounds -gopt -g")
endif ()
endif ()

if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
Expand Down Expand Up @@ -97,7 +113,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
endif ()

#-----------------------------------------------------------------------------
# HDF5 library compile options
# HDF5 library compile options - to be made available to all targets
#-----------------------------------------------------------------------------

if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
Expand Down
Loading

0 comments on commit 65e1bd8

Please sign in to comment.