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

All-sky example useful for timing #220

Merged
merged 39 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c45b8dc
Remove GPTL, reorganize
RobertPincus Jun 13, 2023
d2b404f
Refactored all-sky example, WIP
RobertPincus Jun 13, 2023
1f6b934
No GPTL in Makefile either
RobertPincus Jun 13, 2023
d159a39
Refactor RH - why's nvfortran failing?
RobertPincus Jun 14, 2023
1825269
Debugging prints
RobertPincus Jun 14, 2023
feeff71
More debuggin
RobertPincus Jun 14, 2023
f4fe171
Even more debuggin'
RobertPincus Jun 14, 2023
3e3685b
Explicit allocation?
RobertPincus Jun 14, 2023
35d310b
EMD
RobertPincus Jun 14, 2023
89b6245
Put all subroutines with `contains`?
RobertPincus Jun 14, 2023
80272b9
Add RCE profiles to allsky example (unused so far)
RobertPincus Jun 14, 2023
84a3e07
All-sky calculations use RCEMIP-ish profiles - no data written so not…
RobertPincus Jun 15, 2023
5c05c91
Consistent OpenACC memory approach
RobertPincus Jun 17, 2023
0f99ec2
Elemental functions need acc diretives
RobertPincus Jun 17, 2023
3b4bd13
Garand vestiges are removed; fluxes are written but not checked yet
RobertPincus Jun 20, 2023
0c28791
Remove elemental subroutine; update Makefile
RobertPincus Jun 20, 2023
788808a
Remove elemental function
RobertPincus Jun 20, 2023
bfffbd3
All the instances if you please
RobertPincus Jun 20, 2023
982fd91
Recompute Tv in stratosphere
RobertPincus Jun 20, 2023
1f8313e
Create temps, pressures on the device only once.
RobertPincus Jun 21, 2023
766494e
Updates from develop branch
RobertPincus Jun 21, 2023
62cbf43
Checking of all-sky reference results
RobertPincus Jun 21, 2023
4ce5523
Include cloud and aerosol state in all-sky outputs; add no-aerosols case
RobertPincus Jun 21, 2023
2caba63
Accelerator data management in all-sky example
RobertPincus Jun 23, 2023
384beab
omp directive syntax
RobertPincus Jun 23, 2023
808121b
Syntax, relhum on GPU for compute_aerosols
RobertPincus Jun 23, 2023
a1c0d7d
Revised timing output from all-sky example
RobertPincus Jun 23, 2023
2c1bae8
Conditional evaluation when computing profiles
RobertPincus Jun 27, 2023
6446ab4
Add Python script to loop over ncol, nlay while specifying clouds, ae…
RobertPincus Jun 27, 2023
2f512a2
Extra print
RobertPincus Jun 27, 2023
0d96bdb
Explicit memory release in all-sky example
RobertPincus Jun 27, 2023
0d482e0
Misplaced finalize()
RobertPincus Jun 27, 2023
1b0bb64
Revised timing info in all-sky example
RobertPincus Jun 27, 2023
039f6c8
Explicit memory release; no checks in any loop iteration beyond the f…
RobertPincus Jun 28, 2023
905a1fe
Update run-allsky-example.py
RobertPincus Jun 28, 2023
adddafa
OpenACC/OpenMP memory management
RobertPincus Jul 3, 2023
453857b
Syntax....
RobertPincus Jul 3, 2023
fb3e92a
More robust updating of derived types in aerosol optics
RobertPincus Jul 3, 2023
95c051a
reorder aerosol LUTs for much better GPU perf
alexeedm Jul 4, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/containerized-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
FC: ${{ matrix.fortran-compiler }}
FCFLAGS: ${{ matrix.fcflags }}
# Make variables:
NCHOME: /dummy
NFHOME: /opt/netcdf-fortran
RRTMGP_ROOT: ${{ github.workspace }}
RRTMGP_DATA: ${{ github.workspace }}/rrtmgp-data
Expand All @@ -76,6 +75,7 @@ jobs:
with:
repository: earth-system-radiation/rrtmgp-data
path: rrtmgp-data
ref: feature-timing
#
# Cache RFMIP files
#
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
with:
repository: earth-system-radiation/rrtmgp-data
path: rrtmgp-data
ref: feature-timing
#
# Synchronize the package index
#
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/self-hosted-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ jobs:
FC: ftn
FCFLAGS: ${{ matrix.fcflags }}
# Make variables:
NCHOME: /dummy
NFHOME: /dummy
RRTMGP_ROOT: ${{ github.workspace }}
RRTMGP_DATA: ${{ github.workspace }}/rrtmgp-data
RTE_KERNELS: ${{ matrix.rte-kernels }}
Expand All @@ -62,6 +60,7 @@ jobs:
with:
repository: earth-system-radiation/rrtmgp-data
path: rrtmgp-data
ref: feature-timing
#
# Finalize build environment
#
Expand Down
29 changes: 18 additions & 11 deletions examples/all-sky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ VPATH = ../:$(RRTMGP_ROOT)/rrtmgp-frontend # Needed for cloud_optics and aerosol
#
# Extra sources -- extensions to RRTMGP classes, shared infrastructure, local sources
#
ADDITIONS = mo_load_coefficients.o mo_simple_netcdf.o mo_cloud_optics_rrtmgp.o mo_load_cloud_coefficients.o
ADDITIONS += mo_garand_atmos_io.o
ADDITIONS = mo_load_coefficients.o mo_simple_netcdf.o
ADDITIONS += mo_cloud_optics_rrtmgp.o mo_load_cloud_coefficients.o
ADDITIONS += mo_aerosol_optics_rrtmgp_merra.o mo_load_aerosol_coefficients.o

