Skip to content

Commit 57f919f

Browse files
authored
Merge branch 'erinethomas/ww3/move-location-ww3-build' (PR #6663)
WW3 code currently compiles in the source code repo. This is severely problematic and creates several issues including: a) cluttering the source code directory b) creating problematic 'race-conditions' when more than one case with WW3 need to be compiled (such as running test suites) This PR simply copies the required directories from the WW3 source code repo (the aux, ftn, and bin directories) to the "build/wav" directory and compiles all WW3 code there. The compiled .F90 and executable tar files are now located here: "/build/wav/tmp/" The E3SM commands ./case.build and ./case.build --clean-all correctly compile and clean all WW3 code. [BFB]
2 parents 5b923fa + 644019a commit 57f919f

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

components/ww3/cime_config/buildlib_cmake

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ def buildlib(bldroot, installpath, case):
4343
# Define WW3 repository directories
4444
repodir = "{}/components/ww3/src".format(srcroot)
4545
modeldir = "{}/WW3/model".format(repodir)
46-
47-
# TODO: these work dirs will have to be changed to live in the binary/build area.
48-
# Achieving this will probably require a significant refactor of the ww3 infrastructure.
49-
# Doing this stuff in-source not only clutters the repo, but also introduces potential race
50-
# conditions if we were to try to build multiple ww3 cases simultaneously.
51-
bindir = "{}/bin".format(modeldir)
52-
exedir = "{}/exe".format(modeldir)
53-
tmpdir = "{}/tmp".format(modeldir)
46+
builddir = "{}/wav".format(exeroot)
47+
48+
# work dirs are placed in the binary/build area.
49+
bindir_source = "{}/bin".format(modeldir)
50+
bindir = "{}/bin".format(builddir)
51+
shutil.copytree(bindir_source, bindir)
52+
auxdir_source = "{}/aux".format(modeldir)
53+
auxdir = "{}/aux".format(builddir)
54+
shutil.copytree(auxdir_source, auxdir)
55+
ftndir_source = "{}/ftn".format(modeldir)
56+
ftndir = "{}/ftn".format(builddir)
57+
shutil.copytree(ftndir_source, ftndir)
58+
59+
tmpdir = "{}/tmp".format(builddir)
5460

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

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

8389
# Generate pre-processed WW3 source code
8490
ww3_exe = ['ww3_shel','ww3_grid']
8591
for exe in ww3_exe:
8692
run_bld_cmd_ensure_logging("./w3_source {}".format(exe), logger, from_dir=bindir)
8793
for exe in ww3_exe:
88-
tarfile = "{}/work/{}.tar.gz".format(modeldir,exe)
94+
tarfile = "{}/work/{}.tar.gz".format(builddir,exe)
8995
shutil.move(tarfile, tmpdir)
9096
run_bld_cmd_ensure_logging("tar -xzvf {}.tar.gz".format(exe), logger, from_dir=tmpdir)
9197
run_bld_cmd_ensure_logging("rm ww3_shel.F90", logger, from_dir=tmpdir)

0 commit comments

Comments
 (0)