-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from jhamman/develop
Fixes failing tests on Travis Various warnings cleaned as well
- Loading branch information
Showing
13 changed files
with
219 additions
and
76 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 |
---|---|---|
@@ -1,19 +1,27 @@ | ||
sudo: false | ||
sudo: false # use container-based build | ||
language: fortran | ||
compiler: | ||
- gfortran | ||
os: | ||
- linux | ||
notifications: | ||
email: false | ||
|
||
compiler: gfortran-6 | ||
os: linux | ||
env: TESTID='gard_linux' | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- gfortran | ||
- libnetcdf-dev | ||
- liblapack-dev | ||
- libnetcdf-dev | ||
- gfortran-6 | ||
before_install: | ||
- source ci/gard_install_utils | ||
- gard_before_install | ||
install: | ||
- gard_install | ||
script: | ||
- sed -i "s|NCDF_PATH = /usr/local|NCDF_PATH = /usr|" src/makefile | ||
- sed -i "s|LAPACK_PATH = /usr/local|LAPACK_PATH = /usr|" src/makefile | ||
- make -C src -j4 test | ||
- make -C src -j4 | ||
- gard_script | ||
after_success: | ||
- gard_after_success | ||
after_failure: | ||
- gard_after_failure |
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,115 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
|
||
export CC=/usr/bin/gcc-6 | ||
export FC=/usr/bin/gfortran-6 | ||
|
||
if [ -z "$WORKDIR" ]; then | ||
export WORKDIR=$HOME/workdir | ||
mkdir -p $WORKDIR | ||
fi | ||
|
||
if [ -z "$INSTALLDIR" ]; then | ||
export INSTALLDIR=$HOME/installdir | ||
mkdir -p $INSTALLDIR | ||
fi | ||
|
||
function install_szip { | ||
echo install_szip | ||
cd $WORKDIR | ||
wget --no-check-certificate -q http://www.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz | ||
tar -xzf szip-2.1.tar.gz | ||
cd szip-2.1 | ||
./configure --prefix=$INSTALLDIR &> config.log | ||
make &> make.log | ||
make install | ||
export CPPFLAGS="$CPPFLAGS -I${INSTALLDIR}/include" | ||
export LDFLAGS="$LDFLAGS -L${INSTALLDIR}/lib" | ||
} | ||
|
||
function install_hdf5 { | ||
echo install_hdf5 | ||
cd $WORKDIR | ||
wget --no-check-certificate -q http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.10.0-patch1.tar.gz | ||
tar -xzf hdf5-1.10.0-patch1.tar.gz | ||
cd hdf5-1.10.0-patch1 | ||
./configure --prefix=$INSTALLDIR &> config.log | ||
make &> make.log | ||
make install | ||
export LIBDIR=${INSTALLDIR}/lib | ||
} | ||
|
||
function install_netcdf_c { | ||
echo install_netcdf_c | ||
cd $WORKDIR | ||
wget --no-check-certificate -q ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.4.1.tar.gz | ||
tar -xzf netcdf-4.4.1.tar.gz | ||
cd netcdf-4.4.1 | ||
./configure --prefix=$INSTALLDIR &> config.log | ||
make &> make.log | ||
make install | ||
export LD_LIBRARY_PATH=${INSTALLDIR}/lib | ||
} | ||
|
||
function install_netcdf_fortran { | ||
echo install_netcdf_fortran | ||
cd $WORKDIR | ||
wget --no-check-certificate -q ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-4.4.4.tar.gz | ||
tar -xzf netcdf-fortran-4.4.4.tar.gz | ||
cd netcdf-fortran-4.4.4 | ||
./configure --prefix=$INSTALLDIR &> config.log | ||
make &> make.log | ||
make install | ||
} | ||
|
||
function gard_before_install { | ||
echo gard_before_install | ||
# Install szip (used by hdf5) | ||
install_szip | ||
# Install HDF5 | ||
install_hdf5 | ||
# Install NetCDF-C | ||
install_netcdf_c | ||
# Install NetCDF fortran | ||
install_netcdf_fortran | ||
} | ||
|
||
function gard_install { | ||
echo gard_install | ||
cd ${TRAVIS_BUILD_DIR} | ||
sed -i "s|NCDF_PATH = /usr/local|NCDF_PATH = ${INSTALLDIR}|" src/makefile | ||
sed -i "s|LAPACK_PATH = /usr/local|LAPACK_PATH = /usr|" src/makefile | ||
make -C src clean; make -C src -j4 test | ||
make -C src clean; make -C src -j4 MODE=debugslow | ||
make -C src clean; make -C src -j4 MODE=debug | ||
make -C src clean; make -C src -j4 MODE=debugompslow | ||
make -C src clean; make -C src -j4 MODE=debugomp | ||
make -C src clean; make -C src -j4 MODE=profile | ||
make -C src clean; make -C src -j4 MODE=fast | ||
make -C src clean; make -C src -j4 | ||
echo "GARD install succeeded" | ||
} | ||
|
||
function gard_script { | ||
cd ./src | ||
./gard --version | ||
./gard -h | ||
./test_calendar | ||
# ./test_random | ||
./test_regression | ||
# ./test_config ../run/downscale_options.txt | ||
cd ../ | ||
echo "GARD script succeeded" | ||
} | ||
|
||
function gard_after_success { | ||
echo gard_after_success | ||
echo "GARD build succeeded" | ||
} | ||
|
||
function gard_after_failure { | ||
echo gard_after_failure | ||
echo "GARD build failed" | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
!>------------------------------------------------ | ||
!! Reads the configuration input file | ||
!! Also looks for commandline arguments to for an config filename | ||
!! Also looks for command line arguments to for an config filename | ||
!! | ||
!! @author | ||
!! Ethan Gutmann ([email protected]) | ||
|
@@ -19,6 +19,7 @@ module config_mod | |
logical :: module_debug | ||
public :: read_config | ||
public :: read_files_list, read_data_type, get_options_file ! only need to be public for test_config | ||
public :: print_model_init | ||
contains | ||
|
||
!>------------------------------------------------ | ||
|
@@ -762,6 +763,16 @@ function get_options_file() result(options_file) | |
! read the commandline argument | ||
call get_command_argument(1,options_file, status=error) | ||
|
||
if (trim(options_file) == '--version') then | ||
write(*, *) 'GARD '//trim(kVERSION_STRING) | ||
stop | ||
elseif (trim(options_file) == '-h') then | ||
call print_model_init() | ||
stop | ||
else | ||
call print_model_init() | ||
endif | ||
|
||
! if there was an error, return the default filename | ||
if (error>0) then | ||
options_file = kDEFAULT_OPTIONS_FILENAME | ||
|
@@ -772,8 +783,8 @@ function get_options_file() result(options_file) | |
stop "ERROR: options filename too long" | ||
endif | ||
else | ||
! if not commandline options were given, assume a default filename | ||
options_file = kDEFAULT_OPTIONS_FILENAME | ||
call print_model_init() | ||
stop | ||
endif | ||
|
||
! check to see if the expected filename even exists on disk | ||
|
@@ -786,4 +797,37 @@ function get_options_file() result(options_file) | |
write(*,*) "Using options file = ", trim(options_file) | ||
end function get_options_file | ||
|
||
!>------------------------------------------------ | ||
!! Prints model configuration info before running | ||
!! | ||
!! Prints a welcome and version string as well. | ||
!!------------------------------------------------ | ||
subroutine print_model_init() | ||
implicit none | ||
|
||
write(*,*) "Generalized Analog Regression Downscaling (GARD)" | ||
write(*,*) "-----------------------------------------------------------" | ||
write(*,*) "GARD Version : "//trim(kVERSION_STRING) | ||
! TODO: Add compile time options | ||
write(*,*) "" | ||
write(*,*) " The Generalized Analog Regression Downscaling (GARD)" | ||
write(*,*) " downscaling tool, version "//trim(kVERSION_STRING)//", Copyright (C) 2017 The" | ||
write(*,*) " National Center for Atmospheric Research. GARD comes with" | ||
write(*,*) " ABSOLUTELY NO WARRANTY. This is free software, you may " | ||
write(*,*) " redistribute it under certain conditions; see LICENSE.txt" | ||
write(*,*) " for details." | ||
write(*,*) "" | ||
write(*,*) " Online Documentation : http://gard.readthedocs.io" | ||
write(*,*) " Report Bugs and Issues to : https://github.com/NCAR/GARD/issues" | ||
write(*,*) "" | ||
write(*,*) "-----------------------------------------------------------" | ||
write(*,*) "Usage: gard [-h] [--version] options_file" | ||
write(*,*) "" | ||
write(*,*) "-h Help information for GARD" | ||
write(*,*) "--version Print the version number" | ||
write(*,*) "options_file Input options file name" | ||
write(*,*) "" | ||
|
||
end subroutine print_model_init | ||
|
||
end module config_mod |
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
Oops, something went wrong.