diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3706f90f53..ab7aa09a53 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,139 +1,44 @@ -name: CI - -# Controls when the action will run. -on: [push, pull_request] -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch +name: eCLM CI Test +# Controls when the action will run. on: push: branches: [eclm] pull_request: branches: [eclm] -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest + eclm_build_job: + runs-on: ubuntu-22.04 env: CC: mpicc FC: mpifort - CXX: mpicxx - CPPFLAGS: "-I/usr/include -I/usr/local/include" - CIME_TEST_PLATFORM: ubuntu-latest - # Versions of all dependencies can be updated here - PNETCDF_VERSION: pnetcdf-1.12.3 - NETCDF_FORTRAN_VERSION: v4.6.0 - MCT_VERSION: MCT_2.11.0 - PARALLELIO_VERSION: pio2_5_10 - NETCDF_C_PATH: /usr - NETCDF_FORTRAN_PATH: ${HOME}/netcdf-fortran - PNETCDF_PATH: ${HOME}/pnetcdf - CIME_MODEL: cesm - CIME_DRIVER: mct + BUILD_DIR: bld + INSTALL_DIR: install + CMAKE_BUILD_PARALLEL_LEVEL: 4 - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - - id: load-env - run: | - sudo apt-get update - sudo apt-get install libxml2-utils pylint wget gfortran openmpi-bin netcdf-bin libopenmpi-dev cmake libnetcdf-dev - - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v4 - # with: - # python-version: ${{ matrix.python-version }} - # cache: 'pip' - - # - name: pip install - # run: pip install PyYAML - - - name: cache pnetcdf - id: cache-pnetcdf - uses: actions/cache@v3 - with: - path: ~/pnetcdf - key: ${{ runner.os }}-${{ env.PNETCDF_VERSION}}-pnetcdf-redo - - - name: pnetcdf build - if: steps.cache-pnetcdf.outputs.cache-hit != 'true' - run: | - wget https://parallel-netcdf.github.io/Release/${{ env.PNETCDF_VERSION }}.tar.gz - tar -xzvf ${{ env.PNETCDF_VERSION }}.tar.gz - ls -l - pushd ${{ env.PNETCDF_VERSION }} - chmod +x configure - bash ./configure --prefix=$HOME/pnetcdf --enable-shared --disable-cxx - make - make install - popd - - - name: Cache netcdf-fortran - id: cache-netcdf-fortran - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@latest with: - path: ~/netcdf-fortran - key: ${{ runner.os }}-${{ env.NETCDF_FORTRAN_VERSION }}-netcdf-fortran-redo + packages: libxml2-utils pylint wget cmake netcdf-bin libnetcdf-dev libnetcdff-dev libpnetcdf-dev + version: 1.0 + execute_install_scripts: true - - name: netcdf fortran build - if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true' - run: | - wget https://github.com/Unidata/netcdf-fortran/archive/${{ env.NETCDF_FORTRAN_VERSION }}.tar.gz - tar -xzvf ${{ env.NETCDF_FORTRAN_VERSION }}.tar.gz - ls -l - pushd netcdf-fortran-* - chmod +x configure - bash ./configure --prefix=$HOME/netcdf-fortran - make - make install + - name: Download MPI Fortran compiler + run: sudo apt-get install gfortran openmpi-bin libopenmpi-dev - - name: link netcdf-c to netcdf-fortran path - # link netcdf c library here to simplify build + - name: Configure eCLM run: | - pushd ${{ env.NETCDF_FORTRAN_PATH }}/include - ln -fs /usr/include/*netcdf* . - pushd ${{ env.NETCDF_FORTRAN_PATH }}/lib - clibdir=`nc-config --libdir` - ln -fs $clibdir/lib* . - - sudo ln -s $HOME/pnetcdf/lib/pkgconfig/pnetcdf.pc /usr/lib/pkgconfig - sudo ln -s $HOME/netcdf-fortran/lib/pkgconfig/netcdf-fortran.pc /usr/lib/pkgconfig - -# The following can be used to ssh to the testnode for debugging -# see https://github.com/mxschmitt/action-tmate for details -# - name: Setup tmate session -# uses: mxschmitt/action-tmate@v3 - - uses: actions/checkout@v4 - - name: build eCLM - run: | - # User-specific variables - ls -al - BUILD_DIR="bld" - INSTALL_DIR="eclm" - - # Run cmake - cmake -S src -B "$BUILD_DIR" \ - -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \ - -DCMAKE_C_COMPILER=mpicc \ - -DCMAKE_Fortran_COMPILER=mpifort + cmake -S src -B $BUILD_DIR \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_C_COMPILER=$CC \ + -DCMAKE_Fortran_COMPILER=$FC - cd bld - make -j${nproc} + - name: Build eCLM + run: cmake --build $BUILD_DIR - ls -al - ls -al eclm - # - name: Cache inputdata - # if: ${{ ! env.ACT }} - # uses: actions/cache@v3 - # with: - # path: $HOME/cesm/inputdata - # key: inputdata + - name: Install eCLM + run: cmake --install $BUILD_DIR -# the following can be used by developers to login to the github server in case of errors -# see https://github.com/marketplace/actions/debugging-with-tmate for further details -# - name: Setup tmate session -# if: ${{ failure() }} -# uses: mxschmitt/action-tmate@v3 + - name: Install eCLM namelist generator + run: pip3 install --user ./namelist_generator diff --git a/cmake/SetBuildOptions.cmake b/cmake/SetBuildOptions.cmake index 78beaecd35..57b89c093c 100644 --- a/cmake/SetBuildOptions.cmake +++ b/cmake/SetBuildOptions.cmake @@ -29,7 +29,7 @@ if(COMPILER STREQUAL "GNU") set(CMAKE_Fortran_FLAGS "-fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none -ffree-form -fopenmp -fallow-argument-mismatch") set(CMAKE_Fortran_FLAGS_DEBUG "-g -Wall -Og -fbacktrace -ffpe-trap=zero,overflow -fcheck=bounds") set(CMAKE_Fortran_FLAGS_RELEASE "-O") -elseif(COMPILER STREQUAL "Intel") +elseif(COMPILER STREQUAL "Intel" OR COMPILER STREQUAL "IntelLLVM") add_compile_definitions(CPRINTEL) set(CMAKE_C_FLAGS "-qno-opt-dynamic-align -std=gnu99 -fp-model precise -qopenmp") set(CMAKE_C_FLAGS_DEBUG "-O0 -g")