Commit aa72cc50 authored by Sebastian Müller's avatar Sebastian Müller 🐈
Browse files

Merge branch 'develop' into 'master'

Release v0.1.0

See merge request !27
parents 2734cac3 cc2158a7
Pipeline #25236 passed with stages
in 27 minutes and 19 seconds
# to use the env-var "GIT_CLONE_PATH", set the following in
# ./gitlab-runner/config.toml under [[runners]]:
# [runners.custom_build_dir]
# enabled = true
# This will prevent git clone conflicts for jobs ran in parallel
stages:
- info
- test
- deploy
workflow:
rules:
- if: $CI_COMMIT_REF_NAME =~ /-wip$/
when: never
- when: always
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_PATH/$CI_COMMIT_REF_NAME/$CI_JOB_NAME/$CI_CONCURRENT_ID
MAKE_FLAGS: -j 4
show-env-vars:
stage: info
variables:
SEP: "##################################################################"
S00: "commit date - "
S01: "project: ${CI_PROJECT_PATH}"
S02: "branch: ${CI_COMMIT_REF_NAME}"
S03: "commit: ${CI_COMMIT_SHA}"
S04: "commit msg: ${CI_COMMIT_MESSAGE}"
S05: "clone base path: "
S06: "runner token: ${CI_RUNNER_SHORT_TOKEN}"
script:
- echo -e "${SEP}\n${S00}$(date)\n${SEP}\n${S01}\n${S02}\n${S03}\n${S04}\n${SEP}\n${S05}${GIT_CLONE_PATH}\n${S06}\n${SEP}"
documentation:
only:
- develop
stage: test
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_PATH/$CI_COMMIT_REF_NAME/$CI_JOB_NAME
GIT_FETCH_EXTRA_FLAGS: --all --prune --quiet
script:
- module load foss/2019b
- module load texlive/2019
- module load Graphviz/2.42.2
- module load Anaconda3
- source activate /global/apps/mhm_checks/mhm_env
# use doxygen from the mhm_env conda environment
- doxygen doc/doxygen.config > doxygen_log_dev.txt
# create pdf documentation
- cd latex/ && make > ../doxygen_latex_dev.txt
- cp refman.pdf ../html/forces_doc.pdf
- cp refman.pdf ../forces_doc_dev.pdf
- cd .. && mv html html_dev
- mv doxygen_warn.txt doxygen_warn_dev.txt
- rm -rf latex
# same for master
- git checkout master
- doxygen doc/doxygen.config > doxygen_log_mas.txt
- cd latex/ && make > ../doxygen_latex_mas.txt
- cp refman.pdf ../html/forces_doc.pdf
- cp refman.pdf ../forces_doc_mas.pdf
- cd .. && mv html html_mas
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- html_dev
- forces_doc_dev.pdf
- doxygen_log_dev.txt
- doxygen_latex_dev.txt
- doxygen_warn_dev.txt
- html_mas
- forces_doc_mas.pdf
- doxygen_log_mas.txt
- doxygen_latex_mas.txt
- doxygen_warn_mas.txt
when: always
# how the job build directory is erected
.setup_build: &setup_build_dir
- mkdir -p $BUILD_DIR
- cd $BUILD_DIR
# make command
.make: &make
- make $MAKE_FLAGS
# make test command
.make_test: &make_test
- make $MAKE_FLAGS test
# make coverage command
.make_coverage: &make_coverage
- make $MAKE_FLAGS FORCES_coverage_CI
# cleanup after scripts
.cleanup: &cleanup
- cd -
# waiting on https://gitlab.com/groups/gitlab-org/-/epics/3589
# until this is fixed, we need to additionally set the CMAKE_FLAGS in the jobs as the expansion does not work
# debug variables
.debug_vars: &debug_vars
BUILD_DIR: build_debug
CMAKE_FLAGS: '$CMAKE_FLAGS -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
# release variables
.release_vars: &release_vars
BUILD_DIR: build_release
CMAKE_FLAGS: '$CMAKE_FLAGS -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
# coverage variables
.coverage_vars: &coverage_vars
CMAKE_FLAGS: '$CMAKE_FLAGS -DBUILD_TESTING=ON -DCMAKE_WITH_COVERAGE=ON'
# #################
# ### TEMPLATES ###
# #################
# template for test jobs
.test_template: &test_template
stage: test
script:
- source $MODULE_LOAD_SCRIPT
- *setup_build_dir
- cmake $CMAKE_FLAGS ..
- *make
- *make_test
- *cleanup
artifacts:
when: always
paths:
- $BUILD_DIR/Testing/Temporary
# template for coverage jobs
# .coverage_template: &coverage_template
# stage: test
# script:
# - source $MODULE_LOAD_SCRIPT
# - *setup_build_dir
# - cmake $CMAKE_FLAGS ..
# - *make
# - *make_coverage
# - *cleanup
# artifacts:
# when: always
# paths:
# - $BUILD_DIR/FORCES_coverage_CI.info
# - $BUILD_DIR/FORCES_coverage_CI
# ##################
# ### BUILD JOBS ###
# ##################
# ######################
# ### ANALYTICS JOBS ###
# #####################
# #################
# ### TEST JOBS ###
# #################
# # NAG fails on lightweight_lib
# test-nag62-debug:
# needs:
# - job: build-nag62-debug
# artifacts: true
# variables:
# <<: *debug_vars
# MODULE_LOAD_SCRIPT: hpc-module-loads/eve.nagfor62
# CMAKE_FLAGS: '-DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=64 -DCMAKE_BUILD_TYPE=Debug'
# <<: *test_template
test-nag62-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.nagfor62
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=64 -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
test-gfortran83MPI-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran83MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
test-gfortran83MPI-debug:
variables:
<<: *debug_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran83MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
<<: *test_template
test-gfortran102MPI-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran102MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
test-gfortran102MPI-debug:
variables:
<<: *debug_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran102MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
<<: *test_template
test-gfortran73MPI-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran73MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
test-gfortran73MPI-debug:
variables:
<<: *debug_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran73MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
<<: *test_template
test-intel18-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel18
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
test-intel18-debug:
variables:
<<: *debug_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel18
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
<<: *test_template
test-intel19-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel19
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
test-intel19MPI-release:
variables:
<<: *release_vars
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel19MPI
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
<<: *test_template
# Coverage fails due to a gcov complication
# coverage-gcc73:
# variables:
# <<: *debug_vars
# <<: *coverage_vars
# MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran73MPI
# CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WITH_COVERAGE=ON'
# <<: *coverage_template
# ###################
# ### DEPLOY JOBS ###
# ###################
pages:
when: always
only:
- develop
stage: deploy
needs:
- job: documentation
artifacts: true
script:
# create public dir (remove if already present)
- test -d public && rm -rf public
- mkdir -p public
# create the subdir
- mkdir public/stable/
- mkdir public/latest/
# copy the doxygen generated html page to the public site
- cp html_mas/* public/stable/ -R
- cp html_dev/* public/latest/ -R
# create an index.html that redirects to the master documentation (in master folder)
- cp doc/html_files/index.html public/
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- public
when: always
# common (default) options to cmake
# -DCMAKE_BUILD_TYPE=Release - compile in debug or release mode
# -DBUILD_TESTING=ON - whether to compile tests
# -DCMAKE_VERBOSE_MAKEFILE=OFF - see all the commands
# -DCMAKE_BUILD_MODULE_SYSTEM_INDEPENDENT=OFF - build the library INDEPENDENT of the module system,
# -DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=64 - find extra library paths on some systems (eve.nag62)
# so the build in the build tree works even after a module purge
cmake_minimum_required(VERSION 3.14)
# additional cmake-modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake-modules)
# get version and date from files (version.txt and version_date.txt)
include(version)
get_version(FORCES_VER FORCES_VER_DEV FORCES_DATE)
# create the project
project(FORCES
VERSION ${FORCES_VER}
DESCRIPTION "FORtran library for Computational Environmental Systems"
HOMEPAGE_URL "https://git.ufz.de/chs/forces/"
LANGUAGES Fortran
)
# add full version and date to pre-processor flags (qoutes need in before hand)
add_compile_definitions(FORCESVERSION='${FORCES_VER_DEV}' FORCESDATE='${FORCES_DATE}')
# library module specific settings
add_subdirectory(./src)
# automatically enables testing
option(BUILD_TESTING "Build with (pfUnit) tests." OFF)
include(CTest)
if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR ${LIB_NAME}_BUILD_TESTING) AND BUILD_TESTING)
add_subdirectory(./src/pf_tests)
add_subdirectory(./src/tests)
endif()
This file is part of the UFZ lightweight Fortran library.
The routine is released under the GNU Lesser General Public License. The following applies:
The UFZ Fortran library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The UFZ Fortran library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the UFZ Fortran library (cf. gpl.txt and lgpl.txt).
If not, see <http://www.gnu.org/licenses/>.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
This is the lightweight FORTRAN library of the
Department Computational Hydrosystems
Helmholtz Centre for Environmental Research - UFZ
Permoserstr. 15
04318 Leipzig, Germany
One can produce a browseable html of the library in the directory html by calling: make SRCPATH=. html
The library is maintained with a versioning system at:
https://git.ufz.de/chs/fortran
For running on Windows under Cygwin:
The link files on the SVN server are *nix style. One has to redo them on Windows.
In cygwin, in the directory FORTRAN_chs_lib do:
for i in $(find . -mindepth 2 -maxdepth 2 -name mo_\* -print) ; do if [[ $(head -1 $i | cut -f 1 -d ' ') == link ]] ; then cd $(dirname $i) ; ln -sf ../$(basename $i) ; cd .. ; fi ; done
for i in $(find . -mindepth 3 -maxdepth 3 -name mo_\* -print) ; do if [[ $(head -1 $i | cut -f 1 -d ' ') == link ]] ; then cd $(dirname $i) ; ln -sf ../../$(basename $i) ; cd ../.. ; fi ; done
cd test/test_mo_kernel ; ln -sf ../../nr_chs/golden.f90 ; cd ../..
Please do not commit these files because it will break the Library everywhere else except on Cygwin.
Created 11.11.2011 by Juliane Mai and Matthias Cuntz
Contact Matthias Cuntz - mc (at) macu.de
License
-------
This file is part of the UFZ lightweight Fortran library.
The routine is released under the GNU Lesser General Public License. The following applies:
The UFZ Fortran library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The UFZ Fortran library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the UFZ Fortran library (cf. gpl.txt and lgpl.txt).
If not, see <http://www.gnu.org/licenses/>.
# FORCES - FORtran library for Computational Environmental Systems
<div align="center">
<img src="https://git.ufz.de/chs/logos/-/raw/master/Forces.png" alt="Forces-LOGO" width="251px" style="width:251px;"/>
</div>
This is the FORTRAN library of the
Department Computational Hydrosystems
Helmholtz Centre for Environmental Research - UFZ
Permoserstr. 15
04318 Leipzig, Germany
It is a lightweight fork of the `jams_fortran` library maintained by Matthias Cuntz et al: https://github.com/mcuntz/jams_fortran
The `jams_fortran` library was formerly developed at the CHS department at the UFZ and is now released under the [MIT license](https://github.com/mcuntz/jams_fortran/blob/master/LICENSE).
## Dependencies
NetCDF-Fortran
Recent versions can be downloaded from [here](ftp://ftp.unidata.ucar.edu/pub/netcdf/).
Instructions can be found [here](https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html).
It is recommended to have a clean installation at a custom location
for a C compiler, a Fortran compiler, the NetCDF C library and the
NetCDF Fortran library with consistent compilers.
## License
This file is part of the UFZ CHS FORCES code base.
The routines is released under the GNU Lesser General Public License. The following applies:
The UFZ Fortran library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
FORCES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = https://git.ufz.de/chs/cmake-fortran-scripts.git
branch = v1.3
commit = 65c29b824958243b668ff1a7480a343509226725
parent = 760ac2af99a2dc57bb35cf4c0dc0d25819adb2fc
method = merge
cmdver = 0.4.3
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......
# Cmake Fortran Scripts
Cmake scripts for Fortran Projects at CHS
## Cmake Modules
Modules under `cmake-modules` provide different functions and macros
to be used in `CMakeLists.txt` files.
### `fortranpreprocessor.cmake`
Based on: https://github.com/fortran-lang/stdlib/blob/master/cmake/stdlib.cmake
- handles `fypp` pre-processor
Additional functions:
- `get_preproc_flag`: checks for the pre-processor flag of the current compiler (`-fpp` or `-cpp`)
- `cpp_definitions`: adds a compile definition and a corresponding cmake option
Can be included with:
```cmake
include(fortranpreprocessor)
```
### `CodeCoverage.cmake`
Taken from: https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake
Can be included and set up with:
```cmake
include(CodeCoverage)
append_coverage_compiler_flags()
SETUP_TARGET_FOR_COVERAGE_LCOV(
NAME PROJECT_coverage_CI