Skip to content

Commit 173ef29

Browse files
authored
v3: Reduce CircleCI usage (#4878)
* v3: Reduce CircleCI usage * Fix circleci * Open /proc/meminfo as readonly
1 parent bbb6ad1 commit 173ef29

5 files changed

Lines changed: 117 additions & 99 deletions

File tree

.circleci/config.yml

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -24,67 +24,52 @@ orbs:
2424
ci: geos-esm/circleci-tools@4
2525

2626
workflows:
27-
build-and-test-MAPL:
28-
jobs:
29-
# Builds MAPL in a "default" way
30-
- ci/build:
31-
name: build-and-test-MAPL-as-<< matrix.build_type >>-on-<< matrix.compiler >>-using-<< matrix.cmake_generator >>
32-
context:
33-
- docker-hub-creds
34-
matrix:
35-
parameters:
36-
compiler: [gfortran, ifort, ifx]
37-
cmake_generator: ['Unix Makefiles']
38-
build_type: ['Debug']
39-
baselibs_version: *baselibs_version
40-
repo: MAPL
41-
mepodevelop: false
42-
run_unit_tests: true
43-
ctest_options: "-L 'ESSENTIAL' --output-on-failure"
44-
persist_workspace: false # Needed for MAPL tutorials
45-
46-
# Tutorials have been removed (for now) from MAPL3
47-
# NOTE: When we restore tutorials, change persist_workspace to true above!!!
48-
###################################################################################################################
49-
# # Run MAPL Tutorials #
50-
# - ci/run_mapl_tutorial: #
51-
# name: run-<< matrix.tutorial_name >>-Tutorial-with-<< matrix.compiler >>-built-with-<< matrix.build_type >> #
52-
# context: #
53-
# - docker-hub-creds #
54-
# matrix: #
55-
# parameters: #
56-
# compiler: [ifort] #
57-
# build_type: ['Debug'] #
58-
# tutorial_name: #
59-
# - hello_world #
60-
# - parent_no_children #
61-
# - parent_one_child_import_via_extdata #
62-
# - parent_one_child_no_imports #
63-
# - parent_two_siblings_connect_import_export #
64-
# # We will only run the tutorials with GNU make. No need to double up as Ninja is a build test only #
65-
# requires: #
66-
# - build-and-test-MAPL-as-<< matrix.build_type >>-on-<< matrix.compiler >>-using-Unix Makefiles #
67-
# baselibs_version: *baselibs_version #
68-
###################################################################################################################
69-
70-
# Builds MAPL without pFlogger and fargparse and pFUnit
71-
- ci/build:
72-
name: build-MAPL-without-pFlogger-and-fArgParse-and-pFUnit-as-<< matrix.build_type >>-on-<< matrix.compiler >>
73-
context:
74-
- docker-hub-creds
75-
matrix:
76-
parameters:
77-
compiler: [ifort]
78-
build_type: ['Debug']
79-
baselibs_version: *baselibs_version
80-
repo: MAPL
81-
mepodevelop: false
82-
remove_flap: true
83-
remove_pflogger: true
84-
remove_pfunit: true
85-
extra_cmake_options: "-DBUILD_WITH_PFLOGGER=OFF -DBUILD_WITH_FARGPARSE=OFF"
86-
run_unit_tests: true
87-
ctest_options: "-L 'ESSENTIAL' --output-on-failure"
27+
############################################################################################################################
28+
# build-and-test-MAPL: #
29+
# jobs: #
30+
# # For now, we do MAPL builds in GitHub only #
31+
# # Builds MAPL in a "default" way #
32+
# - ci/build: #
33+
# name: build-and-test-MAPL-as-<< matrix.build_type >>-on-<< matrix.compiler >>-using-<< matrix.cmake_generator >> #
34+
# context: #
35+
# - docker-hub-creds #
36+
# matrix: #
37+
# parameters: #
38+
# compiler: [gfortran, ifort, ifx] #
39+
# cmake_generator: ['Unix Makefiles'] #
40+
# build_type: ['Debug'] #
41+
# baselibs_version: *baselibs_version #
42+
# repo: MAPL #
43+
# mepodevelop: false #
44+
# run_unit_tests: true #
45+
# ctest_options: "-L 'ESSENTIAL' --output-on-failure" #
46+
# persist_workspace: false # Needed for MAPL tutorials #
47+
# #
48+
# # Tutorials have been removed (for now) from MAPL3 #
49+
# # NOTE: When we restore tutorials, change persist_workspace to true above!!! #
50+
# ################################################################################################################### #
51+
# # # Run MAPL Tutorials # #
52+
# # - ci/run_mapl_tutorial: # #
53+
# # name: run-<< matrix.tutorial_name >>-Tutorial-with-<< matrix.compiler >>-built-with-<< matrix.build_type >> # #
54+
# # context: # #
55+
# # - docker-hub-creds # #
56+
# # matrix: # #
57+
# # parameters: # #
58+
# # compiler: [ifort] # #
59+
# # build_type: ['Debug'] # #
60+
# # tutorial_name: # #
61+
# # - hello_world # #
62+
# # - parent_no_children # #
63+
# # - parent_one_child_import_via_extdata # #
64+
# # - parent_one_child_no_imports # #
65+
# # - parent_two_siblings_connect_import_export # #
66+
# # # We will only run the tutorials with GNU make. No need to double up as Ninja is a build test only # #
67+
# # requires: # #
68+
# # - build-and-test-MAPL-as-<< matrix.build_type >>-on-<< matrix.compiler >>-using-Unix Makefiles # #
69+
# # baselibs_version: *baselibs_version # #
70+
# ################################################################################################################### #
71+
# #
72+
############################################################################################################################
8873

8974
# MAPL3 will soon break GEOSgcm builds. We believe it can build, but not currently run
9075
#build-and-run-GEOSgcm:
@@ -97,7 +82,9 @@ workflows:
9782
- docker-hub-creds
9883
matrix:
9984
parameters:
100-
compiler: [gfortran, ifort, ifx]
85+
# To save CircleCI resources, we build only with ifx for now
86+
#compiler: [gfortran, ifort, ifx]
87+
compiler: [ifx]
10188
baselibs_version: *baselibs_version
10289
repo: GEOSgcm
10390
checkout_fixture: true
@@ -148,7 +135,9 @@ workflows:
148135
- docker-hub-creds
149136
matrix:
150137
parameters:
151-
compiler: [gfortran, ifort, ifx]
138+
# To save CircleCI resources, we run GOCART tests only with ifx for now
139+
#compiler: [gfortran, ifort, ifx]
140+
compiler: [ifx]
152141
requires:
153142
- build-GEOSgcm-on-<< matrix.compiler >>
154143
repo: GEOSgcm

.github/actions/ci-build-and-test-mapl/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ inputs:
1515
extra-cmake-args:
1616
description: "Extra CMake arguments"
1717
required: false
18+
skip-tests:
19+
description: "Skip running tests (useful when test frameworks are disabled)"
20+
required: false
21+
default: "false"
1822

1923
runs:
2024
using: "composite"
@@ -55,6 +59,7 @@ runs:
5559
cmake --install build
5660
5761
- name: Run MAPL Tests
62+
if: inputs.skip-tests != 'true'
5863
shell: bash
5964
run: |
6065
cmake --build build --target build-tests --parallel 4

.github/workflows/workflow.yml

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,37 @@ jobs:
4141
doc-folder: docs/Ford/ci-doc
4242
deploy-token: ${{ secrets.DOCS_DEPLOY_PAT }}
4343

44-
build_test_mapl_gnu:
45-
name: gfortran / ${{ matrix.cmake-build-type }} / ${{ matrix.cmake-generator }}
46-
if: github.event.pull_request.draft == false
47-
runs-on: ubuntu-latest
48-
container:
49-
image: gmao/ubuntu24-geos-env-mkl:v8.27.0-openmpi_5.0.5-gcc_14.2.0
50-
strategy:
51-
fail-fast: false
52-
matrix:
53-
cmake-build-type: [Debug, Release]
54-
cmake-generator: [Unix Makefiles]
55-
env:
56-
OMPI_ALLOW_RUN_AS_ROOT: 1
57-
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
58-
OMPI_MCA_btl_vader_single_copy_mechanism: none
59-
steps:
60-
- name: Checkout
61-
uses: actions/checkout@v6
62-
with:
63-
fetch-depth: 1
64-
filter: blob:none
65-
66-
- name: Build and Test MAPL
67-
uses: ./.github/actions/ci-build-and-test-mapl
68-
with:
69-
cmake-build-type: ${{ matrix.cmake-build-type }}
70-
cmake-generator: ${{ matrix.cmake-generator }}
71-
fortran-compiler: gfortran
72-
extra-cmake-args: -DMPIEXEC_PREFLAGS='--oversubscribe'
44+
#####################################################################################
45+
# build_test_mapl_gnu: #
46+
# name: gfortran / ${{ matrix.cmake-build-type }} / ${{ matrix.cmake-generator }} #
47+
# if: github.event.pull_request.draft == false #
48+
# runs-on: ubuntu-latest #
49+
# container: #
50+
# image: gmao/ubuntu24-geos-env-mkl:v8.27.0-openmpi_5.0.5-gcc_14.2.0 #
51+
# strategy: #
52+
# fail-fast: false #
53+
# matrix: #
54+
# cmake-build-type: [Debug, Release] #
55+
# cmake-generator: [Unix Makefiles] #
56+
# env: #
57+
# OMPI_ALLOW_RUN_AS_ROOT: 1 #
58+
# OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 #
59+
# OMPI_MCA_btl_vader_single_copy_mechanism: none #
60+
# steps: #
61+
# - name: Checkout #
62+
# uses: actions/checkout@v6 #
63+
# with: #
64+
# fetch-depth: 1 #
65+
# filter: blob:none #
66+
# #
67+
# - name: Build and Test MAPL #
68+
# uses: ./.github/actions/ci-build-and-test-mapl #
69+
# with: #
70+
# cmake-build-type: ${{ matrix.cmake-build-type }} #
71+
# cmake-generator: ${{ matrix.cmake-generator }} #
72+
# fortran-compiler: gfortran #
73+
# extra-cmake-args: -DMPIEXEC_PREFLAGS='--oversubscribe' #
74+
#####################################################################################
7375

7476
build_test_mapl_gnu15:
7577
name: gfortran-15 / ${{ matrix.cmake-build-type }} / ${{ matrix.cmake-generator }}
@@ -151,6 +153,28 @@ jobs:
151153
cmake-generator: ${{ matrix.cmake-generator }}
152154
fortran-compiler: ifx
153155

156+
build_test_mapl_ifort_no_optional:
157+
name: ifort / Debug / no pFlogger+fArgParse+pFUnit
158+
if: github.event.pull_request.draft == false
159+
runs-on: ubuntu-latest
160+
container:
161+
image: gmao/ubuntu24-geos-env:v8.27.0-intelmpi_2021.13-ifort_2021.13
162+
steps:
163+
- name: Checkout
164+
uses: actions/checkout@v6
165+
with:
166+
fetch-depth: 1
167+
filter: blob:none
168+
169+
- name: Build MAPL without optional packages
170+
uses: ./.github/actions/ci-build-and-test-mapl
171+
with:
172+
cmake-build-type: Debug
173+
cmake-generator: Unix Makefiles
174+
fortran-compiler: ifort
175+
extra-cmake-args: -DBUILD_WITH_PFLOGGER=OFF -DBUILD_WITH_FARGPARSE=OFF -DBUILD_WITH_PFUNIT=OFF
176+
skip-tests: "true"
177+
154178
build_gcm:
155179
if: github.event.pull_request.draft == false
156180
strategy:

base3g/MemUtils.F90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ subroutine MAPL_MemUsed ( memtotal, used, percent_used, RC )
383383

384384

385385
call get_unit(mem_unit)
386-
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',IOSTAT=STATUS)
386+
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',ACTION='READ',IOSTAT=STATUS)
387387
!_VERIFY(STATUS)
388388

389389
! Note: On at least one CircleCI compute machine, this was returning IOSTAT=9, with an IOMSG of:
@@ -454,7 +454,7 @@ subroutine MAPL_MemCommited ( memtotal, committed_as, percent_committed, RC )
454454
multiplier = 1.0
455455

456456
call get_unit(mem_unit)
457-
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',IOSTAT=STATUS)
457+
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',ACTION='READ',IOSTAT=STATUS)
458458
!_VERIFY(STATUS)
459459

460460
! Note: On at least one CircleCI compute machine, this was returning IOSTAT=9, with an IOMSG of:
@@ -513,7 +513,7 @@ subroutine mem_dump ( memhwm, memrss, memused, swapused, commitlimit, committed_
513513
multiplier = 1.0
514514

515515
call get_unit(mem_unit)
516-
open(UNIT=mem_unit,FILE=proc_self,FORM='formatted',IOSTAT=STATUS)
516+
open(UNIT=mem_unit,FILE=proc_self,FORM='formatted',ACTION='READ',IOSTAT=STATUS)
517517
_VERIFY(STATUS)
518518
do; read (mem_unit,'(a)', end=10) string
519519
if ( INDEX ( string, 'VmHWM:' ) == 1 ) then ! High Water Mark
@@ -532,7 +532,7 @@ subroutine mem_dump ( memhwm, memrss, memused, swapused, commitlimit, committed_
532532
10 close(mem_unit)
533533

534534
call get_unit(mem_unit)
535-
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',IOSTAT=STATUS)
535+
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',ACTION='READ',IOSTAT=STATUS)
536536
_VERIFY(STATUS)
537537
do; read (mem_unit,'(a)', end=20) string
538538
if ( INDEX ( string, 'MemTotal:' ) == 1 ) then ! High Water Mark
@@ -604,7 +604,7 @@ subroutine MAPL_MemUtilsFree ( totmemfree, RC )
604604
multiplier = 1.0
605605

606606
call get_unit(mem_unit)
607-
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',IOSTAT=STATUS)
607+
open(UNIT=mem_unit,FILE=meminfo,FORM='formatted',ACTION='READ',IOSTAT=STATUS)
608608
_VERIFY(STATUS)
609609
do; read (mem_unit,'(a)', end=20) string
610610
if ( INDEX ( string, 'MemFree:' ) == 1 ) then ! Free memory

utilities/MemInfo.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ subroutine get_process_mem(this, comm, rc)
8686
real :: hwm, rss
8787
integer :: unit, status
8888

89-
open(newunit=unit, file=process_mem_file, form='formatted', iostat=status)
89+
open(newunit=unit, file=process_mem_file, form='formatted', action='READ', iostat=status)
9090
_VERIFY(status)
9191
do; read (unit, '(a)', end=10) line
9292
if (index(line, 'VmHWM:') == 1) then ! High Water Mark
@@ -124,7 +124,7 @@ subroutine get_system_mem(this, comm, rc)
124124
integer :: unit, status
125125

126126
! Read local memory information
127-
open(newunit=unit, file=system_mem_file, form='formatted', iostat=status)
127+
open(newunit=unit, file=system_mem_file, form='formatted', action='READ', iostat=status)
128128
_VERIFY(STATUS)
129129
do; read (unit, '(a)', end=20) line
130130
if (index(line, 'MemTotal:') == 1) then ! High Water Mark

0 commit comments

Comments
 (0)