Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CircleCI to use both gfortran and ifort #831

Merged
merged 25 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c642a89
Update CircleCI to use both gfortran and ifort
mathomp4 May 7, 2021
8b89f5c
Try to fix matrix
mathomp4 May 7, 2021
6773102
Okay. config validated
mathomp4 May 10, 2021
1c83d90
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 May 10, 2021
037f6b0
Sigh. Just MAPL testing
mathomp4 May 10, 2021
a5b370c
Can't use oversubscribe with intel mpi
mathomp4 May 10, 2021
247fc9d
Now reenable the GCM
mathomp4 May 10, 2021
c947e68
Allow for /proc/meminfo to be unreadable
mathomp4 May 10, 2021
812040a
Allow for /proc/meminfo to be unreadable. Part 2
mathomp4 May 10, 2021
23bbfb8
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 May 11, 2021
a1dd263
Update CHANGELOG
mathomp4 May 11, 2021
50229c9
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 May 11, 2021
aa3911e
Try out large resource_class
mathomp4 May 11, 2021
b2970b0
Don't persist if not running FV3
mathomp4 May 12, 2021
761b443
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 May 12, 2021
e27ce53
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 Jun 8, 2021
3db61b3
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 Jun 23, 2021
622a7c6
Update config.yml
mathomp4 Jun 23, 2021
1d4de3b
Merge branch 'develop' into feature/mathomp4/enable-all-ifort-mapl
mathomp4 Jul 6, 2021
66e3d65
Update CHANGELOG.md
mathomp4 Jul 6, 2021
92b391a
Try compiling GEOSadas with Intel
mathomp4 Jul 6, 2021
de655b3
Use env and cmake develop
mathomp4 Jul 6, 2021
c11cca4
GEOSadas too far behind. Soon though
mathomp4 Jul 6, 2021
90df16d
Try out FV3 on both GNU and Intel for cost estimate
mathomp4 Jul 7, 2021
d3b8e5a
Turn off FV3. Not crucial.
mathomp4 Jul 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 147 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

executors:
gcc-build-env:
gfortran:
docker:
- image: gmao/ubuntu20-geos-env-mkl:v6.2.4-openmpi_4.0.5-gcc_10.3.0
auth:
Expand All @@ -11,40 +11,79 @@ executors:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none
MPIEXEC_PREFLAGS: --oversubscribe
resource_class: large
#MEDIUM# resource_class: medium

ifort:
docker:
- image: gmao/ubuntu20-geos-env:v6.2.4-intelmpi_2021.2.0-intel_2021.2.0
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_AUTH_TOKEN
resource_class: large
#MEDIUM# resource_class: medium

workflows:
version: 2.1
build-and-test:
jobs:
- build-and-test-MAPL:
name: build-and-test-MAPL-on-<< matrix.compiler >>
matrix:
parameters:
compiler: [gfortran, ifort]
context:
- docker-hub-creds
- build-GEOSgcm:
name: build-GEOSgcm-on-<< matrix.compiler >>
matrix:
parameters:
compiler: [gfortran, ifort]
context:
- docker-hub-creds
- make-FV3-experiment:
context:
- docker-hub-creds
requires:
- build-GEOSgcm
- run-FV3-standalone:
context:
- docker-hub-creds
requires:
- make-FV3-experiment
###################################################
# - make-FV3-exp: #
# name: make-FV3-exp-on-<< matrix.compiler >> #
# matrix: #
# parameters: #
# compiler: [gfortran, ifort] #
# context: #
# - docker-hub-creds #
# requires: #
# - build-GEOSgcm-on-<< matrix.compiler >> #
# - run-FV3: #
# name: run-FV3-on-<< matrix.compiler >> #
# matrix: #
# parameters: #
# compiler: [gfortran, ifort] #
# context: #
# - docker-hub-creds #
# requires: #
# - make-FV3-exp-on-<< matrix.compiler >> #
###################################################
#####################################################
# - build-GEOSadas: #
# name: build-GEOSadas-on-<< matrix.compiler >> #
# matrix: #
# parameters: #
# compiler: [ifort] #
# context: #
# - docker-hub-creds #
#####################################################

jobs:
build-and-test-MAPL:
executor: gcc-build-env
parameters:
compiler:
type: string
executor: << parameters.compiler >>
working_directory: /root/project
steps:
- checkout:
path: MAPL
- run:
name: "Versions etc"
command: mpirun --version && gfortran --version && echo $BASEDIR && pwd && ls && echo "$(nproc)"
command: mpirun --version && << parameters.compiler >> --version && echo $BASEDIR && pwd && ls && echo "$(nproc)"
- run:
name: "Mepo clone external repos"
command: |
Expand All @@ -54,27 +93,33 @@ jobs:
- run:
name: "CMake"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/MAPL
mkdir build
cd build
cmake .. -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS='--oversubscribe'
mkdir -p ${CIRCLE_WORKING_DIRECTORY}/build-MAPL
cd ${CIRCLE_WORKING_DIRECTORY}/build-MAPL
cmake ${CIRCLE_WORKING_DIRECTORY}/MAPL -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF -DMPIEXEC_PREFLAGS=${MPIEXEC_PREFLAGS} -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/install-MAPL
- run:
name: "Build and install"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/MAPL/build
cd ${CIRCLE_WORKING_DIRECTORY}/build-MAPL
make -j"$(nproc)" install
#MEDIUM# make -j4 install
- run:
name: "Run MAPL Unit Tests"
name: "Build MAPL Unit Tests"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/MAPL/build
cd ${CIRCLE_WORKING_DIRECTORY}/build-MAPL
make -j"$(nproc)" build-tests
#MEDIUM# make -j4 build-tests
- run:
name: "Run MAPL Unit Tests"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/build-MAPL
# skip Performance tests (maybe doable on CircleCI?)
ctest -R MAPL -LE PERFORMANCE --output-on-failure

