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

Single Executable for main GDAS JEDI applications #2565

Merged
Merged
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
2 changes: 1 addition & 1 deletion parm/config/gfs/config.aeroanl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export JEDI_FIX_YAML="${PARMgfs}/gdas/aero_jedi_fix.yaml.j2"
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE="${EXECgfs}/fv3jedi_var.x"
export JEDIEXE="${EXECgfs}/gdas.x"

if [[ "${DOIAU}" == "YES" ]]; then
export aero_bkg_times="3,6,9"
Expand Down
2 changes: 1 addition & 1 deletion parm/config/gfs/config.atmanl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export layout_y_atmanl=@LAYOUT_Y_ATMANL@
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE=${EXECgfs}/fv3jedi_var.x
export JEDIEXE=${EXECgfs}/gdas.x

echo "END: config.atmanl"
2 changes: 1 addition & 1 deletion parm/config/gfs/config.atmensanl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export layout_y_atmensanl=@LAYOUT_Y_ATMENSANL@
export io_layout_x=@IO_LAYOUT_X@
export io_layout_y=@IO_LAYOUT_Y@

export JEDIEXE=${EXECgfs}/fv3jedi_letkf.x
export JEDIEXE=${EXECgfs}/gdas.x

echo "END: config.atmensanl"
2 changes: 1 addition & 1 deletion parm/config/gfs/config.snowanl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source "${EXPDIR}/config.resources" snowanl
export OBS_LIST="${PARMgfs}/gdas/snow/obs/lists/gdas_snow.yaml.j2"

# Name of the JEDI executable and its yaml template
export JEDIEXE="${EXECgfs}/fv3jedi_letkf.x"
export JEDIEXE="${EXECgfs}/gdas.x"
export JEDIYAML="${PARMgfs}/gdas/snow/letkfoi/letkfoi.yaml.j2"

# Ensemble member properties
Expand Down
25 changes: 4 additions & 21 deletions sorc/link_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -333,33 +333,16 @@ fi

