@@ -28,11 +28,12 @@ class SingleTaskExecutor(ExecutorBase):
2828
2929 Args:
3030 cores (int): defines the number of MPI ranks to use for each function call
31+ threads_per_core (int): number of OpenMP threads to be used for each function call
3132 gpus_per_task (int): number of GPUs per MPI rank - defaults to 0
3233 init_function (None): optional function to preset arguments for functions which are submitted later
3334 cwd (str/None): current working directory where the parallel python task is executed
3435
35- Simple example :
36+ Examples :
3637 ```
3738 >>> import numpy as np
3839 >>> from pympipool import Executor
@@ -57,6 +58,7 @@ class SingleTaskExecutor(ExecutorBase):
5758 def __init__ (
5859 self ,
5960 cores ,
61+ threads_per_core = 1 ,
6062 gpus_per_task = 0 ,
6163 init_function = None ,
6264 cwd = None ,
@@ -68,6 +70,7 @@ def __init__(
6870 kwargs = {
6971 "future_queue" : self ._future_queue ,
7072 "cores" : cores ,
73+ "threads_per_core" : threads_per_core ,
7174 "gpus_per_task" : gpus_per_task ,
7275 "cwd" : cwd ,
7376 "executor" : executor ,
@@ -86,6 +89,7 @@ def __init__(
8689 self ,
8790 max_workers ,
8891 cores_per_worker = 1 ,
92+ threads_per_core = 1 ,
8993 gpus_per_worker = 0 ,
9094 init_function = None ,
9195 cwd = None ,
@@ -99,6 +103,7 @@ def __init__(
99103 "future_queue" : self ._future_queue ,
100104 "max_workers" : max_workers ,
101105 "cores_per_worker" : cores_per_worker ,
106+ "threads_per_core" : threads_per_core ,
102107 "gpus_per_worker" : gpus_per_worker ,
103108 "init_function" : init_function ,
104109 "cwd" : cwd ,
@@ -112,6 +117,7 @@ def __init__(
112117def execute_parallel_tasks (
113118 future_queue ,
114119 cores ,
120+ threads_per_core = 1 ,
115121 gpus_per_task = 0 ,
116122 cwd = None ,
117123 executor = None ,
@@ -122,6 +128,7 @@ def execute_parallel_tasks(
122128 Args:
123129 future_queue (queue.Queue): task queue of dictionary objects which are submitted to the parallel process
124130 cores (int): defines the total number of MPI ranks to use
131+ threads_per_core (int): number of OpenMP threads to be used for each function call
125132 gpus_per_task (int): number of GPUs per MPI rank - defaults to 0
126133 cwd (str/None): current working directory where the parallel python task is executed
127134 executor (flux.job.FluxExecutor/None): flux executor to submit tasks to - optional
@@ -141,6 +148,7 @@ def execute_parallel_tasks(
141148 command_lst = command_lst ,
142149 cwd = cwd ,
143150 cores = cores ,
151+ threads_per_core = threads_per_core ,
144152 gpus_per_core = gpus_per_task ,
145153 executor = executor ,
146154 )
@@ -151,6 +159,7 @@ def interface_bootup(
151159 command_lst ,
152160 cwd = None ,
153161 cores = 1 ,
162+ threads_per_core = 1 ,
154163 gpus_per_core = 0 ,
155164 executor = None ,
156165):
@@ -161,6 +170,7 @@ def interface_bootup(
161170 connections = FluxPythonInterface (
162171 cwd = cwd ,
163172 cores = cores ,
173+ threads_per_core = threads_per_core ,
164174 gpus_per_core = gpus_per_core ,
165175 oversubscribe = False ,
166176 executor = executor ,
@@ -178,6 +188,7 @@ def executor_broker(
178188 future_queue ,
179189 max_workers ,
180190 cores_per_worker = 1 ,
191+ threads_per_core = 1 ,
181192 gpus_per_worker = 0 ,
182193 init_function = None ,
183194 cwd = None ,
@@ -187,6 +198,7 @@ def executor_broker(
187198 meta_future_lst = _get_executor_list (
188199 max_workers = max_workers ,
189200 cores_per_worker = cores_per_worker ,
201+ threads_per_core = threads_per_core ,
190202 gpus_per_worker = gpus_per_worker ,
191203 init_function = init_function ,
192204 cwd = cwd ,
@@ -208,6 +220,7 @@ def executor_broker(
208220def _get_executor_list (
209221 max_workers ,
210222 cores_per_worker = 1 ,
223+ threads_per_core = 1 ,
211224 gpus_per_worker = 0 ,
212225 init_function = None ,
213226 cwd = None ,
@@ -216,6 +229,7 @@ def _get_executor_list(
216229 return {
217230 get_future_done (): SingleTaskExecutor (
218231 cores = cores_per_worker ,
232+ threads_per_core = threads_per_core ,
219233 gpus_per_task = int (gpus_per_worker / cores_per_worker ),
220234 init_function = init_function ,
221235 cwd = cwd ,
0 commit comments