Skip to content

Commit

Permalink
Merge pull request #230 from chrisfilo/enh/explicit_mem_limit
Browse files Browse the repository at this point in the history
[RTM] option for explicitly limiting memory
  • Loading branch information
chrisgorgo committed Dec 7, 2016
2 parents 32e36f3 + 7478cd1 commit 3ea1bdf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fmriprep/run_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def main():
help='run debug version of workflow')
g_input.add_argument('--nthreads', action='store', default=0,
type=int, help='number of threads')
g_input.add_argument('--mem_mb', action='store', default=0,
type=int, help='try to limit requested memory to this number')
g_input.add_argument('--write-graph', action='store_true', default=False,
help='Write workflow graph.')
g_input.add_argument('--use-plugin', action='store', default=None,
Expand Down Expand Up @@ -83,6 +85,7 @@ def create_workflow(opts):
'bids_root': op.abspath(opts.bids_dir),
'write_graph': opts.write_graph,
'nthreads': opts.nthreads,
'mem_mb': opts.mem_mb,
'debug': opts.debug,
'ants_nthreads': opts.ants_nthreads,
'skull_strip_ants': opts.skull_strip_ants,
Expand Down Expand Up @@ -131,6 +134,8 @@ def create_workflow(opts):
if settings['nthreads'] > 1:
plugin_settings['plugin'] = 'MultiProc'
plugin_settings['plugin_args'] = {'n_procs': settings['nthreads']}
if settings['mem_mb']:
plugin_settings['plugin_args']['memory_gb'] = settings['mem_mb']/1024

if settings['ants_nthreads'] == 0:
settings['ants_nthreads'] = cpu_count()
Expand Down

0 comments on commit 3ea1bdf

Please sign in to comment.