Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
build:
needs: generate-matrix
strategy:
fail-fast: false
matrix:
dockerfile: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
runs-on: ubuntu-latest
Expand Down
96 changes: 96 additions & 0 deletions fesom2_ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# FESOM2 CI build-test image
#
# Provides the toolchain used by FESOM/fesom2's build-test workflow:
# - GCC + OpenMPI + NetCDF/HDF5 + LAPACK
# - OASIS3-MCT prebuilt at /oasis (CMake build)
# - XIOS 2.5 prebuilt at /xios (make_xios with arch-GCC_LINUX, sequential netcdf)
#
# Source for OASIS and XIOS lives next to this Dockerfile (./oasis/ and ./xios/),
# committed to FESOM/FESOM2_Docker so the docker build doesn't depend on
# gitlab.dkrz.de being reachable from GHA runners (it isn't).
#
# Built and published by .github/workflows/docker-publish.yml in this repo to
# ghcr.io/fesom/fesom2_docker:fesom2_ci-<version>. FESOM/fesom2's
# fesom2_build_tests.yml runs inside this image and copies /oasis and /xios
# into the workspace before configuring CMake.

FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

RUN apt-get update && apt-get install -y \
build-essential \
cmake \
make \
git \
wget \
curl \
gfortran \
gcc \
g++ \
libopenmpi-dev \
openmpi-bin \
libnetcdf-dev \
libnetcdf-mpi-dev \
libnetcdff-dev \
libhdf5-dev \
libhdf5-openmpi-dev \
libhdf5-fortran-102 \
libhdf5-openmpi-fortran-102 \
liblapack-dev \
libblas-dev \
libopenblas-dev \
pkg-config \
perl \
uuid-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
ENV FC=mpifort
ENV CC=mpicc
ENV CXX=mpicxx
ENV LAPACK_LIBRARIES=/usr/lib/x86_64-linux-gnu/liblapack.so.3
ENV CMAKE_ARGS=-DLAPACK_LIBRARIES=/usr/lib/x86_64-linux-gnu/liblapack.so.3
ENV FESOM_PLATFORM_STRATEGY=ubuntu

# OASIS3-MCT: copy source + CMake build to /oasis. The fesom2 workflow then
# does `cp -rf /oasis ../` and FESOM's FindOASIS.cmake picks it up.
COPY oasis /oasis
RUN cd /oasis \
&& mkdir -p build \
&& cd build \
&& cmake ../ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
&& make -j$(nproc)

# XIOS 2.5: copy source + make_xios build to /xios. Sequential NetCDF is
# sufficient for a build/link test of FESOM's __XIOS code path (CI doesn't
# run XIOS). FCM_NEW is used (FCM_OLD removed to keep the source commit
# small); extern/boost and extern/blitz are kept bundled because XIOS's
# bld.cfg has hardcoded -I${PWD}/extern/{boost,blitz}/include paths that
# --use_extern_boost/blitz don't rewrite.
#
# Two arch-GCC_LINUX overrides:
# - .env: upstream hardcodes $HOME/hdf5 and $HOME/netcdf4; rewrite to Ubuntu
# serial library paths so make_xios's `source arch.env` gives valid roots.
# - .fcm: upstream BASE_CFLAGS sets -ansi (= C++98) which forbids C++11
# lambdas as template args. XIOS 2.5 uses those (e.g. distribute_file_server2.cpp).
# Append -std=c++11 to override -ansi for C++ compilation.
# arch-GCC_LINUX.path is left untouched — it already references the env vars
# sourced from .env.
COPY xios /xios
RUN printf '%s\n' \
'export HDF5_INC_DIR=/usr/include/hdf5/serial' \
'export HDF5_LIB_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial' \
'export NETCDF_INC_DIR=/usr/include' \
'export NETCDF_LIB_DIR=/usr/lib/x86_64-linux-gnu' \
> /xios/arch/arch-GCC_LINUX.env \
&& sed -i 's|^%BASE_CFLAGS .*|%BASE_CFLAGS -ansi -w -fPIC -std=c++11|' \
/xios/arch/arch-GCC_LINUX.fcm \
&& cd /xios \
&& ./make_xios --arch GCC_LINUX --fcm new \
--netcdf_lib netcdf4_seq --job $(nproc)

WORKDIR /
16 changes: 16 additions & 0 deletions fesom2_ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# fesom2_ci

