@@ -161,13 +161,15 @@ def __init__(self, plugin_args=None):
161
161
self .n_gpus = self .n_gpus_visible
162
162
self .total_gpu_processors = self .n_gpus * self .n_gpu_proc
163
163
else :
164
+ #total gpu_processors = no.of GPUs * no.of threads per single GPU
164
165
self .total_gpu_processors = self .n_gpus * self .n_gpu_proc
165
166
166
167
168
+ #form a GPU queue first
167
169
gpus = GPUtil .getGPUs ()
168
170
self .gpu_q = {}
169
-
170
-
171
+
172
+ #initialize the queue, set all slots free
171
173
slotno = 0
172
174
for gpu in gpus :
173
175
temp = {}
@@ -207,6 +209,7 @@ def gpu_count(self):
207
209
return len (GPUtil .getGPUs ())
208
210
209
211
def gpu_has_free_slot (self ):
212
+ #if a GPU has free slot, return True,its device-ID and the slot no.
210
213
free = False
211
214
devno = None
212
215
slotno = None
@@ -223,6 +226,7 @@ def gpu_has_free_slot(self):
223
226
return free ,devno ,slotno
224
227
225
228
def set_gpu_slot_busy (self ,slotno ,jobid ):
229
+ #if a GPU has free slot, book it for a jobid,modify the queue and set its slotno busy
226
230
devno = None
227
231
for dk in self .gpu_q .keys ():
228
232
for sk in self .gpu_q [dk ].keys ():
@@ -233,6 +237,7 @@ def set_gpu_slot_busy(self,slotno,jobid):
233
237
234
238
235
239
def set_gpu_slot_free (self ,jobid ):
240
+ #if a GPU task is finished, then set the slotno free in the queue
236
241
devno = None
237
242
for dk in self .gpu_q .keys ():
238
243
for sdk in self .gpu_q [dk ].keys ():
@@ -243,7 +248,7 @@ def set_gpu_slot_free(self,jobid):
243
248
return devno
244
249
245
250
246
- #override, to set gpu slot free
251
+ #override, to set gpu slot free, if the job was a gpu job
247
252
def _task_finished_cb (self , jobid ):
248
253
""" Extract outputs and assign to inputs of dependent tasks
249
254
@@ -281,7 +286,7 @@ def _submit_job(self, node, devno=None, updatehash=False):
281
286
run_node , (node , updatehash , self ._taskid , devno ),
282
287
callback = self ._async_callback )
283
288
284
- logger .info ('MultiProc submitted task %s (taskid=%d).' ,
289
+ logger .debug ('MultiProc submitted task %s (taskid=%d).' ,
285
290
node .fullname , self ._taskid )
286
291
return self ._taskid
287
292
0 commit comments