Add command to be executed in parallel. The command is launched with mpiexec. Parallel processes are distributed evenly amongst the compute nodes. Args: command (`str` or `Iterable` of `str`s): Command to be executed in parallel. work
(self,
command,
work_dir=None,
nodes=None,
procs_per_node=None,
launcher=None,
launcher_args=None)
| 80 | self.add_header_line(f'#PJM --sparam "wait-time=600"') |
| 81 | |
| 82 | def add_parallel_command(self, |
| 83 | command, |
| 84 | work_dir=None, |
| 85 | nodes=None, |
| 86 | procs_per_node=None, |
| 87 | launcher=None, |
| 88 | launcher_args=None): |
| 89 | """Add command to be executed in parallel. |
| 90 | |
| 91 | The command is launched with mpiexec. Parallel processes are |
| 92 | distributed evenly amongst the compute nodes. |
| 93 | |
| 94 | Args: |
| 95 | command (`str` or `Iterable` of `str`s): Command to be |
| 96 | executed in parallel. |
| 97 | work_dir (str, optional): Working directory. |
| 98 | nodes (int, optional): Number of compute nodes. |
| 99 | procs_per_node (int, optional): Number of parallel |
| 100 | processes per compute node. |
| 101 | launcher (str, optional): mpiexec executable. |
| 102 | launcher_args (`Iterable` of `str`s, optional): |
| 103 | Command-line arguments to mpiexec. |
| 104 | |
| 105 | """ |
| 106 | |
| 107 | # Use default values if needed |
| 108 | if work_dir is None: |
| 109 | work_dir = self.work_dir |
| 110 | if nodes is None: |
| 111 | nodes = self.nodes |
| 112 | if procs_per_node is None: |
| 113 | procs_per_node = self.procs_per_node |
| 114 | if launcher is None: |
| 115 | launcher = self.launcher |
| 116 | if launcher_args is None: |
| 117 | launcher_args = self.launcher_args |
| 118 | |
| 119 | # Construct mpiexec invocation |
| 120 | args = [f'{launcher}'] |
| 121 | args.extend(make_iterable(launcher_args)) |
| 122 | args.extend([ |
| 123 | f'-n {nodes*procs_per_node}', |
| 124 | ]) |
| 125 | args.extend([ |
| 126 | '-stdout-proc ./output.%j/%/1000r/stdout', |
| 127 | '-stderr-proc ./output.%j/%/1000r/stderr', |
| 128 | ]) |
| 129 | args.extend(make_iterable(command)) |
| 130 | self.add_command(args) |
| 131 | |
| 132 | def submit(self, overwrite=False): |
| 133 | """Submit batch job. |
no test coverage detected