Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to README.build.md and Derecho Switch #774

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions src/README.build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Standalone WRF-Hydro Build Instructions
Details regarding the model as well as documentation and user guides can be
found on the project website:
https://ral.ucar.edu/projects/wrf_hydro

## Requirements
* A supported Fortran compiler:
- GNU (gfortran)
- Cray (ftn)
- Intel (ifort)
- NVidia (nvfortran)
* MPI library (MPICH, Open MPI, etc.)
* NetCDF C & Fortran libraries v4.0+

Please note that these libraries need to be compiled with the same set of
compilers that will be used to compile WRF-Hydro

## Building WRF-Hydro

1. Obtain the source code

The source code for the latest WRF-Hydro release can be obtained here:
https://github.com/NCAR/wrf_hydro_nwm_public/releases/latest

Download and unpack the source code and navigate to the directory where you
will compile the code:

```
$ wget https://github.com/NCAR/wrf_hydro_nwm_public/archive/refs/tags/v5.3.0.tar.gz
$ tar zxf v5.3.0.tar.gz
$ cd wrf_hydro_nwm_public-5.3.0/src
```

2. Compile using CMake

Create build directory, configure with CMake, and then compile.
See the [CMake Build link](https://github.com/NCAR/wrf_hydro_nwm_public/blob/main/docs/BUILD.md#cmake-build)
for a table of WRF-Hydro specific configuration options.
The user can enable debug mode, nudging, etc.

```
$ mkdir build
$ cd build
$ cmake ..
$ make -j 4
```

This should result in the creation of a 'Run' directory populated with the
appropriate template parameter tables and namelists for the land surface model
selected as well as a model executable that is then symlinked to wrf_hydro.exe.

Note that, as mentioned above, passing the environment variable file as an
argument to the compile script is optional. However, if this is not passed the
desired environment variables must be set prior to running the compile script.
75 changes: 0 additions & 75 deletions src/README.build.txt

This file was deleted.

33 changes: 15 additions & 18 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Examples are provided in `tests/local/examples`.

At this time:
```
james@vpn35[609]:~/WRF_Hydro/wrf_hydro_nwm_public/tests/local> python run_tests.py --help
$ python run_tests.py --help
usage: run_tests.py [-h] --config CONFIG [CONFIG ...] --compiler COMPILER
--output_dir OUTPUT_DIR --candidate_dir CANDIDATE_DIR
--reference_dir REFERENCE_DIR [--domain_dir DOMAIN_DIR]
Expand Down Expand Up @@ -120,13 +120,13 @@ optional arguments:
convention is that the exe is always named
wrf_hydro.exe.
--ncores NCORES Number of cores to use for testing
--scheduler Scheduler to use for testing, options are PBSCheyenne
--scheduler Scheduler to use for testing, options are PBSDerecho
or do not specify for no scheduler
--nnodes NNODES Number of nodes to use for testing if running on
scheduler
--account ACCOUNT Account number to use if using a scheduler.
--walltime WALLTIME Account number to use if using a scheduler.
--queue QUEUE Queue to use if running on NCAR Cheyenne, options are
--queue QUEUE Queue to use if running on NCAR Derecho, options are
regular, premium, or shared
--print Print log to stdout instead of html
--pdb pdb (debug) in pytest
Expand All @@ -141,8 +141,8 @@ optional arguments:
## Croton example
Many docker-related details aside, this is essentially how the Croton Continuous-Inegration domain is run inside a docker container:
```
cd ~/wrf_hydro_nwm_public/tests/local
python run_tests.py \
$ cd ~/wrf_hydro_nwm_public/tests/local
$ python run_tests.py \
--config nwm_ana nwm_long_range reach gridded
--compiler gfort \
--output_dir /home/docker/test_out \
Expand All @@ -168,16 +168,15 @@ The following two envionments come "ready to go":
The two containers [`wrfhydro/dev:conda`](https://github.com/NCAR/wrf_hydro_docker/blob/main/dev/conda/Dockerfile) and [`wrfhydro/dev:modeltesting`](https://github.com/NCAR/wrf_hydro_docker/blob/main/dev/modeltesting/Dockerfile) contain the full software stack required to run testing.


## Cheyenne
To activate a common python virtual envionment for model testing on cheyenne:
## Derecho
To activate a common python virtual envionment for model testing on Derecho:
```
(368) jamesmcc@cheyenne3[999]:~> deactivate
jamesmcc@cheyenne3[1000]:~> source /glade/p/cisl/nwc/model_testing_env/wrf_hydro_nwm_test/bin/activate
(wrf_hydro_nwm_test) jamesmcc@cheyenne3[1001]:~>
$ deactivate
$ source /glade/p/cisl/nwc/model_testing_env/wrf_hydro_nwm_test/bin/activate
```
Because Whole new levels of testing complexity open up on cheyenne, there is a
Because Whole new levels of testing complexity open up on Derecho, there is a
special script to handle this with minimal pain:
`test/local/cheyenne/model_test.sh`. This script provides flexibility to
`test/local/derecho/model_test.sh`. This script provides flexibility to
switch compilers, MPI distributions, and domains. With MPI distributions,
different model execution commands may be required. Furthermore, output
comparison on large domains is better handled by `xrcmp` in `wrfhydropy`.
Expand All @@ -186,11 +185,9 @@ comparison on large domains is better handled by `xrcmp` in `wrfhydropy`.
# The Croton domain
A lovely watershed with some very lovely lakes, I am sure as I hope to visit
it some day. As a test domain, it has served us marvelously. To pull the domain
from the cloud:
from the WRF-Hydro release:
```
cd /your/path/to/wrf_hydro_nwm_public/tests/local/utils
python gdrive_download.py --file_id 1xFYB--zm9f8bFHESzgP5X5i7sZryQzJe --dest_file ~/croton_NY.tar.gz
cd ~
tar xzf croton_NY.tar.gz
mv example_case croton_NY ## we thought the generic name would be useful.
$ wget https://github.com/NCAR/wrf_hydro_nwm_public/releases/download/v5.4.0/croton_NY_training_example_v5.4.tar.gz
$ tar zxf croton_NY_training_example_v5.4.tar.gz
$ mv example_case croton_NY ## we thought the generic name would be useful.
```
2 changes: 1 addition & 1 deletion tests/config_file_meta/get_config_file_meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Example: python get_config_file_meta_data
#
# 1) Run script file in-place, in this directory, as above.
# 2) Typically, this will be run on cheyenne since that's where CONUS domain
# 2) Typically, this will be run on Derecho since that's where CONUS domain
# files will live.
# 3) Configure the list of domains paths and configs below.
# 4) The dirs in this directory must be removed to be refreshed.
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def pytest_addoption(parser):
parser.addoption(
'--scheduler',
action='store_true',
help='Use PBS scheduler on cheyenne'
help='Use PBS scheduler on Derecho'
)

parser.addoption(
Expand Down Expand Up @@ -105,7 +105,7 @@ def pytest_addoption(parser):
default='regular',
required=False,
action='store',
help='Queue to use if running on NCAR Cheyenne, options are regular, '
help='Queue to use if running on NCAR Derecho, options are regular, '
'premium, or shared'
)

Expand Down Expand Up @@ -170,7 +170,7 @@ def _make_sim(

if scheduler:
sim.add(
wrfhydropy.schedulers.PBSCheyenne(
wrfhydropy.schedulers.PBSDerecho(
account=account,
nproc=int(ncores),
nnodes=int(nnodes),
Expand Down
12 changes: 5 additions & 7 deletions tests/local/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
tests/local
===========

# Purpose
Where local testing happens.
Where local testing happens.

# run_tests.py
This is the commandline interface to pytest and running the tests.
This is the commandline interface to pytest and running the tests.
`python run_tests.py --help`
for more information
See ../README.md for more context.

# requirements.txt
These are essentially the requirements of wrf\_hydro\_py repeated here for minimal confusion.
These are essentially the requirements of wrf\_hydro\_py repeated here for minimal confusion.

# cheyenne
Scripting for cheyenne, including scheduling. Examples in the help.
# Derecho
Scripting for Derecho, including scheduling. Examples in the help.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

./model_test.sh \
-c /glade/u/home/jamesmcc/WRF_Hydro/wrf_hydro_nwm_public \
-r /glade/u/home/jamesmcc/WRF_Hydro/.wrf_hydro_nwm_public_REFERENCE \
-c path/to/wrf_hydro_nwm_public \
-r path/to/wrf_hydro_nwm_public_REFERENCE \
--compiler=ifort \
--mpi=impi \
--config='nwm_ana' \
--ncores=6 --queue=share \
--reference_update=false \
--domain_dir /glade/work/jamesmcc/domains/public/croton_NY
--domain_dir path/to/croton_NY

# Can be added
# --use_existing_test_dir
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash
# A first productiony test script for cheyenne.
# James McCreight
# April 5, 2019
# A first productiony test script for Derecho.
# Why bash?
# 1) might need to establish the python env from scratch,
# 2) set the modules is much easier
Expand Down Expand Up @@ -45,9 +43,8 @@ Options:
--walltime:
default=01:00:00
--domain_dir:
default=/glade/work/jamesmcc/domains/private/CONUS
The domain must be properly constructed with domain-side json namelist patch files and a
.version file. Most domains in /glade/work/jamesmcc/domains fit that criteria.
.version file.
--use_existing_test_dir
default is not included. Lets testing proceede with existing output in place.
--xrcmp_n_cores
Expand All @@ -71,7 +68,7 @@ Usage Examples:
--compiler=ifort --mpi=impi \\
--config='nwm_ana nwm_long_range gridded reach' \\
--ncores=6 --queue=share \\
--domain_dir /glade/work/jamesmcc/domains/public/croton_NY
--domain_dir path/to/croton_NY

# Non-standard mpi/exe_cmd example. A croton test of nwm_ana configuration.
# An strenuous exercise in bash escaping.
Expand All @@ -82,7 +79,7 @@ Usage Examples:
--exe_cmd=\"mpiexec_mpt $'\\\$(hostname)' -np \\\$ncores ./wrf_hydro.exe\" \\
--config='nwm_ana' \\
--ncores=6 --queue=share \\
--domain_dir /glade/work/jamesmcc/domains/public/croton_NY
--domain_dir path/to/croton_NY
"

## Default options
Expand All @@ -96,7 +93,7 @@ queue=regular
account=NRAL0017
walltime=01:00:00
reference_update=true
domain_dir=/glade/work/jamesmcc/domains/private/CONUS
domain_dir=path/to/CONUS
use_existing_test_dir=''
xrcmp_n_cores=0

Expand Down Expand Up @@ -196,8 +193,8 @@ if [[ $reference_update == 'true' ]]; then
echo; echo
printf "\e[7;49;94mUpdate the reference repository with NCAR/$branch_name\e[0m\n"
cd $reference_dir || exit 9
if [[ `hostname` != *cheyenne* ]]; then
ssh cheyenne1 "cd $reference_dir && git fetch upstream" || exit 9
if [[ `hostname` != *derecho* ]]; then
ssh derecho1 "cd $reference_dir && git fetch upstream" || exit 9
else
cd $reference_dir || exit 9
git fetch upstream || exit 9
Expand Down
16 changes: 0 additions & 16 deletions tests/local/examples/ex2_run_conus_cheyenne.sh

This file was deleted.

13 changes: 13 additions & 0 deletions tests/local/examples/ex2_run_conus_derecho.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Load conda environment

# Run the tests using a scheduler
python /glade/scratch/$USER/wrf_hydro_nwm_public/tests/local/run_tests.py \
--config nwm_ana nwm_long_range gridded reach \
--compiler ifort \
--output_dir /glade/derecho/scratch/$USER/test_out \
--candidate_dir /glade/derecho/scratch/$USER/wrf_hydro_nwm_public/ \
--reference_dir /glade/derecho/scratch/$USER/wrf_hydro_nwm_public/ \
--domain_dir path/to/CONUS_domain \
--scheduler
Loading