Skip to content

Commit 7eae4a2

Browse files
authored
[Fix] Move openmpi_oversubscribe to init function rather than resource_dict (#937)
1 parent 2a94f49 commit 7eae4a2

3 files changed

Lines changed: 24 additions & 22 deletions

File tree

src/executorlib/executor/flux.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class FluxJobExecutor(BaseExecutor):
7070
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
7171
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
7272
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
73+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
7374
7475
Examples:
7576
```
@@ -112,6 +113,7 @@ def __init__(
112113
export_workflow_filename: Optional[str] = None,
113114
log_obj_size: bool = False,
114115
wait: bool = True,
116+
openmpi_oversubscribe: bool = False,
115117
):
116118
"""
117119
The executorlib.FluxJobExecutor leverages either the message passing interface (MPI), the SLURM workload manager
@@ -162,14 +164,15 @@ def __init__(
162164
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
163165
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
164166
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
167+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
165168
166169
"""
167170
default_resource_dict: dict = {
168171
"cores": 1,
169172
"threads_per_core": 1,
170173
"gpus_per_core": 0,
171174
"cwd": None,
172-
"openmpi_oversubscribe": False,
175+
"openmpi_oversubscribe": openmpi_oversubscribe,
173176
"slurm_cmd_args": [],
174177
}
175178
if resource_dict is None:
@@ -243,8 +246,6 @@ class FluxClusterExecutor(BaseExecutor):
243246
- threads_per_core (int): number of OpenMP threads to be used for each function call
244247
- gpus_per_core (int): number of GPUs per worker - defaults to 0
245248
- cwd (str/None): current working directory where the parallel python task is executed
246-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI and
247-
SLURM only) - default False
248249
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
249250
- error_log_file (str): Name of the error log file to use for storing exceptions raised
250251
by the Python functions submitted to the Executor.
@@ -271,6 +272,7 @@ class FluxClusterExecutor(BaseExecutor):
271272
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
272273
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
273274
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
275+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
274276
275277
Examples:
276278
```
@@ -311,6 +313,7 @@ def __init__(
311313
export_workflow_filename: Optional[str] = None,
312314
log_obj_size: bool = False,
313315
wait: bool = True,
316+
openmpi_oversubscribe: bool = False,
314317
):
315318
"""
316319
The executorlib.FluxClusterExecutor leverages either the message passing interface (MPI), the SLURM workload
@@ -330,8 +333,6 @@ def __init__(
330333
- threads_per_core (int): number of OpenMP threads to be used for each function call
331334
- gpus_per_core (int): number of GPUs per worker - defaults to 0
332335
- cwd (str/None): current working directory where the parallel python task is executed
333-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI
334-
and SLURM only) - default False
335336
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM
336337
only)
337338
- error_log_file (str): Name of the error log file to use for storing exceptions
@@ -359,14 +360,15 @@ def __init__(
359360
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
360361
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
361362
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
363+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
362364
363365
"""
364366
default_resource_dict: dict = {
365367
"cores": 1,
366368
"threads_per_core": 1,
367369
"gpus_per_core": 0,
368370
"cwd": None,
369-
"openmpi_oversubscribe": False,
371+
"openmpi_oversubscribe": openmpi_oversubscribe,
370372
"slurm_cmd_args": [],
371373
"run_time_limit": None,
372374
}

src/executorlib/executor/single.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class SingleNodeExecutor(BaseExecutor):
3737
- threads_per_core (int): number of OpenMP threads to be used for each function call
3838
- gpus_per_core (int): number of GPUs per worker - defaults to 0
3939
- cwd (str/None): current working directory where the parallel python task is executed
40-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI and
41-
SLURM only) - default False
4240
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
4341
- error_log_file (str): Name of the error log file to use for storing exceptions raised
4442
by the Python functions submitted to the Executor.
@@ -63,6 +61,7 @@ class SingleNodeExecutor(BaseExecutor):
6361
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
6462
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
6563
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
64+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
6665
6766
Examples:
6867
```
@@ -101,6 +100,7 @@ def __init__(
101100
export_workflow_filename: Optional[str] = None,
102101
log_obj_size: bool = False,
103102
wait: bool = True,
103+
openmpi_oversubscribe: bool = False,
104104
):
105105
"""
106106
The executorlib.SingleNodeExecutor leverages either the message passing interface (MPI), the SLURM workload
@@ -120,8 +120,6 @@ def __init__(
120120
- threads_per_core (int): number of OpenMP threads to be used for each function call
121121
- gpus_per_core (int): number of GPUs per worker - defaults to 0
122122
- cwd (str/None): current working directory where the parallel python task is executed
123-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI
124-
and SLURM only) - default False
125123
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM
126124
only)
127125
- error_log_file (str): Name of the error log file to use for storing exceptions
@@ -148,14 +146,15 @@ def __init__(
148146
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
149147
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
150148
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
149+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
151150
152151
"""
153152
default_resource_dict: dict = {
154153
"cores": 1,
155154
"threads_per_core": 1,
156155
"gpus_per_core": 0,
157156
"cwd": None,
158-
"openmpi_oversubscribe": False,
157+
"openmpi_oversubscribe": openmpi_oversubscribe,
159158
"slurm_cmd_args": [],
160159
}
161160
if resource_dict is None:
@@ -242,6 +241,7 @@ class TestClusterExecutor(BaseExecutor):
242241
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
243242
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
244243
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
244+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
245245
246246
Examples:
247247
```
@@ -280,6 +280,7 @@ def __init__(
280280
export_workflow_filename: Optional[str] = None,
281281
log_obj_size: bool = False,
282282
wait: bool = True,
283+
openmpi_oversubscribe: bool = False,
283284
):
284285
"""
285286
The executorlib.api.TestClusterExecutor is designed to test the file based communication used in the
@@ -320,14 +321,15 @@ def __init__(
320321
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
321322
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
322323
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
324+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
323325
324326
"""
325327
default_resource_dict: dict = {
326328
"cores": 1,
327329
"threads_per_core": 1,
328330
"gpus_per_core": 0,
329331
"cwd": None,
330-
"openmpi_oversubscribe": False,
332+
"openmpi_oversubscribe": openmpi_oversubscribe,
331333
}
332334
if resource_dict is None:
333335
resource_dict = {}

