-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# This is a CI workflow for the fv3atm project. | ||
# | ||
# This workflow builds and tests the fv3atm library using GCC, and it tests | ||
# different CMake build options. | ||
# | ||
# Alex Richert, 6 Dec 2023 | ||
|
||
name: GCC | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
GCC: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
cmake_opts: ["-D32BIT=ON", "-D32BIT=OFF"] | ||
gcc_ver: ["11"] | ||
mpi: ["mpich"] | ||
|
||
steps: | ||
|
||
- name: checkout-fv3atm | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ${{ github.workspace }}/fv3atm | ||
submodules: recursive | ||
|
||
- name: cache-spack | ||
id: cache-spack | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/spack-develop | ||
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2 | ||
|
||
# Building dependencies takes 40+ min | ||
- name: spack-install | ||
if: steps.cache-spack.outputs.cache-hit != 'true' | ||
run: | | ||
wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip | ||
unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out | ||
. ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh | ||
spack env create gcc${{ matrix.gcc_ver }} ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml | ||
spack env activate gcc${{ matrix.gcc_ver }} | ||
spack compiler find | grep gcc@${{ matrix.gcc_ver }} | ||
spack external find gmake cmake git git-lfs perl python ${{ matrix.mpi }} | ||
spack config add "packages:all:require:['%gcc@${{ matrix.gcc_ver }}']" | ||
spack config add "packages:mpi:require:'${{ matrix.mpi }}'" | ||
spack concretize |& tee ${SPACK_ENV}/log.concretize | ||
spack install -j2 --fail-fast | ||
- name: cache-save | ||
uses: actions/cache/save@v3 | ||
if: ${{ always() }} | ||
with: | ||
path: ${{ github.workspace }}/spack-develop | ||
key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-2 | ||
|
||
- name: build-fv3atm | ||
run: | | ||
. ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh | ||
spack env activate gcc${{ matrix.gcc_ver }} | ||
spack load $(spack find --format "{name}") | ||
cd ${GITHUB_WORKSPACE}/fv3atm | ||
git clone https://github.com/NOAA-EMC/CMakeModules | ||
git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo | ||
mkdir ${GITHUB_WORKSPACE}/build | ||
cd ${GITHUB_WORKSPACE}/build | ||
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} | ||
make -j2 | ||
- name: debug-artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: ccpp_prebuild_logs | ||
path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# This file is used by fv3atm's root CMakeLists.txt when BUILD_TESTING=ON. It is | ||
# used for CI runs and is based on the ufs-weather-model root CMakeLists.txt. It | ||
# cannot be built directly, and should not be used for compiling for general R&D | ||
# or operations. | ||
# | ||
# Alex Richert, 6 Dec 2023 | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules/Modules) | ||
|
||
if(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") | ||
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0.0) | ||
message(FATAL_ERROR "GNU Compiler >= 9 is required") | ||
endif() | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ggdb -fbacktrace -cpp -fcray-pointer -ffree-line-length-none -fno-range-check") | ||
|
||
if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") | ||
endif() | ||
|
||
if(NOT 32BIT) | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8") | ||
endif() | ||
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte -qno-opt-dynamic-align") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-opt-dynamic-align -sox -fp-model source") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -qoverride-limits") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fp-model consistent") | ||
set(CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal") | ||
|
||
if(NOT 32BIT) | ||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -real-size 64") | ||
endif() | ||
endif() | ||
|
||
set(32BIT OFF CACHE BOOL "Enable 32BIT (single precision arithmetic in dycore and fast physics)") | ||
set(CCPP_32BIT OFF CACHE BOOL "Enable CCPP_32BIT (single precision arithmetic in slow physics)") | ||
set(INLINE_POST ON CACHE BOOL "Enable inline post") | ||
set(MULTI_GASES OFF CACHE BOOL "Enable MULTI_GASES") | ||
set(MOVING_NEST OFF CACHE BOOL "Enable moving nest code") | ||
set(OPENMP ON CACHE BOOL "Enable OpenMP threading") | ||
set(PARALLEL_NETCDF OFF CACHE BOOL "Enable parallel NetCDF") | ||
|
||
message("32BIT ............ ${32BIT}") | ||
message("CCPP_32BIT ....... ${CCPP_32BIT}") | ||
message("INLINE_POST ...... ${INLINE_POST}") | ||
message("MULTI_GASES ...... ${MULTI_GASES}") | ||
message("MOVING_NEST ...... ${MOVING_NEST}") | ||
message("OPENMP ........... ${OPENMP}") | ||
message("PARALLEL_NETCDF .. ${PARALLEL_NETCDF}") | ||
|
||
find_package(MPI REQUIRED) | ||
if(OPENMP) | ||
find_package(OpenMP REQUIRED) | ||
endif() | ||
|
||
find_package(NetCDF 4.7.4 REQUIRED C Fortran) | ||
find_package(ESMF 8.3.0 MODULE REQUIRED) | ||
find_package(FMS 2022.04 REQUIRED COMPONENTS R4 R8) | ||
if(32BIT) | ||
add_library(fms ALIAS FMS::fms_r4) | ||
else() | ||
add_library(fms ALIAS FMS::fms_r8) | ||
endif() | ||
find_package(bacio 2.4.0 REQUIRED) | ||
find_package(sp 2.3.3 REQUIRED) | ||
find_package(w3emc 2.9.2 REQUIRED) | ||
|
||
find_package(Python 3.6 REQUIRED COMPONENTS Interpreter) | ||
|
||
add_subdirectory(stochastic_physics_repo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is used in the CI to define the libraries needed to build fv3atm. It | ||
# is used by the 'spack env create' command to generate a Spack environment. It | ||
# is generally preferred to avoid defining settings here that are not shared | ||
# across CI workflows, such as requiring the use of a specific compiler. Any | ||
# such modifications should be done in the appropriate CI workflow using the | ||
# 'spack config add' command, or with search-and-replace. | ||
# WARNING: Changing this file will automatically cause the cached Spack builds | ||
# in GitHub Actions to be regenerated, which takes a considerable amount of | ||
# time. | ||
# | ||
# Alex Richert, 6 Dec 2023 | ||
spack: | ||
specs: | ||
- w3emc@2.10.0 precision=4,d,8 | ||
- ip@develop precision=4,d,8 | ||
- sp@2.4.0 precision=4,d,8 | ||
- bacio@2.4.1 | ||
- upp@develop | ||
- esmf@8.4.2 | ||
- fms@2023.04 +gfs_phys +openmp +pic +quad_precision +deprecated_io constants=GFS precision=32,64 | ||
- netcdf-c@4.9.2 ~blosc | ||
view: false | ||
concretizer: | ||
unify: true | ||
packages: | ||
mpich: | ||
require: ['~libxml2 ~hwloc ~pci'] # minimize unneeded dependencies | ||
yaksa: | ||
buildable: false # minimize unneeded dependencies |