diff --git a/swash/config.ini b/swash/config.ini index 171f312..490e6c2 100644 --- a/swash/config.ini +++ b/swash/config.ini @@ -14,6 +14,7 @@ out=out_data input=sws/INPUT.sws swashrun=/opt/swash/swash/swashrun out=out +mpi=4 [post] out=out_post diff --git a/swash/processing/swash.py b/swash/processing/swash.py index 0493c64..8d7bb93 100644 --- a/swash/processing/swash.py +++ b/swash/processing/swash.py @@ -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,