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

Move compiled WW3 code to the case build directory #6601

Closed
wants to merge 2 commits into from
Closed
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
26 changes: 16 additions & 10 deletions components/ww3/cime_config/buildlib_cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@ def buildlib(bldroot, installpath, case):
# Define WW3 repository directories
repodir = "{}/components/ww3/src".format(srcroot)
modeldir = "{}/WW3/model".format(repodir)

# TODO: these work dirs will have to be changed to live in the binary/build area.
# Achieving this will probably require a significant refactor of the ww3 infrastructure.
# Doing this stuff in-source not only clutters the repo, but also introduces potential race
# conditions if we were to try to build multiple ww3 cases simultaneously.
bindir = "{}/bin".format(modeldir)
exedir = "{}/exe".format(modeldir)
tmpdir = "{}/tmp".format(modeldir)
builddir = "{}/wav".format(exeroot)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the CIME EXEROOT?

Copy link
Contributor Author

@erinethomas erinethomas Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exeroot here refers to the build directory .. i.e. in env_build.xml: entry id="EXEROOT" value="/lcrc/group/e3sm/ac.ethomas/E3SMv3/Build_ww3_test.G.v3.PiControl/build"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rljacob to clarify: this PR would then place the compiled wave code in the "..../build/wav" directory.... if this is an inappropriate place to put the compiled WW3 code - suggestions for a better place are very welcome.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good place!


# work dirs are placed in the binary/build area.
bindir_source = "{}/bin".format(modeldir)
bindir = "{}/bin".format(builddir)
shutil.copytree(bindir_source, bindir)
auxdir_source = "{}/aux".format(modeldir)
auxdir = "{}/aux".format(builddir)
shutil.copytree(auxdir_source, auxdir)
ftndir_source = "{}/ftn".format(modeldir)
ftndir = "{}/ftn".format(builddir)
shutil.copytree(ftndir_source, ftndir)

tmpdir = "{}/tmp".format(builddir)

# Run w3_setup to create wwatch3.env file
env_file = os.path.join(bindir, "wwatch3.env")
Expand All @@ -77,15 +83,15 @@ def buildlib(bldroot, installpath, case):
y
""".format(sf90, scc, tmpdir))

run_bld_cmd_ensure_logging("./w3_setup {} -s E3SM < w3_setup.inp".format(modeldir), logger, from_dir=bindir)
run_bld_cmd_ensure_logging("./w3_setup {} -s E3SM < w3_setup.inp".format(builddir), logger, from_dir=bindir)
os.remove(inp_file)

# Generate pre-processed WW3 source code
ww3_exe = ['ww3_shel','ww3_grid']
for exe in ww3_exe:
run_bld_cmd_ensure_logging("./w3_source {}".format(exe), logger, from_dir=bindir)
for exe in ww3_exe:
tarfile = "{}/work/{}.tar.gz".format(modeldir,exe)
tarfile = "{}/work/{}.tar.gz".format(builddir,exe)
shutil.move(tarfile, tmpdir)
run_bld_cmd_ensure_logging("tar -xzvf {}.tar.gz".format(exe), logger, from_dir=tmpdir)
run_bld_cmd_ensure_logging("rm ww3_shel.F90", logger, from_dir=tmpdir)
Expand Down