Added mpi support for swash
This commit is contained in:
parent
1449b66917
commit
fda16fa3ea
2 changed files with 7 additions and 1 deletions
|
@ -14,6 +14,7 @@ out=out_data
|
|||
input=sws/INPUT.sws
|
||||
swashrun=/opt/swash/swash/swashrun
|
||||
out=out
|
||||
mpi=4
|
||||
|
||||
[post]
|
||||
out=out_post
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue