| 
 | 1 | +# Build MPICH from source using the latest commit on the  | 
 | 2 | +# 'main' branch and cache the results. The result is installed  | 
 | 3 | +# to (or restored to) '${{ runner.workspace }}/mpich'.  | 
 | 4 | + | 
 | 5 | +# Triggers the workflow on a call from another workflow  | 
 | 6 | +on:  | 
 | 7 | +  workflow_call:  | 
 | 8 | +    inputs:  | 
 | 9 | +      build_mode:  | 
 | 10 | +        description: "production vs. debug build"  | 
 | 11 | +        required: true  | 
 | 12 | +        type: string  | 
 | 13 | + | 
 | 14 | +permissions:  | 
 | 15 | +  contents: read  | 
 | 16 | + | 
 | 17 | +jobs:  | 
 | 18 | +  ubuntu_gcc_build_and_test:  | 
 | 19 | +    name: "Build MPICH ${{ inputs.build_mode }} (GCC)"  | 
 | 20 | + | 
 | 21 | +    runs-on: ubuntu-latest  | 
 | 22 | + | 
 | 23 | +    steps:  | 
 | 24 | +      - name: Install Linux dependencies  | 
 | 25 | +        run: |  | 
 | 26 | +          sudo apt-get update  | 
 | 27 | +          sudo apt-get install build-essential libtool libtool-bin  | 
 | 28 | +
  | 
 | 29 | +      - name: Get MPICH source  | 
 | 30 | + | 
 | 31 | +        with:  | 
 | 32 | +          repository: 'pmodels/mpich'  | 
 | 33 | +          path: 'mpich'  | 
 | 34 | +          submodules: recursive  | 
 | 35 | + | 
 | 36 | +      - name: Get MPICH commit hash  | 
 | 37 | +        shell: bash  | 
 | 38 | +        id: get-sha  | 
 | 39 | +        run: |  | 
 | 40 | +          cd $GITHUB_WORKSPACE/mpich  | 
 | 41 | +          export MPICH_SHA=$(git rev-parse HEAD)  | 
 | 42 | +          echo "MPICH_SHA=$MPICH_SHA" >> $GITHUB_ENV  | 
 | 43 | +          echo "sha=$MPICH_SHA" >> $GITHUB_OUTPUT  | 
 | 44 | +          # Output SHA for debugging  | 
 | 45 | +          echo "MPICH_SHA=$MPICH_SHA"  | 
 | 46 | +
  | 
 | 47 | +      - name: Cache MPICH (GCC) installation  | 
 | 48 | +        id: cache-mpich-ubuntu-gcc  | 
 | 49 | +        uses: actions/cache@v4  | 
 | 50 | +        with:  | 
 | 51 | +          path: ${{ runner.workspace }}/mpich  | 
 | 52 | +          key: ${{ runner.os }}-${{ runner.arch }}-gcc-mpich-${{ steps.get-sha.outputs.sha }}-${{ inputs.build_mode }}  | 
 | 53 | + | 
 | 54 | +      # Enable threads=multiple for testing with Subfiling and  | 
 | 55 | +      # VOL connectors that require MPI_THREAD_MULTIPLE  | 
 | 56 | +      - name: Install MPICH (GCC) (Production)  | 
 | 57 | +        if: ${{ steps.cache-mpich-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode != 'debug') }}  | 
 | 58 | +        run: |  | 
 | 59 | +          cd $GITHUB_WORKSPACE/mpich  | 
 | 60 | +          ./autogen.sh  | 
 | 61 | +          ./configure \  | 
 | 62 | +            CC=gcc \  | 
 | 63 | +            --prefix=${{ runner.workspace }}/mpich \  | 
 | 64 | +            --enable-threads=multiple  | 
 | 65 | +          make -j2  | 
 | 66 | +          make install  | 
 | 67 | +
  | 
 | 68 | +      # Enable threads=multiple for testing with Subfiling and  | 
 | 69 | +      # VOL connectors that require MPI_THREAD_MULTIPLE  | 
 | 70 | +      - name: Install MPICH (GCC) (Debug)  | 
 | 71 | +        if: ${{ steps.cache-mpich-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode == 'debug') }}  | 
 | 72 | +        run: |  | 
 | 73 | +          cd $GITHUB_WORKSPACE/mpich  | 
 | 74 | +          ./autogen.sh  | 
 | 75 | +          ./configure \  | 
 | 76 | +            CC=gcc \  | 
 | 77 | +            --prefix=${{ runner.workspace }}/mpich \  | 
 | 78 | +            --enable-g=most \  | 
 | 79 | +            --enable-debuginfo \  | 
 | 80 | +            --enable-threads=multiple  | 
 | 81 | +          make -j2  | 
 | 82 | +          make install  | 
0 commit comments