CI build-test image for [FESOM/fesom2](https://github.com/FESOM/fesom2). Provides:

- Ubuntu 22.04 base
- GCC, OpenMPI, NetCDF, HDF5, LAPACK
- OASIS3-MCT prebuilt at `/oasis` (CMake, position-independent)
- XIOS 2.5 prebuilt at `/xios` (`make_xios --arch GCC_LINUX --netcdf_lib netcdf4_seq`)

Published by this repo's `docker-publish.yml` to
`ghcr.io/fesom/fesom2_docker:fesom2_ci-<version>`.

FESOM/fesom2's `.github/workflows/fesom2_build_tests.yml` runs inside this image and
copies `/oasis` and `/xios` into the workspace before configuring CMake. XIOS is
built with sequential NetCDF since CI only build-and-link-tests the XIOS path; it
does not run XIOS at runtime.
27 changes: 27 additions & 0 deletions fesom2_ci/oasis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
util/make_dir/COMP.err
util/make_dir/COMP.log
util/make_dir/COMP-shared.err
util/make_dir/COMP-shared.log
util/make_dir/COMP-pyoasis.err
util/make_dir/COMP-pyoasis.log
*.o
*.mod
*~
examples/test_interpolation/model1
examples/test_interpolation/model2
examples/test_interpolation/test_interpolation_*
doc/*.aux
doc/*.cb
doc/*.cb2
doc/*.idx
doc/*.log
doc/*.toc
arch_ecearth
util/make_dir/make.ece.inc


build/
lib/libmct.a
lib/libmpeu.a
lib/libpsmile.a
lib/libscrip.a
11 changes: 11 additions & 0 deletions fesom2_ci/oasis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.4)

# set default build type cache entry (do so before project(...) is called, which would create this cache entry on its own)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "setting default build type: Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
endif()

project(oasis3-mct)

add_subdirectory(lib/psmile)
106 changes: 106 additions & 0 deletions fesom2_ci/oasis/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
OASIS3-MCT license and copyright statement
------------------------------------------

Copyright © 2021 Centre Européen de Recherche et Formation
Avancée en Calcul Scientifique (CERFACS).

This software and ancillary information called OASIS3-MCT is free
software. CERFACS has rights to use, reproduce, and distribute
OASIS3-MCT. The public may copy, distribute, use, prepare derivative works
and publicly display OASIS3-MCT under the terms of the Lesser GNU General
Public License (LGPL) as published by the Free Software Foundation,
provided that this notice and any statement of authorship are
reproduced on all copies. If OASIS3-MCT is modified to produce derivative
works, such modified software should be clearly marked, so as not to
confuse it with the OASIS3-MCT version available from CERFACS.

The developers of the OASIS3-MCT software are researchers attempting to
build a modular and user-friendly coupler accessible to the climate
modelling community. Although we use the tool ourselves and have made
every effort to ensure its accuracy, we can not make any
guarantees. We provide the software to you for free. In return,
you - the user - assume full responsibility for use of the software. The
OASIS3-MCT software comes without any warranties (implied or expressed)
and is not guaranteed to work for you or on your computer. Specifically,
CERFACS and the various individuals involved in development and
maintenance of the OASIS3-MCT software are not responsible for any damage
that may result from correct or incorrect use of this software.

============================================================================

MCT copyright statement
-----------------------

Modeling Coupling Toolkit (MCT) Software

Copyright © 2021, UChicago Argonne, LLC as Operator of Argonne
National Laboratory. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment: "This product includes
software developed by the UChicago Argonne, LLC, as Operator of
Argonne National Laboratory." Alternately, this acknowledgment may
appear in the software itself, if and wherever such third-party
acknowledgments normally appear.
This software was authored by:
* Argonne National Laboratory Climate Modeling Group,
Mathematics and Computer Science Division,
Argonne National Laboratory
Argonne IL 60439
* Robert Jacob, tel: (630) 252-2983
E-mail: jacob@mcs.anl.gov
* Jay Larson
E-mail: larson@mcs.anl.gov
* Everest Ong
* Ray Loy
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT
WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE UNITED STATES, THE
UNITED STATES DEPARTMENT OF ENERGY, AND THEIR EMPLOYEES: (1) DISCLAIM
ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, TITLE OR NON-IN- FRINGEMENT, (2) DO NOT ASSUME ANY LEGAL
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE
SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT
THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE
OR THAT ANY ERRORS WILL BE CORRECTED.
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDER, THE
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, OR THEIR
EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL,
SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING BUT NOT
LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER,
WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY
OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR
DAMAGES.

============================================================================

The SCRIP 1.4 license copyright statement
-----------------------------------------

The SCRIP 1.4 copyright statement reads as follows:
"Copyright © 1997, 1998 the Regents of the University of California.
This software and ancillary information (herein called SOFTWARE)
called SCRIP is made available under the terms described here. The
SOFTWARE has been approved for release with associated LA-CC Number
98-45. Unless otherwise indicated, this SOFTWARE has been authored by
an employee or employees of the University of California, operator of
Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
the United States Department of Energy. The United States Government
has rights to use, reproduce, and distribute this SOFTWARE. The public
may copy, distribute, prepare derivative works and publicly display
this SOFTWARE without charge, provided that this Notice and any
statement of authorship are reproduced on all copies. Neither the
Government nor the University makes any warranty, express or implied,
or assumes any liability or responsibility for the use of this
SOFTWARE. If SOFTWARE is modified to produce derivative works, such
modified SOFTWARE should be clearly marked, so as not to confuse it
with the version available from Los Alamos National Laboratory."
17 changes: 17 additions & 0 deletions fesom2_ci/oasis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This is the branch of the OASIS3-MCT climate coupler currently recommended for users. It corresponds to the official OASIS3-MCT_5.0 released in December 2022 + important bugfixes since then.

Developments for the future OASIS3-MCT_6.0 will be done in other branches and then merged to the master branch.

For changes between the different versions of OASIS3-MCT, please refer to Appendix B of the User Guide (in oasis3-mct/doc/oasis3mct_UserGuide.pdf).

Please keep us informed of your progress with OASIS3-MCT and do not forget to cite the following latest reference in your paper describing your coupled model results.::
A. Craig, S. Valcke, L. Coquart, 2017: Development and performance of a new version of the OASIS coupler, OASIS3-MCT_3.0, Geosci. Model Dev., 10, 3297-3308,https://doi.org/10.5194/gmd-10-3297-2017, 2017.

If you have problems or questions, please check the forum on the OASIS3-MCT web site (https://www.cerfacs.fr/site-oasis/forum/oa_main.php) or contact us at oasishelp@cerfacs.fr .

Bugfixes since OASIS3-MCT_5.0 official release:

- 31/10/2022: Add support for multiple grids per partition
- 01/06/2022: Bugfix for load balacing analysis freezing when all processes are not involved in the coupling observed and solved by Eric
- 01/06/2022: Fix use of uninitialized rglo for mask in grid writing.
- 01/06/2022: Add oasis_def_var interface with 2d id_var_shape. id_var_shape is not used anymore, but we provide an interface with a 1d and 2d argument for backwards compatibility.
61 changes: 61 additions & 0 deletions fesom2_ci/oasis/cmake/FindBLAS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@



# BLAS_<lang>_FOUND
# BLAS_<lang>_LIBRARIES
# BLAS_<lang>_COMPILER_WRAPPER


if(CMAKE_C_COMPILER_LOADED)
#check_function_exists(cblas_sgemm SGEMM_C_FOUND) # this is also found if it is in the standard library paths, so we can not be sure we already have it in the wrapper

include(CheckCSourceCompiles)
set(CMAKE_REQUIRED_FLAGS -c)
check_c_source_compiles([[
#include <cblas.h>
typedef void (*foo)(const enum CBLAS_ORDER, const enum CBLAS_TRANSPOSE,
const enum CBLAS_TRANSPOSE, const int, const int,
const int, const float, const float *,
const int, const float *, const int,
const float, float *, const int);
foo func = &cblas_sgemm;
]] BLAS_C_COMPILER_WRAPPER)

if(NOT BLAS_C_COMPILER_WRAPPER)
# try to locate BLAS via the find module shipped with cmake
# the module does not search for C based blas if the Fortran language is enabled
include(${CMAKE_ROOT}/Modules/FindBLAS.cmake)
set(BLAS_C_LIBRARIES ${BLAS_LIBRARIES})
# unset the results from the original FindBlas.cmake
unset(BLAS_FOUND)
unset(BLAS_LIBRARIES)
else()
set(BLAS_C_LIBRARIES "") # we do not want to explicitly add libraries as the wrapper will do it
set(BLAS_C_FOUND TRUE)
endif()

if(BLAS_C_LIBRARIES)
set(BLAS_C_FOUND TRUE)
endif()
endif()


# include(${CMAKE_ROOT}/Modules/FindBLAS.cmake)
# This module sets the following variables:
#
# ::
#
# BLAS_FOUND - set to true if a library implementing the BLAS interface
# is found
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L).
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
# link against to use BLAS
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
# is found
# BLA_STATIC if set on this determines what kind of linkage we do (static)
# BLA_VENDOR if set checks only the specified vendor, if not set checks
# all the possibilities
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
15 changes: 15 additions & 0 deletions fesom2_ci/oasis/cmake/FindHDF5.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# HDF5_C_INCLUDE_DIRECTORIES
# HDF5_C_LIBRARIES


if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
include(CheckFunctionExists)
check_function_exists(H5get_libversion HAVE_C_HDF5)
if(HAVE_C_HDF5)
set(HDF5_C_INCLUDE_DIRECTORIES "")
set(HDF5_C_LIBRARIES "")
else()
find_path(HDF5_C_INCLUDE_DIRECTORIES hdf5.h HINTS $ENV{HDF5_DIR}/include ENV HDF5_C_INCLUDE_DIRECTORIES)
find_library(HDF5_C_LIBRARIES hdf5 HINTS ${HDF5_C_INCLUDE_DIRECTORIES}/../lib)
endif()
endif()
Loading
Loading