1
Fork 0

Added mpi support for swash

This commit is contained in:
Edgar P. Burkhart 2022-03-03 12:01:34 +01:00
parent 1449b66917
commit fda16fa3ea
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 7 additions and 1 deletions

View file

@ -14,6 +14,7 @@ out=out_data
input=sws/INPUT.sws
swashrun=/opt/swash/swash/swashrun
out=out
mpi=4
[post]
out=out_post

View file

@ -28,6 +28,11 @@ if out.exists():
with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
tmpdir = pathlib.Path(tmp_raw)
if config.hasoption("swash", "mpi"):
mpi = ("-mpi", config.getint("swash", "mpi"))
else:
mpi = ()
log.info(f"Copying files to '{tmpdir}'")
shutil.copy2(inp, tmpdir)
shutil.copytree(
@ -36,7 +41,7 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
log.info(f"Runing swash in '{tmpdir}'")
subprocess.run(
(config.get("swash", "swashrun"), "-input", inp.name),
(config.get("swash", "swashrun"), "-input", inp.name, *mpi),
cwd=tmpdir,
stdout=logfile,
stderr=logfile,