src/executorlib/executor/slurm.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ class SlurmClusterExecutor(BaseExecutor):
3939
- threads_per_core (int): number of OpenMP threads to be used for each function call
4040
- gpus_per_core (int): number of GPUs per worker - defaults to 0
4141
- cwd (str/None): current working directory where the parallel python task is executed
42-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI and
43-
SLURM only) - default False
4442
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
4543
- error_log_file (str): Name of the error log file to use for storing exceptions raised
4644
by the Python functions submitted to the Executor.
@@ -68,6 +66,7 @@ class SlurmClusterExecutor(BaseExecutor):
6866
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
6967
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
7068
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
69+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
7170
7271
Examples:
7372
```
@@ -108,6 +107,7 @@ def __init__(
108107
export_workflow_filename: Optional[str] = None,
109108
log_obj_size: bool = False,
110109
wait: bool = True,
110+
openmpi_oversubscribe: bool = False,
111111
):
112112
"""
113113
The executorlib.SlurmClusterExecutor leverages either the message passing interface (MPI), the SLURM workload
@@ -127,8 +127,6 @@ def __init__(
127127
- threads_per_core (int): number of OpenMP threads to be used for each function call
128128
- gpus_per_core (int): number of GPUs per worker - defaults to 0
129129
- cwd (str/None): current working directory where the parallel python task is executed
130-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI
131-
and SLURM only) - default False
132130
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM
133131
only)
134132
- error_log_file (str): Name of the error log file to use for storing exceptions
@@ -156,14 +154,15 @@ def __init__(
156154
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
157155
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
158156
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
157+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
159158
160159
"""
161160
default_resource_dict: dict = {
162161
"cores": 1,
163162
"threads_per_core": 1,
164163
"gpus_per_core": 0,
165164
"cwd": None,
166-
"openmpi_oversubscribe": False,
165+
"openmpi_oversubscribe": openmpi_oversubscribe,
167166
"slurm_cmd_args": [],
168167
}
169168
if resource_dict is None:
@@ -260,8 +259,6 @@ class SlurmJobExecutor(BaseExecutor):
260259
- threads_per_core (int): number of OpenMP threads to be used for each function call
261260
- gpus_per_core (int): number of GPUs per worker - defaults to 0
262261
- cwd (str/None): current working directory where the parallel python task is executed
263-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI and
264-
SLURM only) - default False
265262
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
266263
- num_nodes (int, optional): The number of compute nodes to use for executing the task.
267264
Defaults to None.
@@ -291,6 +288,7 @@ class SlurmJobExecutor(BaseExecutor):
291288
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
292289
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
293290
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
291+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
294292
295293
Examples:
296294
```
@@ -330,6 +328,7 @@ def __init__(
330328
export_workflow_filename: Optional[str] = None,
331329
log_obj_size: bool = False,
332330
wait: bool = True,
331+
openmpi_oversubscribe: bool = False,
333332
):
334333
"""
335334
The executorlib.SlurmJobExecutor leverages either the message passing interface (MPI), the SLURM workload
@@ -349,8 +348,6 @@ def __init__(
349348
- threads_per_core (int): number of OpenMP threads to be used for each function call
350349
- gpus_per_core (int): number of GPUs per worker - defaults to 0
351350
- cwd (str/None): current working directory where the parallel python task is executed
352-
- openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI
353-
and SLURM only) - default False
354351
- slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM
355352
only)
356353
- num_nodes (int, optional): The number of compute nodes to use for executing the task.
@@ -381,14 +378,15 @@ def __init__(
381378
export_workflow_filename (str): Name of the file to store the exported workflow graph in.
382379
log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
383380
wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
381+
openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
384382
385383
"""
386384
default_resource_dict: dict = {
387385
"cores": 1,
388386
"threads_per_core": 1,
389387
"gpus_per_core": 0,
390388
"cwd": None,
391-
"openmpi_oversubscribe": False,
389+
"openmpi_oversubscribe": openmpi_oversubscribe,
392390
"slurm_cmd_args": [],
393391
}
394392
if resource_dict is None:

0 commit comments

Comments
 (0)