summaryrefslogtreecommitdiffstats
path: root/.github/workflows/nvhpc-auto.yml
blob: 542eebea2e90e9074edccef7071f5bc467e26b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: hdf5 1.14 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.1.1

      - 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-9
          echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
          echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/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.9/compilers/bin/nvc++" >> $GITHUB_ENV
          echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV
          echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV
          echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/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.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/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.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/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.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/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.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/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.9/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH
#          make check-install
#        working-directory: ${{ runner.workspace }}/build