From 36d1f4b0c3beec224460793b92c6852573c6e01d Mon Sep 17 00:00:00 2001 From: Liam Pattinson Date: Tue, 17 Oct 2023 14:17:39 +0100 Subject: [PATCH] Remove printed messages, remove MPI when nprocs=1 --- run_epoch.py | 4 ++-- src/epoch_containers/run_epoch.py | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/run_epoch.py b/run_epoch.py index 0336996..54972b1 100755 --- a/run_epoch.py +++ b/run_epoch.py @@ -104,9 +104,8 @@ def singularity_cmd( container: str, output: Path, dims: int, photons: bool, nprocs: int ) -> str: """Constructs the command to run Epoch via a Singularity container.""" - return dedent( + cmd = dedent( f"""\ - mpirun -n {nprocs} singularity exec --bind {output.resolve()}:/output {container} @@ -116,6 +115,7 @@ def singularity_cmd( {'--photons' if photons else ''} """ ).replace("\n", " ") + return f"mpirun -n {nprocs} " + cmd if nprocs != 1 else cmd def main() -> None: diff --git a/src/epoch_containers/run_epoch.py b/src/epoch_containers/run_epoch.py index 9b9d0fc..00d5fef 100644 --- a/src/epoch_containers/run_epoch.py +++ b/src/epoch_containers/run_epoch.py @@ -103,12 +103,8 @@ def run_epoch( if not output.is_dir(): raise NotADirectoryError(str(output)) - full_path = output.resolve() - print(f"Running on the directory {full_path}, containing:") - for f in full_path.iterdir(): - print(f"- {f.name}") - subprocess.run([exe], input=str(full_path).encode("utf-8")) + subprocess.run([exe], input=str(output.resolve()).encode("utf-8")) def main() -> None: