-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes, continuous integration, logical variable with variable typ…
…e, simplified internal build, Python scripts for RFMIP examples Accumulated results from ICON GPU Hackathon 2019. Closes (#28). -- Several small bug fixes (argument intent, maximum interpolation indices, thanks to Sebastian Rast) -- Parameterized checking for out-of-range values (works also on GPU) -- Continuous integration with Travis (thanks to Valentin Clement) -- Logical type defaults to Fortran; can be set to use c_bool with -DUSE_CBOOL -- Internal build system can use environmental variables instead of specified files (Makefile.conf etc.) to define compilers, flags, choose kernel directory -- Python scripts to automate running and testing of RFMIP examples -- Update RFMIP examples to use version 1.2 of atmospheres file -- End-to-end RFMIP examples on GPU are broken; fixes pending
- Loading branch information
1 parent
fb67a68
commit 53059e7
Showing
30 changed files
with
579 additions
and
182 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 |
---|---|---|
|
@@ -13,3 +13,5 @@ | |
# Don't commit specific Makefile variants | ||
Makefile.libs | ||
Makefile.conf | ||
|
||
src/ |
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,120 @@ | ||
sudo: required | ||
dist: xenial | ||
language: cpp | ||
# Could run both sets of kernels in parallel but setup is the majority of the time | ||
#env: | ||
# - RTE_KERNELS="" | ||
# - RTE_KERNELS="openacc" | ||
matrix: | ||
include: | ||
- compiler: gcc # Using | ||
env: | ||
- FC=pgfortran | ||
- FCFLAGS="-Mallocatable=03 -Mstandard" | ||
- TEST_PGI=yes | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- gcc-8 | ||
- gfortran-8 | ||
- libnetcdf-dev | ||
- compiler: gcc | ||
env: | ||
- FC=gfortran-9 | ||
- FCFLAGS="-ffree-line-length-none -m64 -std=f2003 -march=native -DUSE_CBOOL" | ||
- TEST_PGI=no | ||
- NCHOME=/usr/ | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- gcc-9 | ||
- gfortran-9 | ||
- libnetcdf-dev | ||
- compiler: gcc | ||
env: | ||
- FC=gfortran-8 | ||
- FCFLAGS="-ffree-line-length-none -m64 -std=f2003 -march=native -DUSE_CBOOL" | ||
- TEST_PGI=no | ||
- NCHOME=/usr/ | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- gcc-8 | ||
- gfortran-8 | ||
- libnetcdf-dev | ||
# cache: | ||
# timeout: 1000 | ||
# directories: | ||
# - "$HOME/pgi/" | ||
before_install: | ||
# Install PGI Community edition if not present in cache | ||
- if [[ "${TEST_PGI}" == "yes" ]]; then | ||
wget -q 'https://raw.githubusercontent.com/nemequ/pgi-travis/master/install-pgi.sh'; | ||
chmod +x install-pgi.sh; | ||
./install-pgi.sh --nvidia; | ||
pgfortran --version; | ||
echo "switch -pthread is" > .userrc; | ||
echo "append(LDLIB1=-lpthread);" >> .userrc; | ||
fi | ||
|
||
# Install netcdf-fortran for PGI | ||
- git clone https://github.com/Unidata/netcdf-fortran.git --branch v4.4.4 | ||
- cd netcdf-fortran | ||
- FC=$FC ./configure --prefix=${HOME}/netcdff | ||
- make | ||
- make install | ||
- cd .. || exit 1 | ||
|
||
# Install CONDA | ||
- wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | ||
- chmod +x miniconda.sh | ||
- ./miniconda.sh -b | ||
- export PATH=/home/travis/miniconda3/bin:$PATH | ||
- conda update --yes conda | ||
|
||
install: | ||
- conda create --yes -n test python=$TRAVIS_PYTHON_VERSION | ||
- source activate test | ||
- conda install --yes urllib3 netcdf4 xarray dask | ||
|
||
before_script: | ||
- cd examples/rfmip-clear-sky | ||
- python3 ./stage_files.py | ||
- cd ../.. | ||
- export RRTMGP_DIR=$PWD/build | ||
- export NFHOME=${HOME}/netcdff | ||
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NFHOME/lib | ||
script: | ||
# Build library - default kernels | ||
- cd build || exit 1 | ||
- make || exit 1 | ||
- cd .. || exit 1 | ||
# Build drivers | ||
- cd examples/rfmip-clear-sky | ||
- make | ||
# Run drivers | ||
- python3 ./run-rfmip-examples.py | ||
- python3 ./compare-to-reference.py | ||
- cd ../.. | ||
# Build library - Open-acc kernels | ||
- export RTE_KERNELS="openacc" | ||
- cd build | ||
- make clean | ||
- make || exit 1 | ||
- cd ../examples/rfmip-clear-sky | ||
- make clean | ||
- make || exit 1 | ||
# Run drivers | ||
- python3 ./run-rfmip-examples.py | ||
- python3 ./compare-to-reference.py | ||
- cd ../.. | ||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: never |
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
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
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 was deleted.
Oops, something went wrong.
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,17 @@ | ||
# Load the following modules | ||
# | ||
# module swap PrgEnv-cray PrgEnv-pgi | ||
# module load cray-netcdf cray-hdf5 | ||
# module unload cray-libsci_acc | ||
|
||
export FC = ftn | ||
export FCFLAGS = -g -Minfo -Mbounds -Mchkptr -Mstandard -Kieee -Mchkstk -Mipa=fast,inline -Mallocatable=03 | ||
|
||
# Where to find Fortran .mod files | ||
export FCINCLUDE = | ||
|
||
# Libraries including netCDF and Fortran interface to netCDF | ||
export LDFLAGS = | ||
|
||
#export LIBS = -lnetcdff -lnetcdf # Not necessary if ftn wrapper is used | ||
export LIBS = |
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,33 @@ | ||
#! /usr/bin/env python | ||
# | ||
# This script compares RFMIP results from RTE+RRTMGP against a benchmark | ||
# | ||
import os | ||
import numpy as np | ||
import xarray as xr | ||
|
||
ref_dir = "reference" | ||
tst_dir = "." | ||
|
||
rrtmg_suffix = "_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc" | ||
|
||
tst = xr.open_mfdataset(os.path.join(tst_dir, "r??" + rrtmg_suffix)) | ||
ref = xr.open_mfdataset(os.path.join(ref_dir, "r??" + rrtmg_suffix)) | ||
|
||
for v in ['rlu', 'rld', 'rsu', 'rsd']: | ||
if np.all(np.isnan(tst.variables[v].values)): | ||
raise Exception("All test values are missing. Were the tests run?") | ||
if np.any(np.isnan(tst.variables[v].values)): | ||
raise Exception("Some test values are missing. Now that is strange.") | ||
|
||
diff = abs((tst-ref).variables[v].values) | ||
avg = 0.5*(tst+ref).variables[v].values | ||
# Division raises a runtime warning when we divide by zero even if the | ||
# values in those locations will be ignored. | ||
with np.errstate(divide='ignore', invalid='ignore'): | ||
frac_diff = np.where((avg > 2.*np.finfo(float).eps), diff/avg, 0) | ||
|
||
if diff.max() > 0: | ||
print('Variable %s differs (max abs difference: %e; max frac. difference: %e%%)'%(v, diff.max(), 100.0 * frac_diff.max())) | ||
else: | ||
print('Variable %s: No diffs'%(v)) |
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
Oops, something went wrong.