Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8fc3799

Browse filesBrowse files
committed
added some comments
1 parent 751e0cc commit 8fc3799
Copy full SHA for 8fc3799

File tree

1 file changed

+9
-4
lines changed
Filter options

1 file changed

+9
-4
lines changed

‎nipype/pipeline/plugins/multiproc.py

Copy file name to clipboardExpand all lines: nipype/pipeline/plugins/multiproc.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ def __init__(self, plugin_args=None):
161161
self.n_gpus = self.n_gpus_visible
162162
self.total_gpu_processors = self.n_gpus * self.n_gpu_proc
163163
else:
164+
#total gpu_processors = no.of GPUs * no.of threads per single GPU
164165
self.total_gpu_processors = self.n_gpus * self.n_gpu_proc
165166

166167

168+
#form a GPU queue first
167169
gpus=GPUtil.getGPUs()
168170
self.gpu_q={}
169-
170-
171+
172+
#initialize the queue, set all slots free
171173
slotno=0
172174
for gpu in gpus:
173175
temp={}
@@ -207,6 +209,7 @@ def gpu_count(self):
207209
return len(GPUtil.getGPUs())
208210

209211
def gpu_has_free_slot(self):
212+
#if a GPU has free slot, return True,its device-ID and the slot no.
210213
free=False
211214
devno=None
212215
slotno=None
@@ -223,6 +226,7 @@ def gpu_has_free_slot(self):
223226
return free,devno,slotno
224227

225228
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
226230
devno=None
227231
for dk in self.gpu_q.keys():
228232
for sk in self.gpu_q[dk].keys():
@@ -233,6 +237,7 @@ def set_gpu_slot_busy(self,slotno,jobid):
233237

234238

235239
def set_gpu_slot_free(self,jobid):
240+
#if a GPU task is finished, then set the slotno free in the queue
236241
devno=None
237242
for dk in self.gpu_q.keys():
238243
for sdk in self.gpu_q[dk].keys():
@@ -243,7 +248,7 @@ def set_gpu_slot_free(self,jobid):
243248
return devno
244249

245250

246-
#override, to set gpu slot free
251+
#override, to set gpu slot free, if the job was a gpu job
247252
def _task_finished_cb(self, jobid):
248253
""" Extract outputs and assign to inputs of dependent tasks
249254
@@ -281,7 +286,7 @@ def _submit_job(self, node, devno=None, updatehash=False):
281286
run_node, (node, updatehash, self._taskid, devno),
282287
callback=self._async_callback)
283288

284-
logger.info('MultiProc submitted task %s (taskid=%d).',
289+
logger.debug('MultiProc submitted task %s (taskid=%d).',
285290
node.fullname, self._taskid)
286291
return self._taskid
287292

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.