From 65e1bd8ce90d286bd4ffc1575414d775ae86a319 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:44:42 -0500 Subject: Add NVidia compiler support and CI (#3686) --- .github/workflows/autotools.yml | 6 ++ .github/workflows/cmake.yml | 6 ++ .github/workflows/intel-auto.yml | 12 +-- .github/workflows/intel-cmake.yml | 8 +- .github/workflows/linux-nvhpc-auto.yml | 58 ------------ .github/workflows/linux-nvhpc.yml | 56 ------------ .github/workflows/nvhpc-auto.yml | 87 ++++++++++++++++++ .github/workflows/nvhpc-cmake.yml | 76 ++++++++++++++++ config/cmake/HDFCXXCompilerFlags.cmake | 18 +++- config/cmake/HDFCompilerFlags.cmake | 13 ++- config/cmake/HDFFortranCompilerFlags.cmake | 12 ++- config/linux-gnulibc1 | 4 + config/nvidia-cxxflags | 101 +++++++++++++++++++++ config/nvidia-fflags | 139 +++++++++++++++++++++++++++++ config/nvidia-flags | 122 +++++++++++++++++++++++++ fortran/src/CMakeLists.txt | 2 +- 16 files changed, 593 insertions(+), 127 deletions(-) delete mode 100644 .github/workflows/linux-nvhpc-auto.yml delete mode 100644 .github/workflows/linux-nvhpc.yml create mode 100644 .github/workflows/nvhpc-auto.yml create mode 100644 .github/workflows/nvhpc-cmake.yml create mode 100644 config/nvidia-cxxflags create mode 100644 config/nvidia-fflags create mode 100644 config/nvidia-flags diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index 89afa40..d0cf557 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -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" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 75180c0..84fe010 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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" diff --git a/.github/workflows/intel-auto.yml b/.github/workflows/intel-auto.yml index f5249bd..d63262f 100644 --- a/.github/workflows/intel-auto.yml +++ b/.github/workflows/intel-auto.yml @@ -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: | @@ -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 diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index 4bdda03..9972376 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -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 @@ -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 diff --git a/.github/workflows/linux-nvhpc-auto.yml b/.github/workflows/linux-nvhpc-auto.yml deleted file mode 100644 index 1281e97..0000000 --- a/.github/workflows/linux-nvhpc-auto.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: linux autotools nvhpc - -on: - workflow_dispatch: - push: - pull_request: - branches: [ develop ] - paths-ignore: - - '.github/CODEOWNERS' - - '.github/FUNDING.yml' - - 'doc/**' - - 'release_docs/**' - - 'ACKNOWLEDGEMENTS' - - 'COPYING**' - - '**.md' - -# Using concurrency to cancel any in-progress job or run -concurrency: - group: ${{ github.workflow }}-${{ github.sha || github.event.pull_request.number }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install System dependencies - run: | - sudo apt update - sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin build-essential - - name: Install NVHPC - 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 - - name: Get Sources - uses: actions/checkout@v4 - - name: Test HDF5 - env: - NPROCS: 2 - run: | - export NVHPCSDK=/opt/nvidia/hpc_sdk - export OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc++ - export OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc - export OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvfortran - export LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/lib - 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 - export DESTDIR=/tmp - ./autogen.sh - ./configure CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin/mpicc FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/comm_libs/openmpi4/bin/mpifort FCFLAGS="-fPIC -fortranlibs" --enable-fortran --enable-shared --enable-parallel - cat config.log - make -j - make check -j - make install - make uninstall diff --git a/.github/workflows/linux-nvhpc.yml b/.github/workflows/linux-nvhpc.yml deleted file mode 100644 index 06fd40a..0000000 --- a/.github/workflows/linux-nvhpc.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: linux CMake nvhpc - -on: - workflow_dispatch: - push: - pull_request: - branches: [ develop ] - paths-ignore: - - '.github/CODEOWNERS' - - '.github/FUNDING.yml' - - 'doc/**' - - 'release_docs/**' - - 'ACKNOWLEDGEMENTS' - - 'COPYING**' - - '**.md' - -# Using concurrency to cancel any in-progress job or run -concurrency: - group: ${{ github.workflow }}-${{ github.sha || github.event.pull_request.number }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install System dependencies - run: | - sudo apt update - sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin build-essential - - name: Install NVHPC - 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 - - name: Get Sources - uses: actions/checkout@v4 - - name: Test HDF5 - env: - FC: nvfortran - CC: nvc - FCFLAGS: -fPIC - run: | - export NVHPCSDK=/opt/nvidia/hpc_sdk - export OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc++ - export OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvc - export OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/bin/nvfortran - export 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 - 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 - cmake -B build -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=ON -DHDF5_BUILD_FORTRAN:BOOL=ON - cat build/CMakeCache.txt - cmake --build build - ctest --test-dir build --output-on-failure diff --git a/.github/workflows/nvhpc-auto.yml b/.github/workflows/nvhpc-auto.yml new file mode 100644 index 0000000..3e3a323 --- /dev/null +++ b/.github/workflows/nvhpc-auto.yml @@ -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 diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml new file mode 100644 index 0000000..489c0bb --- /dev/null +++ b/.github/workflows/nvhpc-cmake.yml @@ -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 diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index e8a55ba..13f712d 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -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") @@ -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") diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 1dca910..a6bce98 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -47,6 +47,17 @@ if(_CLANG_MSVC_WINDOWS AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGN set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker -stack:20000000") endif() +if(CMAKE_C_COMPILER_ID STREQUAL "NVHPC" ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=warn") + if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer") + if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s") + endif () + else () + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mbounds -g") + endif () +endif() + if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") @@ -106,7 +117,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) endif () #----------------------------------------------------------------------------- -# HDF5 library compile options +# HDF5 library compile options - to be made available to all targets #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- diff --git a/config/cmake/HDFFortranCompilerFlags.cmake b/config/cmake/HDFFortranCompilerFlags.cmake index e08df05..f207c70 100644 --- a/config/cmake/HDFFortranCompilerFlags.cmake +++ b/config/cmake/HDFFortranCompilerFlags.cmake @@ -41,7 +41,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) endif () #----------------------------------------------------------------------------- -# HDF5 library compile options +# HDF5 library compile options - to be made available to all targets #----------------------------------------------------------------------------- if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10.0) if (HDF5_ENABLE_BUILD_DIAGS) @@ -56,6 +56,16 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG") message (STATUS "... Select IEEE floating-point mode full") list (APPEND HDF5_CMAKE_Fortran_FLAGS "-ieee=full") endif () +if (CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") + if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer") + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mnoframe") + if (NOT ${HDF_CFG_NAME} MATCHES "RelWithDebInfo") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -s") + endif () + else () + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mbounds -Mchkptr -Mdclchk -g") + endif () +endif () if (NOT MSVC AND NOT MINGW) # General flags diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 7f3c339..7614b07 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -298,6 +298,7 @@ case $FC in *pgf90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'pgf90'` ;; + *nagfor*|*nagftn*) RM='rm -f' tmpfile=/tmp/cmpver.$$ @@ -322,6 +323,9 @@ fi # check if the compiler_version_info is already set if test -z "$cxx_version_info"; then case $CXX in + *nvc++*) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'nvc++'` + ;; *pgc++*) cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS -V 2>&1 | grep 'pgc++'` ;; diff --git a/config/nvidia-cxxflags b/config/nvidia-cxxflags new file mode 100644 index 0000000..6becd26 --- /dev/null +++ b/config/nvidia-cxxflags @@ -0,0 +1,101 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# NVIDIA nvc++ compiler or a derivative. It is careful not to do anything +# if the compiler is not NVIDIA; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for NVIDIA nvc++ +# unless a compiler version is already known +# +# cxx_vendor: The compiler name: nvc++ +# cxx_version: Version number: 5.0-2, 5.2-2 +# +if test X = "X$cxx_flags_set"; then + cxx_version="`$CXX $CXXFLAGS -V 2>&1 |grep '^nvc++ '`" + if test X != "X$cxx_version"; then + cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*++\).*/\1/'` + cxx_version=`echo $cxx_version |sed 's/nvc++ \([-a-z0-9\.\-]*\).*/\1/'` + echo "compiler '$CXX' is NVIDIA $cxx_vendor-$cxx_version" + + # Some version numbers + # NVIDIA version numbers are of the form: "major.minor-patch" + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d. | cut -f1 -d-` + cxx_vers_patch=`echo $cxx_version | cut -f2 -d. | cut -f2 -d-` + test -n "$cxx_vers_major" || cxx_vers_major=0 + test -n "$cxx_vers_minor" || cxx_vers_minor=0 + test -n "$cxx_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` + fi +fi + +# Common PGI flags for various situations +if test "X-nvc++" = "X-$cxx_vendor"; then + + ########### + # General # + ########### + + # Default to C++11 standard + H5_CXXFLAGS="$H5_CXXFLAGS -std=c++11 -Minform=warn" + + ############## + # Production # + ############## + + PROD_CXXFLAGS= + + ######### + # Debug # + ######### + + # NDEBUG is handled explicitly in configure + # -g is handled by the symbols flags + DEBUG_CXXFLAGS="-Mbounds" + + ########### + # Symbols # + ########### + + NO_SYMBOLS_CXXFLAGS="-s" + SYMBOLS_CXXFLAGS="-g" + + ############# + # Profiling # + ############# + + PROFILE_CXXFLAGS="-Mprof=func,line" + # Use this for profiling with gprof + #PROFILE_CXXFLAGS="-pg" + + ################ + # Optimization # + ################ + + HIGH_OPT_CXXFLAGS="-O4" + DEBUG_OPT_CXXFLAGS="-gopt -O2" + NO_OPT_CXXFLAGS="-O0" + + ################# + # Flags are set # + ################# + cxx_flags_set=yes +fi + +# Clear cxx info if no flags set +if test "X-$cxx_flags_set" = "X-"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/nvidia-fflags b/config/nvidia-fflags new file mode 100644 index 0000000..77677e1 --- /dev/null +++ b/config/nvidia-fflags @@ -0,0 +1,139 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# NVIDIA nvfortran compiler or a derivative. It is careful not to do anything +# if the compiler is not NVIDIA; otherwise `f9x_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for NVIDIA nvfortran +# unless a compiler version is already known +# +# f9x_vendor: The compiler name: nvfortran +# f9x_version: Version number: +# +if test X = "X$f9x_flags_set"; then + f9x_version="`$FC $FCFLAGS -V 2>&1 |grep '^nvfortran '`" + if test X != "X$f9x_version"; then + is_mpi="`$FC $FCFLAGS -help 2>&1 |grep 'link MPI'`" + f9x_vendor=`echo $f9x_version |sed 's/\([a-z0-9]*\).*/\1/'` + f9x_version=`echo $f9x_version |sed 's/nvfortran \([-a-z0-9\.\-]*\).*/\1/'` + echo "compiler '$FC' is NVIDIA $f9x_vendor-$f9x_version" + + # Some version numbers + # NVIDIA version numbers are of the form: "major.minor-patch" + f9x_vers_major=`echo $f9x_version | cut -f1 -d.` + f9x_vers_minor=`echo $f9x_version | cut -f2 -d. | cut -f1 -d-` + f9x_vers_patch=`echo $f9x_version | cut -f2 -d. | cut -f2 -d-` + test -n "$f9x_vers_major" || f9x_vers_major=0 + test -n "$f9x_vers_minor" || f9x_vers_minor=0 + test -n "$f9x_vers_patch" || f9x_vers_patch=0 + f9x_vers_all=`expr $f9x_vers_major '*' 1000000 + $f9x_vers_minor '*' 1000 + $f9x_vers_patch` + fi +fi + +# Common NVIDIA flags for various situations +if test "X-nvfortran" = "X-$f9x_vendor"; then + + ############################### + # Architecture-specific flags # + ############################### + + arch= + # Nothing currently. (Uncomment code below and modify to add any) + #case "$host_os-$host_cpu" in + # *-i686) + # arch="-march=i686" + # ;; + #esac + + # Host-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "`hostname`" in + # sleipnir.ncsa.uiuc.edu) + # arch="$arch -pipe" + # ;; + #esac + + ############## + # Production # + ############## + + # Check for MPI wrapper being used and tweak down compiler options + # Comment out the Tweaking since it caused problems to mpich1.2.6. + # Need to investigate the reasons to tweak. + #if test "X-" == "X-$is_mpi"; then + # PROD_FCFLAGS="-fast -s -Mnoframe" + #else + # PROD_FCFLAGS="-O2 -s" + #fi + PROD_FCFLAGS="-fast -Mnoframe -fPIC" + + ######### + # Debug # + ######### + + DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk -fPIC" + + ########### + # Symbols # + ########### + + NO_SYMBOLS_FCFLAGS="-s" + SYMBOLS_FCFLAGS="-g" + + ############# + # Profiling # + ############# + + PROFILE_FCFLAGS="-Mprof=func,line" + # Use this for profiling with gprof + #PROFILE_FCFLAGS="-pg" + + ################ + # Optimization # + ################ + + HIGH_OPT_FCFLAGS= + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + FC_BASENAME=nvfortran + Fortran_COMPILER_ID=NVIDIA + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + # Uncomment the following to add something specific for FCFLAGS. + #FCFLAGS="$FCFLAGS" + + + + ################# + # Flags are set # + ################# + f9x_flags_set=yes +fi + +# Clear f9x info if no flags set +if test "X-$f9x_flags_set" = "X-"; then + f9x_vendor= + f9x_version= +fi + diff --git a/config/nvidia-flags b/config/nvidia-flags new file mode 100644 index 0000000..864c644 --- /dev/null +++ b/config/nvidia-flags @@ -0,0 +1,122 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# NVIDIA nvc compiler or a derivative. It is careful not to do anything +# if the compiler is not nvcc; otherwise `cc_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for nvc +# unless a compiler version is already known +# +# cc_vendor: The compiler name: nvc +# cc_version: Version number: 5.0-2, 5.2-2 +# +if test X = "X$cc_flags_set"; then + cc_version="`$CC $CFLAGS -V 2>&1 |grep '^nvc '`" + if test X != "X$cc_version"; then + is_mpi="`$CC $CFLAGS -help 2>&1 |grep 'MPI'`" + cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` + cc_version=`echo $cc_version |sed 's/nvc \([-a-z0-9\.\-]*\).*/\1/'` + echo "compiler '$CC' is NVIDIA $cc_vendor-$cc_version" + + # Some version numbers + # NVIDIA version numbers are of the form: "major.minor-patch" + cc_vers_major=`echo $cc_version | cut -f1 -d.` + cc_vers_minor=`echo $cc_version | cut -f2 -d. | cut -f1 -d-` + cc_vers_patch=`echo $cc_version | cut -f2 -d. | cut -f2 -d-` + test -n "$cc_vers_major" || cc_vers_major=0 + test -n "$cc_vers_minor" || cc_vers_minor=0 + test -n "$cc_vers_patch" || cc_vers_patch=0 + cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` + fi +fi + +# Common PGI flags for various situations +if test "X-nvc" = "X-$cc_vendor" -o "X-nvcc" = "X-$cc_vendor"; then + # Insert section about version specific problems from compiler flags here, + # if necessary. + + arch= + # Architecture-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "$host_os-$host_cpu" in + # *-i686) + # arch="-march=i686" + # ;; + #esac + + # Host-specific flags + # Nothing currently. (Uncomment code below and modify to add any) + #case "`hostname`" in + # sleipnir.ncsa.uiuc.edu) + # arch="$arch -pipe" + # ;; + #esac + + ########### + # General # + ########### + + # Default to C99 standard. + H5_CFLAGS="$H5_CFLAGS $arch -c99 -Minform=warn" + + ############## + # Production # + ############## + + # NDEBUG is handled explicitly by the configure script + PROD_CFLAGS="-fast" + + ######### + # Debug # + ######### + + # NDEBUG is handled explicitly by the configure script + # -g is handled by the symbols flags + DEBUG_CFLAGS="-Mbounds" + + ########### + # Symbols # + ########### + + NO_SYMBOLS_CFLAGS="-s" + SYMBOLS_CFLAGS="-g" + + ############# + # Profiling # + ############# + + PROFILE_CFLAGS="-Mprof=func,line" + # Use this for profiling with gprof + #PROFILE_CFLAGS="-pg" + + ################ + # Optimization # + ################ + + HIGH_OPT_CFLAGS="-O1" # -O2+ currently has test failures. + DEBUG_OPT_CFLAGS="-gopt -O2" + NO_OPT_CFLAGS="-O0" + + ################# + # Flags are set # + ################# + cc_flags_set=yes +fi + +# Clear cc info if no flags set +if test "X-$cc_flags_set" = "X-"; then + cc_vendor= + cc_version= +fi diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 199a0c8..57e17e5 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -332,7 +332,7 @@ if (BUILD_STATIC_LIBS) target_compile_options(${HDF5_F90_LIB_TARGET} PRIVATE "${HDF5_CMAKE_Fortran_FLAGS}") target_compile_definitions(${HDF5_F90_LIB_TARGET} PRIVATE - "$<$:HDF5F90_WINDOWS"> + "$<$:HDF5F90_WINDOWS>" "$<$:${WIN_COMPILE_FLAGS}>" ) target_link_libraries (${HDF5_F90_LIB_TARGET} -- cgit v0.12