build-GEOSgcm:
executor: gcc-build-env
parameters:
compiler:
type: string
executor: << parameters.compiler >>
working_directory: /root/project
steps:
- run:
Expand All @@ -87,7 +132,7 @@ jobs:
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSgcm
mepo clone
mepo develop GEOSgcm_GridComp GEOSgcm_App
mepo develop GEOSgcm_GridComp GEOSgcm_App GMAO_Shared
mepo status
- run:
name: "Mepo checkout MAPL branch"
Expand Down Expand Up @@ -117,24 +162,87 @@ jobs:
name: "CMake"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSgcm
mkdir build
cd build
cmake .. -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-GEOSgcm -DUSE_F2PY=OFF
mkdir -p ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSgcm
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSgcm
cmake ${CIRCLE_WORKING_DIRECTORY}/GEOSgcm -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-GEOSgcm -DUSE_F2PY=OFF
- run:
name: "Build and install"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSgcm/build
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSgcm
make -j"$(nproc)" install
#MEDIUM# make -j4 install

# We need to persist the install for the next step
- persist_to_workspace:
root: workspace
paths:
- install-GEOSgcm
######################################################
# # We need to persist the install for the next step #
# # but only if we are running FV3 tests #
# - persist_to_workspace: #
# root: workspace #
# paths: #
# - install-GEOSgcm #
######################################################

build-GEOSadas:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
working_directory: /root/project
steps:
- run:
name: "Checkout GEOSadas fixture"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}
git clone https://github.com/GEOS-ESM/GEOSadas.git
- run:
name: "Mepo clone external repos"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSadas
mepo clone
mepo develop GEOSgcm_GridComp GEOSgcm_App GMAO_Shared
mepo status
- run:
name: "Mepo checkout MAPL branch"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSadas/src/Shared/@MAPL

# Based a bit on: https://stackoverflow.com/a/55940371/1876449
#
# CIRCLE_PR_NUMBER is only available on forked PRs:
#
# https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
#
# so if it exists we fetch the PR's branch. This fetch was
# figured out by looking at the MAPL build-and-test above
# which did work!
if [ ! -z "${CIRCLE_PR_NUMBER}" ]; then
git fetch --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
fi

mepo checkout ${CIRCLE_BRANCH} MAPL
if [ "${CIRCLE_BRANCH}" != "develop" ] && [ "${CIRCLE_BRANCH}" != "main" ]
then
mepo checkout-if-exists ${CIRCLE_BRANCH}
fi
mepo status
- run:
name: "CMake"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSadas
mkdir -p ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSadas
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSadas
cmake ${CIRCLE_WORKING_DIRECTORY}/GEOSadas -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-GEOSadas -DUSE_F2PY=OFF
- run:
name: "Build and install"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSadas
make -j"$(nproc)" install
#MEDIUM# make -j4 install

make-FV3-experiment:
executor: gcc-build-env
make-FV3-exp:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
working_directory: /root/project
steps:
- attach_workspace:
Expand Down Expand Up @@ -175,8 +283,11 @@ jobs:
paths:
- test-fv3-c12

run-FV3-standalone:
executor: gcc-build-env
run-FV3:
parameters:
compiler:
type: string
executor: << parameters.compiler >>
working_directory: /root/project
steps:
- attach_workspace:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
"harmless" warnings/errors in the ESMF log.
- Update CMake to exclusively use GFE Namespace. This means that when building MAPL, users should use the latest versions of GFE libraries (gFTL, gFTL-Shared, pFlogger, fArgParse, yaFyaml, pFUnit)
- Update ESMA_cmake to v3.5.1 (macOS fix)
- Updated the CI to do both GNU and Intel builds of MAPL and GEOSgcm. (Note that for now the GEOSfvdycore build is turned off due to cost of CI)

### Fixed

Expand Down
28 changes: 26 additions & 2 deletions base/MAPL_MemUtils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,19 @@ subroutine MAPL_MemUsed ( memtotal, used, percent_used, RC )

call get_unit(mem_unit)
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',IOSTAT=STATUS)
_VERIFY(STATUS)
!_VERIFY(STATUS)

! Note: On at least one CircleCI compute machine, this was returning IOSTAT=9, with an IOMSG of:
! permission to access file denied, unit 100, file /proc/meminfo
! So, instead, if we get this issue, just act like macOS and not return useful info rather
! than crashing the model
if (STATUS /= 0) then
memtotal = 0.0
used = 0.0
percent_used = 0.0
RETURN_(ESMF_SUCCESS)
end if

do
read (mem_unit,'(a)', end=20) string
if ( index ( string, 'MemTotal:' ) == 1 ) then ! High Water Mark
Expand Down Expand Up @@ -538,7 +550,19 @@ subroutine MAPL_MemCommited ( memtotal, committed_as, percent_committed, RC )

call get_unit(mem_unit)
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',IOSTAT=STATUS)
_VERIFY(STATUS)
!_VERIFY(STATUS)

! Note: On at least one CircleCI compute machine, this was returning IOSTAT=9, with an IOMSG of:
! permission to access file denied, unit 100, file /proc/meminfo
! So, instead, if we get this issue, just act like macOS and not return useful info rather
! than crashing the model
if (STATUS /= 0) then
memtotal = 0.0
committed_as = 0.0
percent_committed = 0.0
RETURN_(ESMF_SUCCESS)
end if

do; read (mem_unit,'(a)', end=20) string
if ( INDEX ( string, 'MemTotal:' ) == 1 ) then ! High Water Mark
read (string(10:LEN_TRIM(string)-2),*) memtotal
Expand Down