summaryrefslogtreecommitdiffstats
path: root/.github/workflows/aocc-ompi-cmake.yml
blob: f2a834d063f40aebe27e6ecdd73744ac1e6a4b28 (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
88
89
90
91
92
name: hdf5 dev PAR CMake aocc ompi

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

permissions:
  contents: read

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

      - name: Install Linux dependencies
        shell: bash
        run: |
          sudo apt update
          sudo apt install -y libaec-dev ninja-build
          sudo apt install -y doxygen libncurses-dev libquadmath0 libstdc++6 libxml2
          sudo apt install -y zlib1g-dev libcurl4-openssl-dev libjpeg-dev wget curl bzip2
          sudo apt install -y m4 flex bison cmake libzip-dev openssl build-essential

      - name: Install AOCC 4.1.0
        run: |
          wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0.tar
          tar -xvf aocc-compiler-4.1.0.tar
          cd aocc-compiler-4.1.0
          bash install.sh
          source /home/runner/work/hdf5/hdf5/setenv_AOCC.sh
          which clang
          which flang
          clang -v

      - name: Cache OpenMPI 4.1.5 installation
        id: cache-openmpi-4_1_5
        uses: actions/cache@v4
        with:
          path: /home/runner/work/hdf5/hdf5/openmpi-4.1.5-install
          key: ${{ runner.os }}-${{ runner.arch }}-openmpi-4_1_5-cache

      - name: Install OpenMPI 4.1.5
        if: ${{ steps.cache-openmpi-4_1_5.outputs.cache-hit != 'true' }}
        run: |
          export LD_LIBRARY_PATH=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib:/usr/local/lib
          wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz
          tar zxvf openmpi-4.1.5.tar.gz
          cd openmpi-4.1.5
          ./configure CC=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/bin/clang FC=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/bin/flang --prefix=/home/runner/work/hdf5/hdf5/openmpi-4.1.5-install
          make
          make install

      - name: CMake Configure with aocc
        shell: bash
        run: |
          export LD_LIBRARY_PATH=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib:/home/runner/work/hdf5/hdf5/openmpi-4.1.5-install/lib:/usr/local/lib
          export LD_RUN_PATH=/home/runner/work/hdf5/hdf5/aocc-compiler-4.1.0/lib:/home/runner/work/hdf5/hdf5/openmpi-4.1.5-install/lib:/usr/local/lib
          export PATH=/home/runner/work/hdf5/hdf5/openmpi-4.1.5-install/bin:/usr/local/bin:$PATH
          mkdir "${{ runner.workspace }}/build"
          cd "${{ runner.workspace }}/build"
          CC=mpicc 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=OFF \
          -DHDF5_BUILD_JAVA:BOOL=OFF \
          -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