From fa5225e268cc7276db44855cd808076529b41490 Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Wed, 10 Jan 2024 20:50:55 -0500 Subject: [PATCH] Update CI to test nvidia-hpc compilers (#221) --- .../workflows/{standalone.yml => meson.yml} | 86 ++++++++----------- README.meson | 1 + meson.build | 25 ++++-- 3 files changed, 56 insertions(+), 56 deletions(-) rename .github/workflows/{standalone.yml => meson.yml} (71%) diff --git a/.github/workflows/standalone.yml b/.github/workflows/meson.yml similarity index 71% rename from .github/workflows/standalone.yml rename to .github/workflows/meson.yml index 164854f385..6ddef10ac3 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/meson.yml @@ -7,41 +7,35 @@ on: types: [opened, synchronize, reopened] jobs: build: - name: GALAHAD/${{ matrix.os }}/${{ matrix.fc_cmd }}/${{ matrix.compiler_version }} + name: GALAHAD/${{ matrix.os }}/${{ matrix.compiler }}/${{ matrix.version }} strategy: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] - compiler_version: [12] + version: ['12'] include: - - compiler: gnu - cc_cmd: gcc - fc_cmd: gfortran - cxx_cmd: g++ + - compiler: gcc int64: false - os: ubuntu-latest - compiler: gnu - compiler_version: 13 - cc_cmd: gcc - fc_cmd: gfortran - cxx_cmd: g++ + compiler: gcc + version: '13' int64: true allow_failure: true + - os: windows-latest + compiler: intel + version: '2023.2' + int64: false + allow_failure: true + - os: ubuntu-latest + compiler: intel + version: '2023.2' + int64: false + allow_failure: true - os: ubuntu-latest - compiler: intel-llvm - compiler_version: 2023.2.0 - cc_cmd: icx - fc_cmd: ifort - cxx_cmd: icpx + compiler: nvidia-hpc + version: '23.11' int64: false allow_failure: true - # - os: ubuntu-latest - # compiler: intel-llvm - # compiler_version: 2023.2 - # cc_cmd: icx - # fc_cmd: ifx - # cxx_cmd: icpx - # allow_failure: true runs-on: ${{ matrix.os }} steps: - name: Check out GALAHAD @@ -100,26 +94,21 @@ jobs: echo "OMP_CANCELLATION=TRUE" >> $GITHUB_ENV echo "OMP_PROC_BIND=TRUE" >> $GITHUB_ENV - - name: Install GNU compilers - if: matrix.compiler == 'gnu' - uses: awvwgk/setup-fortran@main + - name: Install compilers + uses: fortran-lang/setup-fortran@main with: - compiler: gcc - version: ${{ matrix.compiler_version }} + compiler: ${{ matrix.compiler }} + version: ${{ matrix.version }} - - name: Install classic Intel compilers + - name: Update Intel compilers if: matrix.compiler == 'intel' - uses: awvwgk/setup-fortran@main - with: - compiler: intel-classic - version: ${{ matrix.compiler_version }} + shell: bash + run: echo "FC=ifort" >> $GITHUB_ENV - - name: Install nextgen Intel compilers - if: matrix.compiler == 'intel-llvm' - uses: awvwgk/setup-fortran@main - with: - compiler: intel - version: ${{ matrix.compiler_version }} + # Uncomment this section to obtain ssh access to VM + # - name: Setup tmate session + # if: matrix.os == 'windows-latest' + # uses: mxschmitt/action-tmate@v3 - name: Setup GALAHAD shell: bash @@ -130,15 +119,15 @@ jobs: -Dgalahad_int64=true -Dlibblas_path=$DEPS/deps/$LIBDIR \ -Dliblapack_path=$DEPS/deps/$LIBDIR -Dlibblas=openblas64_ \ -Dliblapack=openblas64_ + elif [[ "${{matrix.compiler}}" == "nvidia-hpc" ]]; then + meson setup builddir --buildtype=debug -Dexamples=true -Dtests=true \ + --prefix=$GITHUB_WORKSPACE/galahad -Dpythoniface=true \ + -Dc_std=none -Dcpp_std=none -Dgalahad_int64=false else meson setup builddir --buildtype=debug -Dexamples=true -Dtests=true \ --prefix=$GITHUB_WORKSPACE/galahad -Dpythoniface=true \ -Dgalahad_int64=false fi - env: - CC: ${{ matrix.cc_cmd }} - FC: ${{ matrix.fc_cmd }} - CXX: ${{ matrix.cxx_cmd }} - name: Build GALAHAD shell: bash @@ -147,7 +136,7 @@ jobs: - uses: actions/upload-artifact@v3 if: failure() with: - name: ${{ matrix.os }}_${{ matrix.fc_cmd }}_${{ matrix.compiler_version }}_meson-log.txt + name: ${{ matrix.os }}_${{ matrix.compiler }}_${{ matrix.version }}_meson-log.txt path: builddir/meson-logs/meson-log.txt - name: Install GALAHAD @@ -157,14 +146,9 @@ jobs: - uses: actions/upload-artifact@v3 if: failure() with: - name: ${{ matrix.os }}_${{ matrix.fc_cmd }}_${{ matrix.compiler_version }}_install-log.txt + name: ${{ matrix.os }}_${{ matrix.compiler }}_${{ matrix.version }}_install-log.txt path: builddir/meson-logs/install-log.txt - # Uncomment this section to obtain ssh access to VM - # - name: Setup tmate session - # if: matrix.os == 'windows-latest' - # uses: mxschmitt/action-tmate@v3 - - name: Test GALAHAD shell: bash run: | @@ -172,5 +156,5 @@ jobs: - uses: actions/upload-artifact@v3 if: failure() with: - name: ${{ matrix.os }}_${{ matrix.fc_cmd }}_${{ matrix.compiler_version }}_testlog.txt + name: ${{ matrix.os }}_${{ matrix.compiler }}_${{ matrix.version }}_testlog.txt path: builddir/meson-logs/testlog.txt diff --git a/README.meson b/README.meson index 5e907f7ac0..1be1554cfc 100644 --- a/README.meson +++ b/README.meson @@ -60,6 +60,7 @@ Non-default compilers can be selected by setting the `CC`, `CXX` and ``` CC=icx CXX=icpx FC=ifort meson setup builddir [options...] CC=icx CXX=icpx FC=ifx meson setup builddir [options...] +CC=nvc CXX=nvc++ FC=nvfortran meson setup builddir -Dc_std=none -Dcpp_std=none [options...] ``` See https://mesonbuild.com/Reference-tables.html for supported compilers and linkers. diff --git a/meson.build b/meson.build index e1068d8a1e..82d11892f8 100644 --- a/meson.build +++ b/meson.build @@ -38,13 +38,23 @@ if fc.get_id() == 'nagfor' endif # Preprocessing +if fc.get_id() == 'intel-cl' or fc.get_id() == 'intel-llvm-cl' + output_generator = '/Fi:@OUTPUT@' +else + output_generator = ['-o', '@OUTPUT@'] +endif + pp_options = [] if fc.get_id() == 'gcc' pp_options += ['-cpp', '-E'] -elif fc.get_id() == 'intel' or fc.get_id() == 'intel-llvm' or fc.get_id() == 'intel-cl' or fc.get_id() == 'intel-llvm-cl' +elif fc.get_id() == 'intel' or fc.get_id() == 'intel-llvm' pp_options += ['-fpp', '-P'] +elif fc.get_id() == 'intel-cl' or fc.get_id() == 'intel-llvm-cl' + pp_options += ['/fpp', '/P'] elif fc.get_id() == 'nagfor' pp_options += ['-fpp', '-F'] +elif fc.get_id() == 'nvidia_hpc' + pp_options += ['-Mcpp', '-F'] endif # Options @@ -109,7 +119,10 @@ libampl = fc.find_library(libampl_name, dirs : libampl_path, required : false) lm = cc.find_library('m', required : false) # OpenMP -if fc.get_id() == 'nagfor' +if fc.get_id() == 'nvidia_hpc' + add_global_arguments('-mp', language : 'fortran') + add_global_link_arguments('-mp', language : 'fortran') +elif fc.get_id() == 'nagfor' add_global_arguments('-openmp', language : 'fortran') add_global_link_arguments('-openmp', language : 'fortran') elif fc.get_id() == 'gcc' @@ -122,7 +135,9 @@ elif fc.get_id() == 'intel-cl' or fc.get_id() == 'intel-llvm-cl' add_global_arguments('/Qopenmp', language : 'fortran') endif -if cxx.get_id() == 'gcc' or cxx.get_id() == 'clang' +if cxx.get_id() == 'nvidia_hpc' + add_global_arguments('-mp', language : 'cpp') +elif cxx.get_id() == 'gcc' or cxx.get_id() == 'clang' add_global_arguments('-fopenmp', language : 'cpp') elif cxx.get_id() == 'intel' or cxx.get_id() == 'intel-cl' add_global_arguments('-qopenmp', language : 'cpp') @@ -328,7 +343,7 @@ if build_single arguments : pp_options + extra_args_single + ['-I', '@CURRENT_SOURCE_DIR@/include', '-I', '@CURRENT_SOURCE_DIR@/src/dum/include', - '@INPUT@', '-o', '@OUTPUT@']) + '@INPUT@'] + output_generator) to_process_single = [libgalahad_src, libgalahad_c_src, libgalahad_ampl_src, libgalahad_mumps_single_src] if libcutest_single.found() @@ -359,7 +374,7 @@ if build_double arguments : pp_options + extra_args_double + ['-I', '@CURRENT_SOURCE_DIR@/include', '-I', '@CURRENT_SOURCE_DIR@/src/dum/include', - '@INPUT@', '-o', '@OUTPUT@']) + '@INPUT@'] + output_generator) to_process_double = [libgalahad_src, libgalahad_c_src, libgalahad_ampl_src, libgalahad_mumps_double_src] if libcutest_double.found()