#
Expand All @@ -41,20 +41,27 @@ rrtmgp_allsky: $(ADDITIONS) rrtmgp_allsky.o

rrtmgp_allsky.o: $(ADDITIONS) rrtmgp_allsky.F90

mo_cloud_optics_rrtmgp.o: mo_cloud_optics_rrtmgp.F90
mo_load_coefficients.o: mo_simple_netcdf.o mo_load_coefficients.F90
mo_garand_atmos_io.o: mo_simple_netcdf.o mo_garand_atmos_io.F90
mo_load_cloud_coefficients.o: mo_simple_netcdf.o mo_cloud_optics_rrtmgp.o mo_load_cloud_coefficients.F90
mo_cloud_optics_rrtmgp.o: mo_cloud_optics_rrtmgp.F90
mo_aerosol_optics_rrtmgp_merra.o: mo_aerosol_optics_rrtmgp_merra.F90
mo_load_coefficients.o: mo_simple_netcdf.o mo_load_coefficients.F90
mo_load_cloud_coefficients.o: mo_simple_netcdf.o mo_cloud_optics_rrtmgp.o mo_load_cloud_coefficients.F90
mo_load_aerosol_coefficients.o: mo_simple_netcdf.o mo_aerosol_optics_rrtmgp_merra.o mo_load_aerosol_coefficients.F90

tests:
cp ${RRTMGP_DATA}/examples/all-sky/inputs/garand-atmos-1.nc rrtmgp-allsky.nc
$(RUN_CMD) ./rrtmgp_allsky rrtmgp-allsky.nc ${RRTMGP_DATA}/rrtmgp-gas-lw-g256.nc ${RRTMGP_DATA}/rrtmgp-clouds-lw.nc ${RRTMGP_DATA}/rrtmgp-aerosols-merra-lw.nc 128
$(RUN_CMD) ./rrtmgp_allsky rrtmgp-allsky.nc ${RRTMGP_DATA}/rrtmgp-gas-sw-g224.nc ${RRTMGP_DATA}/rrtmgp-clouds-sw.nc ${RRTMGP_DATA}/rrtmgp-aerosols-merra-sw.nc 128
$(RUN_CMD) ./rrtmgp_allsky 24 72 1 rrtmgp-allsky-lw.nc \
${RRTMGP_DATA}/rrtmgp-gas-lw-g256.nc ${RRTMGP_DATA}/rrtmgp-clouds-lw.nc ${RRTMGP_DATA}/rrtmgp-aerosols-merra-lw.nc
$(RUN_CMD) ./rrtmgp_allsky 24 72 1 rrtmgp-allsky-sw.nc \
${RRTMGP_DATA}/rrtmgp-gas-sw-g224.nc ${RRTMGP_DATA}/rrtmgp-clouds-sw.nc ${RRTMGP_DATA}/rrtmgp-aerosols-merra-sw.nc
$(RUN_CMD) ./rrtmgp_allsky 24 72 1 rrtmgp-allsky-lw-no-aerosols.nc \
${RRTMGP_DATA}/rrtmgp-gas-lw-g256.nc ${RRTMGP_DATA}/rrtmgp-clouds-lw.nc
$(RUN_CMD) ./rrtmgp_allsky 24 72 1 rrtmgp-allsky-sw-no-aerosols.nc \
${RRTMGP_DATA}/rrtmgp-gas-sw-g224.nc ${RRTMGP_DATA}/rrtmgp-clouds-sw.nc

