Skip to content

Commit 966b7f1

Browse files
committed
improving measurement of resources, use oneshot from psutils>=5.0
1 parent 4883211 commit 966b7f1

File tree

4 files changed

+95
-390
lines changed

4 files changed

+95
-390
lines changed

nipype/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def get_nipype_gitversion():
159159
'doc': ['Sphinx>=1.4', 'matplotlib', 'pydotplus', 'pydot>=1.2.3'],
160160
'tests': TESTS_REQUIRES,
161161
'nipy': ['nitime', 'nilearn', 'dipy', 'nipy', 'matplotlib'],
162-
'profiler': ['psutil'],
162+
'profiler': ['psutil>=5.0'],
163163
'duecredit': ['duecredit'],
164164
'xvfbwrapper': ['xvfbwrapper'],
165165
'pybids' : ['pybids']

nipype/interfaces/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,20 +1141,19 @@ def run(self, **inputs):
11411141
mon_sp.stop()
11421142

11431143
runtime.mem_peak_gb = None
1144-
runtime.nthreads_max = None
1144+
runtime.cpu_percent = None
11451145

11461146
# Read .prof file in and set runtime values
11471147
vals = np.loadtxt(mon_sp.fname, delimiter=',')
11481148
if vals.size:
11491149
vals = np.atleast_2d(vals)
1150-
_, mem_peak_mb, nthreads = vals.max(0).astype(float).tolist()
1151-
runtime.mem_peak_gb = mem_peak_mb / 1024
1152-
runtime.nthreads_max = int(nthreads)
1150+
runtime.mem_peak_gb = float(vals[:, 1].max() / 1024)
1151+
runtime.cpu_percent = float(vals[:, 2].max())
11531152

11541153
runtime.prof_dict = {
11551154
'time': vals[:, 0].tolist(),
11561155
'mem_gb': (vals[:, 1] / 1024).tolist(),
1157-
'cpus': vals[:, 2].astype(int).tolist(),
1156+
'cpus': vals[:, 2].tolist(),
11581157
}
11591158

11601159
return results

0 commit comments

Comments
 (0)