# GDASApp
if [[ -d "${HOMEgfs}/sorc/gdas.cd/build" ]]; then
declare -a JEDI_EXE=("fv3jedi_addincrement.x" \
"fv3jedi_diffstates.x" \
"fv3jedi_ensvariance.x" \
"fv3jedi_hofx.x" \
"fv3jedi_var.x" \
"fv3jedi_convertincrement.x" \
"fv3jedi_dirac.x" \
"fv3jedi_error_covariance_training.x" \
"fv3jedi_letkf.x" \
"fv3jedi_convertstate.x" \
"fv3jedi_eda.x" \
"fv3jedi_forecast.x" \
declare -a JEDI_EXE=("gdas.x" \
aerorahul marked this conversation as resolved.
Show resolved Hide resolved
"gdas_soca_gridgen.x" \
"gdas_soca_error_covariance_toolbox.x" \
"gdas_soca_setcorscales.x" \
"fv3jedi_plot_field.x" \
"fv3jedi_data_checker.py" \
"fv3jedi_enshofx.x" \
"fv3jedi_hofx_nomodel.x" \
"fv3jedi_testdata_downloader.py" \
"fv3jedi_fv3inc.x" \
"gdas_ens_handler.x" \
"gdas_incr_handler.x" \
"gdas_obsprovider2ioda.x" \
"gdas_socahybridweights.x" \
"soca_convertincrement.x" \
"soca_error_covariance_training.x" \
"soca_setcorscales.x" \
"soca_gridgen.x" \
"soca_var.x" \
"bufr2ioda.x" \
"calcfIMS.exe" \
"apply_incr.exe" )
Expand Down
4 changes: 3 additions & 1 deletion ush/python/pygfs/task/aero_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ def execute(self: Analysis) -> None:
chdir(self.task_config.DATA)

exec_cmd = Executable(self.task_config.APRUN_AEROANL)
exec_name = os.path.join(self.task_config.DATA, 'fv3jedi_var.x')
exec_name = os.path.join(self.task_config.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('variational')
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
Expand Down
40 changes: 0 additions & 40 deletions ush/python/pygfs/task/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,46 +292,6 @@ def get_fv3ens_dict(config: Dict[str, Any]) -> Dict[str, Any]:
}
return ens_dict

@staticmethod
@logit(logger)
def execute_jediexe(workdir: Union[str, os.PathLike], aprun_cmd: str, jedi_exec: str, jedi_yaml: str) -> None:
"""
Run a JEDI executable

Parameters
----------
workdir : str | os.PathLike
Working directory where to run containing the necessary files and executable
aprun_cmd : str
Launcher command e.g. mpirun -np <ntasks> or srun, etc.
jedi_exec : str
Name of the JEDI executable e.g. fv3jedi_var.x
jedi_yaml : str | os.PathLike
Name of the yaml file to feed the JEDI executable e.g. fv3jedi_var.yaml

Raises
------
OSError
Failure due to OS issues
WorkflowException
All other exceptions
"""

os.chdir(workdir)

exec_cmd = Executable(aprun_cmd)
exec_cmd.add_default_arg([os.path.join(workdir, jedi_exec), jedi_yaml])

logger.info(f"Executing {exec_cmd}")
try:
exec_cmd()
except OSError:
logger.exception(f"FATAL ERROR: Failed to execute {exec_cmd}")
raise OSError(f"{exec_cmd}")
except Exception:
logger.exception(f"FATAL ERROR: Error occured during execution of {exec_cmd}")
raise WorkflowException(f"{exec_cmd}")

@staticmethod
@logit(logger)
def tgz_diags(statfile: str, diagdir: str) -> None:
Expand Down
19 changes: 14 additions & 5 deletions ush/python/pygfs/task/atm_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ def variational(self: Analysis) -> None:
chdir(self.task_config.DATA)

exec_cmd = Executable(self.task_config.APRUN_ATMANLVAR)
exec_name = os.path.join(self.task_config.DATA, 'fv3jedi_var.x')
exec_name = os.path.join(self.task_config.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('variational')
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
Expand All @@ -144,10 +146,17 @@ def init_fv3_increment(self: Analysis) -> None:
@logit(logger)
def fv3_increment(self: Analysis) -> None:
# Run executable
self.execute_jediexe(self.runtime_config.DATA,
self.task_config.APRUN_ATMANLFV3INC,
self.task_config.jedi_exe,
self.task_config.jedi_yaml)
exec_cmd = Executable(self.task_config.APRUN_ATMANLFV3INC)
exec_cmd.add_default_arg(self.task_config.jedi_exe)
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
logger.debug(f"Executing {exec_cmd}")
exec_cmd()
except OSError:
raise OSError(f"Failed to execute {exec_cmd}")
except Exception:
raise WorkflowException(f"An error occured during execution of {exec_cmd}")

@logit(logger)
def finalize(self: Analysis) -> None:
Expand Down
4 changes: 3 additions & 1 deletion ush/python/pygfs/task/atmens_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ def execute(self: Analysis) -> None:
chdir(self.task_config.DATA)

exec_cmd = Executable(self.task_config.APRUN_ATMENSANL)
exec_name = os.path.join(self.task_config.DATA, 'fv3jedi_letkf.x')
exec_name = os.path.join(self.task_config.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('localensembleda')
exec_cmd.add_default_arg(self.task_config.jedi_yaml)

try:
Expand Down
18 changes: 14 additions & 4 deletions ush/python/pygfs/task/snow_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,20 @@ def execute(self) -> None:
AttrDict({key: localconf[key] for key in ['DATA', 'ntiles', 'current_cycle']}))

logger.info("Running JEDI LETKF")
self.execute_jediexe(localconf.DATA,
localconf.APRUN_SNOWANL,
os.path.basename(localconf.JEDIEXE),
localconf.jedi_yaml)
exec_cmd = Executable(localconf.APRUN_SNOWANL)
exec_name = os.path.join(localconf.DATA, 'gdas.x')
exec_cmd.add_default_arg(exec_name)
exec_cmd.add_default_arg('fv3jedi')
exec_cmd.add_default_arg('localensembleda')
exec_cmd.add_default_arg(localconf.jedi_yaml)

try:
logger.debug(f"Executing {exec_cmd}")
exec_cmd()
except OSError:
raise OSError(f"Failed to execute {exec_cmd}")
except Exception:
raise WorkflowException(f"An error occured during execution of {exec_cmd}")

logger.info("Creating analysis from backgrounds and increments")
self.add_increments(localconf)
Expand Down
Loading