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
|
input=sws/INPUT.sws
|
||||||
swashrun=/opt/swash/swash/swashrun
|
swashrun=/opt/swash/swash/swashrun
|
||||||
out=out
|
out=out
|
||||||
|
mpi=4
|
||||||
|
|
||||||
[post]
|
[post]
|
||||||
out=out_post
|
out=out_post
|
||||||
|
|
|
@ -28,6 +28,11 @@ if out.exists():
|
||||||
with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
||||||
tmpdir = pathlib.Path(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}'")
|
log.info(f"Copying files to '{tmpdir}'")
|
||||||
shutil.copy2(inp, tmpdir)
|
shutil.copy2(inp, tmpdir)
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
|
@ -36,7 +41,7 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
||||||
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
|
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
|
||||||
log.info(f"Runing swash in '{tmpdir}'")
|
log.info(f"Runing swash in '{tmpdir}'")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
(config.get("swash", "swashrun"), "-input", inp.name),
|
(config.get("swash", "swashrun"), "-input", inp.name, *mpi),
|
||||||
cwd=tmpdir,
|
cwd=tmpdir,
|
||||||
stdout=logfile,
|
stdout=logfile,
|
||||||
stderr=logfile,
|
stderr=logfile,
|
||||||
|
|
Loading…
Reference in a new issue