check:
python ./compare-to-reference.py
python ./compare-to-reference.py --allsky_file rrtmgp-allsky-lw.nc
python ./compare-to-reference.py --allsky_file rrtmgp-allsky-sw.nc
python ./compare-to-reference.py --allsky_file rrtmgp-allsky-lw-no-aerosols.nc
python ./compare-to-reference.py --allsky_file rrtmgp-allsky-sw-no-aerosols.nc

clean:
-rm rrtmgp_allsky *.o *.optrpt ../*.optrpt *.mod
-rm rrtmgp_allsky *.o *.optrpt ../*.optrpt *.mod *.nc
10 changes: 5 additions & 5 deletions examples/all-sky/compare-to-reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
parser = argparse.ArgumentParser(
description="Compares all-sky example output to file in reference "
"directory")
parser.add_argument("--allsky_file", type=str, default="rrtmgp-allsky.nc",
parser.add_argument("--allsky_file", type=str, default="rrtmgp-allsky-lw.nc",
dest="file",
help="Name of file inputs and outputs for "
"all-sky problem (same for test and reference)")
Expand All @@ -35,13 +35,13 @@
ref = xr.open_dataset(ref_file)

failed = False
for v in ['lw_flux_up', 'lw_flux_dn', 'sw_flux_up', 'sw_flux_dn',
'sw_flux_dir']:
for v in tst.variables:
if np.any(np.isnan(ref.variables[v].values)):
raise Exception(v + ": some ref values are missing. Now that is strange.")
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.")
raise Exception(v + ":Some test values are missing. Now that is strange.")

# express as (tst-ref).variables[v].values when replacing reference file
# to have same number of columns
Expand Down
62 changes: 62 additions & 0 deletions examples/all-sky/make_problem_size_loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#! /usr/bin/env python
#
# This script...
#
import argparse
import csv
import os

# template: exe ncol nlay nloops output_file k_dist clouds aeorsols

# specify: kdist, optional clouds, aerosols. specify nloops
# Toggle clouds and aerosols?
# Loop over sets of ncol, nlay,
# output name


if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Description here ")
# Argument parseing described at
# https://stackoverflow.com/questions/15753701/how-can-i-pass-a-list-as-a-command-line-argument-with-argparse
parser.add_argument("-x", "--executable",
type=str,
default="./rrtmgp_allsky",
help="Path to exectuable")
parser.add_argument("-c", "--ncol",
type=lambda items: [int(i) for i in list(csv.reader([items]))[0]],
default="2,4,8,16",
help="Number of columns (multiple e.g. 2,4,8,16)")
parser.add_argument("-l", "--nlay",
type=lambda items: [int(i) for i in list(csv.reader([items]))[0]],
default="32, 64, 96",
help="Number of layers (multiple e.g. 32,64.96)")
parser.add_argument("-i", "--nloops",
type=int, default=1,
help="Number of loops (same for all ncol)")
parser.add_argument("-o", "--output_file",
type=str,
default="rrtmgp-allsky-output.nc",
help="Path to output file")
parser.add_argument("-k", "--k_distribution",
type=str,
required = True,
help="Path to gas optics file [required]")
parser.add_argument("-cl", "--cloud_optics",
type=str, default="",
help="Path to cloud optics file")
parser.add_argument("-a", "--aerosol_optics",
type=str, default="",
help="Path to aerosol optics file")
args = parser.parse_args()

# Can't supply aerosols without clouds
if(args.cloud_optics == "" and args.aerosol_optics != ""):
raise AssertionError("Need to supply cloud optics if providing aerosol optics")

# Every combo of ncol, nlay
for l in args.nlay:
for i in args.ncol:
print(f"{args.executable} {i:6d} {l:4d} {args.nloops:3d} " + \
f"{args.output_file} {args.k_distribution}" + \
f"{args.cloud_optics} {args.aerosol_optics}")
Loading
Loading