@@ -134,13 +134,14 @@ def __init__(self, plugin_args=None):
134
134
# GPU found on system
135
135
self .n_gpus_visible = MultiProcPlugin .gpu_count ()
136
136
# proc per GPU set by user
137
- self .n_gpu_procs = plugin_args .get ('n_gpu_procs' , self .n_gpus_visible )
137
+ self .n_gpu_procs = self . plugin_args .get ('n_gpu_procs' , self .n_gpus_visible )
138
138
139
139
# total no. of processes allowed on all gpus
140
140
if self .n_gpu_procs > self .n_gpus_visible :
141
141
logger .info (
142
- 'Total number of GPUs proc requested (%d) exceeds the available number of GPUs (%d) on the system. Using requested GPU slots at your own risk!' % (
143
- self .n_gpu_procs , self .n_gpus_visible ))
142
+ 'Total number of GPUs proc requested (%d) exceeds the available number of GPUs (%d) on the system. Using requested GPU slots at your own risk!'
143
+ % (self .n_gpu_procs , self .n_gpus_visible )
144
+ )
144
145
145
146
# Instantiate different thread pools for non-daemon processes
146
147
logger .debug (
@@ -220,9 +221,7 @@ def _prerun_check(self, graph):
220
221
if self .raise_insufficient :
221
222
raise RuntimeError ("Insufficient resources available for job" )
222
223
if np .any (np .array (tasks_gpu_th ) > self .n_gpu_procs ):
223
- logger .warning (
224
- 'Nodes demand more GPU than allowed (%d).' ,
225
- self .n_gpu_procs )
224
+ logger .warning ('Nodes demand more GPU than allowed (%d).' , self .n_gpu_procs )
226
225
if self .raise_insufficient :
227
226
raise RuntimeError ('Insufficient GPU resources available for job' )
228
227
@@ -257,7 +256,9 @@ def _send_procs_to_workers(self, updatehash=False, graph=None):
257
256
)
258
257
259
258
# Check available resources by summing all threads and memory used
260
- free_memory_gb , free_processors , free_gpu_slots = self ._check_resources (self .pending_tasks )
259
+ free_memory_gb , free_processors , free_gpu_slots = self ._check_resources (
260
+ self .pending_tasks
261
+ )
261
262
262
263
stats = (
263
264
len (self .pending_tasks ),
@@ -267,7 +268,7 @@ def _send_procs_to_workers(self, updatehash=False, graph=None):
267
268
free_processors ,
268
269
self .processors ,
269
270
free_gpu_slots ,
270
- self .n_gpu_procs
271
+ self .n_gpu_procs ,
271
272
)
272
273
if self ._stats != stats :
273
274
tasks_list_msg = ""
@@ -338,8 +339,11 @@ def _send_procs_to_workers(self, updatehash=False, graph=None):
338
339
is_gpu_node = self .procs [jobid ].is_gpu_node ()
339
340
340
341
# If node does not fit, skip at this moment
341
- if (next_job_th > free_processors or next_job_gb > free_memory_gb
342
- or (is_gpu_node and next_job_gpu_th > free_gpu_slots )):
342
+ if (
343
+ next_job_th > free_processors
344
+ or next_job_gb > free_memory_gb
345
+ or (is_gpu_node and next_job_gpu_th > free_gpu_slots )
346
+ ):
343
347
logger .debug (
344
348
"Cannot allocate job %d (%0.2fGB, %d threads, %d GPU slots)." ,
345
349
jobid ,
@@ -424,6 +428,7 @@ def gpu_count():
424
428
n_gpus = 1
425
429
try :
426
430
import GPUtil
431
+
427
432
return len (GPUtil .getGPUs ())
428
433
except ImportError :
429
434
return n_gpus
0 commit comments