diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 86b87941e..ffe1aa6f0 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -11,6 +11,10 @@ env: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ad_type: ['', 'codipack'] steps: - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!" @@ -35,6 +39,14 @@ jobs: cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh cd $ISSM_DIR/externalpackages/petsc && ./install-3.21-linux.sh + - name: Install Codipack + if: ${{ matrix.ad_type == 'codipack'}} + run: | + source $ISSM_DIR/etc/environment.sh + cd $ISSM_DIR/externalpackages/gsl && ./install.sh + cd $ISSM_DIR/externalpackages/codipack && ./install.sh + cd $ISSM_DIR/externalpackages/medipack && ./install.sh + - name: Get MATLAB id: setup-matlab uses: matlab-actions/setup-matlab@v2 @@ -42,7 +54,8 @@ jobs: release: R2023b cache: true - - name: Reconfigure ISSM + - name: Reconfigure ISSM without AD + if: ${{ matrix.ad_type == ''}} run: | source $ISSM_DIR/etc/environment.sh autoreconf -ivf @@ -63,18 +76,48 @@ jobs: --with-mumps-dir="${ISSM_DIR}/externalpackages/petsc/install" \ --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install" \ --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" - + + - name: Reconfigure ISSM without Codipack + if: ${{ matrix.ad_type == 'codipack'}} + run: | + source $ISSM_DIR/etc/environment.sh + autoreconf -ivf + ./configure --prefix=${ISSM_DIR} \ + --enable-tape-alloc \ + --enable-development \ + --enable-debugging \ + --with-numthreads=4 \ + --without-kriging \ + --without-kml \ + --without-Sealevelchange \ + --without-Love \ + --with-matlab-dir=${{ steps.setup-matlab.outputs.matlabroot }} \ + --with-fortran-lib="-L/usr/lib/x86_64-linux-gnu -lgfortran" \ + --with-mpi-include="${ISSM_DIR}/externalpackages/petsc/install/include" \ + --with-mpi-libflags="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lmpi -lmpicxx -lmpifort" \ + --with-petsc-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-blas-lapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-metis-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-parmetis-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-scalapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-mumps-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install" \ + --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" \ + --with-gsl-dir=${ISSM_DIR}/externalpackages/gsl/install \ + --with-medipack-dir="${ISSM_DIR}/externalpackages/medipack/install" \ + --with-codipack-dir="${ISSM_DIR}/externalpackages/codipack/install" + - name: Compile ISSM run: make -j16 install - name: Compress ISSM artifact - run: tar -cvf ISSM_artifact.tar -C ${{ env.ISSM_DIR }}/ . + run: tar -cvf ISSM_artifact-${{ matrix.ad_type}}.tar -C ${{ env.ISSM_DIR }}/ . - name: Upload ISSM artifact uses: actions/upload-artifact@v4 with: - name: ISSM-${{ runner.os }} - path: ISSM_artifact.tar + name: ISSM-${{ runner.os }}-${{ matrix.ad_type}} + path: ISSM_artifact-${{ matrix.ad_type}}.tar compression-level: 1 test: @@ -83,18 +126,22 @@ jobs: strategy: fail-fast: false matrix: - test-cases: ["101:110", "201:210", "301:310"] + ad_type: ['', 'codipack'] + test-cases: ['101:110, "201:210', '301:310'] + include: + - ad_type: 'codipack' + test-cases: '3015,3119,3480,3201:3206' + steps: - name: Download ISSM artifact uses: actions/download-artifact@v4 with: - name: ISSM-${{ runner.os }} + name: ISSM-${{ runner.os }}-${{ matrix.ad_type}} path: ${{ env.ISSM_DIR }} - name: uncompress ISSM artifact run: | - tar -xvf ISSM_artifact.tar - rm ISSM_artifact.tar + tar -xvf ISSM_artifact-${{ matrix.ad_type}}.tar source $ISSM_DIR/etc/environment.sh working-directory: ${{ env.ISSM_DIR }} shell: 'bash' @@ -117,7 +164,7 @@ jobs: devpath; % Run tests - runme('exclude',[IdFromString('Dakota')],'id',${{matrix.test-cases}},'quitonerror',1); + runme('exclude',[IdFromString('Dakota')],'id',[${{matrix.test-cases}}],'quitonerror',1); quit(0); EOF cat ${ISSM_DIR}/matlab_ci.m diff --git a/.github/workflows/common-workflow.yml b/.github/workflows/common-workflow.yml new file mode 100644 index 000000000..239a9036f --- /dev/null +++ b/.github/workflows/common-workflow.yml @@ -0,0 +1,196 @@ +name: Common CI + +on: + workflow_call: + inputs: + os: + required: true + type: string + build_type: + required: true + type: string +env: + ISSM_DIR: ${{ github.workspace }} + +jobs: + build: + name: build-ISSM-${{ inputs.os }}-${{ inputs.build_type}} + runs-on: ${{ inputs.os }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Cache externalpackages + uses: actions/cache@v3 + id: cache-externalpackages + env: + cache-name: cache-externalpackages-${{ inputs.build_type }} + with: + path: | + ${{ env.ISSM_DIR }}/externalpackages/ + !${{ env.ISSM_DIR }}/externalpackages/petsc/src/ + key: ${{ runner.os }}-build-${{ env.cache-name }} + + - name: Install External packages + if: ${{ ( inputs.build_type == 'basic') && (steps.cache-externalpackages.outputs.cache-hit != 'true') }} + run: | + cd $ISSM_DIR/externalpackages/triangle && ./install-linux.sh + cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh + cd $ISSM_DIR/externalpackages/petsc && ./install-3.21-linux.sh + cd $ISSM_DIR/externalpackages/semic && ./install.sh + + - name: Install External packages for AD + if: ${{ ( inputs.build_type == 'codipack') && (steps.cache-externalpackages.outputs.cache-hit != 'true') }} + run: | + cd $ISSM_DIR/externalpackages/triangle && ./install-linux.sh + cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh + cd $ISSM_DIR/externalpackages/petsc && ./install-3.20-linux.sh + cd $ISSM_DIR/externalpackages/gsl && ./install.sh + cd $ISSM_DIR/externalpackages/codipack && ./install.sh + cd $ISSM_DIR/externalpackages/medipack && ./install.sh + + - name: Get MATLAB + id: setup-matlab + uses: matlab-actions/setup-matlab@v2 + with: + release: R2023b + cache: true + + - name: Reconfigure ISSM without AD + if: ${{ inputs.build_type == 'basic'}} + run: | + source $ISSM_DIR/etc/environment.sh + autoreconf -ivf + ./configure --prefix=${ISSM_DIR} \ + --disable-static \ + --enable-development \ + --enable-debugging \ + --with-numthreads=4 \ + --with-matlab-dir=${{ steps.setup-matlab.outputs.matlabroot }} \ + --with-fortran-lib="-L/usr/lib/x86_64-linux-gnu -lgfortran" \ + --with-mpi-include="${ISSM_DIR}/externalpackages/petsc/install/include" \ + --with-mpi-libflags="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lmpi -lmpicxx -lmpifort" \ + --with-petsc-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-blas-lapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-metis-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-parmetis-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-scalapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-mumps-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install" \ + --with-semic-dir="${ISSM_DIR}/externalpackages/semic/install" \ + --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" + + - name: Reconfigure ISSM with Codipack + if: ${{ inputs.build_type == 'codipack'}} + run: | + source $ISSM_DIR/etc/environment.sh + autoreconf -ivf + ./configure --prefix=${ISSM_DIR} \ + --enable-tape-alloc \ + --enable-development \ + --enable-debugging \ + --with-numthreads=4 \ + --without-kriging \ + --without-kml \ + --without-Sealevelchange \ + --without-Love \ + --with-matlab-dir=${{ steps.setup-matlab.outputs.matlabroot }} \ + --with-fortran-lib="-L/usr/lib/x86_64-linux-gnu -lgfortran" \ + --with-mpi-include="${ISSM_DIR}/externalpackages/petsc/install/include" \ + --with-mpi-libflags="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lmpi -lmpicxx -lmpifort" \ + --with-blas-lapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-metis-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-parmetis-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-scalapack-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-mumps-dir="${ISSM_DIR}/externalpackages/petsc/install" \ + --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install" \ + --with-gsl-dir="${ISSM_DIR}/externalpackages/gsl/install" \ + --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" \ + --with-medipack-dir="${ISSM_DIR}/externalpackages/medipack/install" \ + --with-codipack-dir="${ISSM_DIR}/externalpackages/codipack/install" + + - name: Compile ISSM + run: make -j4 install + + - name: Compress ISSM artifact + run: tar --exclude='./externalpackages/petsc/src' -cvf ISSM_artifact-${{ inputs.build_type}}.tar -C ${{ env.ISSM_DIR }}/ . + + - name: Upload ISSM artifact + uses: actions/upload-artifact@v4 + with: + name: ISSM-${{ runner.os }}-${{ inputs.build_type}} + path: ISSM_artifact-${{ inputs.build_type}}.tar + compression-level: 1 + test: + runs-on: ${{ inputs.os }} + needs: build + strategy: + fail-fast: false + matrix: + test-cases: + - '101:399' + - '401:899' + - '3015, 3119, 3480, 3201:3206' + build-type: + - ${{ inputs.build_type }} + additional: + - " " + - "'benchmark','all'," + exclude: + - build-type: 'basic' + additional: "'benchmark','all'," + - build-type: 'basic' + test-cases: '3015, 3119, 3480, 3201:3206' + - build-type: 'codipack' + additional: " " + - build-type: 'codipack' + test-cases: '101:399' + - build-type: 'codipack' + test-cases: '401:899' + + steps: + - name: Download ISSM artifact + uses: actions/download-artifact@v4 + with: + name: ISSM-${{ runner.os }}-${{ inputs.build_type}} + path: ${{ env.ISSM_DIR }} + + - name: uncompress ISSM artifact + run: | + tar -xvf ISSM_artifact-${{ inputs.build_type}}.tar + source $ISSM_DIR/etc/environment.sh + working-directory: ${{ env.ISSM_DIR }} + shell: 'bash' + + - name: Get MATLAB + id: setup-matlab + uses: matlab-actions/setup-matlab@v2 + with: + release: R2023b + cache: true + + - name: Creating matlab_ci.m + run: | + cat > ${ISSM_DIR}/matlab_ci.m << EOF + % Go to the test directory + cd $ISSM_DIR/test/NightlyRun/ + + % Add ISSM tools to path + addpath('${ISSM_DIR}/src/m/dev'); + devpath; + + % Run tests + runme('exclude',[IdFromString('Dakota')],${{matrix.additional}} 'id',[${{matrix.test-cases}}],'quitonerror',1); + quit(0); + EOF + cat ${ISSM_DIR}/matlab_ci.m + + - name: Get run-matlab-command + run: | + wget -O /usr/local/bin/run-matlab-command https://ssd.mathworks.com/supportfiles/ci/run-matlab-command/v2/glnxa64/run-matlab-command + chmod +x /usr/local/bin/run-matlab-command + + - name: Run MATLAB tests + run: | + source $ISSM_DIR/etc/environment.sh + LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6:$ISSM_DIR/externalpackages/petsc/install/lib/libmpi.so:$ISSM_DIR/externalpackages/petsc/install/lib/libmpifort.so run-matlab-command "matlab_ci" diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml new file mode 100644 index 000000000..490c8459d --- /dev/null +++ b/.github/workflows/main-ci.yml @@ -0,0 +1,23 @@ +name: Main Workflow + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] +env: + ISSM_DIR: ${{ github.workspace }} + +jobs: + build-test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + build_type: ['basic', 'codipack'] + uses: ./.github/workflows/common-workflow.yml + with: + os: ${{ matrix.os }} + build_type: ${{ matrix.build_type }} + secrets: inherit + name: build-test-${{ matrix.os }}-${{ matrix.build_type }}