Fmriprep stopped due to memory error

Hi @jdkent and @oesteban,

We asked IT to increase the RAM available to us. We didn’t limit any memory usage as we wanted to give it a try, at the moment it has been running without any problems.

Thanks for your help!

Kind Regards
Kelan

Hello All,

I am also having Memory Error and would like to ask you for your help. I am running fmriprep on 16gb RAM, Ubuntu 18 machine. I tried arguments --mem-mb 15000; --low-mem; --nthreads 2 ; --omp-nthreads 4
But all ended up with Memory error. Then I tried solution provided in this post from jdkent in post #8. Afterwards I run>
sudo docker run -it --rm
-v /home/linux/Documents/testing/BIDS/BIDS_testing/projects/fmriprep/fmriprep:/usr/local/miniconda/lib/python3.6/site-packages/fmriprep:ro
-v /home/linux/Documents/testing/BIDS/BIDS_testing/BIDS_structure:/data -v /home/linux/Documents/testing/BIDS/BIDS_testing/BIDS_out/:/out
-v /home/linux/Documents/testing/BIDS/BIDS_testing/license.txt:/opt/freesurfer/license.txt
poldracklab/fmriprep:latest /data /out/out participant
–fs-license-file /opt/freesurfer/license.txt

And again I ended up with Memory error. Please help me solve this issue. Thank you in advance. I enclose both crash reports from the same run>
Node: fmriprep_wf.single_subject_01_wf.func_preproc_task_rest_wf.final_boldref_wf.val_bold
Working directory: /tmp/work/fmriprep_wf/single_subject_01_wf/func_preproc_task_rest_wf/final_boldref_wf/val_bold

Node inputs:

in_file = [’/tmp/work/fmriprep_wf/single_subject_01_wf/func_preproc_task_rest_wf/bold_bold_trans_wf/merge/vol0000_xform-00000_merged.nii.gz’]

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 67, in run_node
result[“result”] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 516, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 1386, in _run_interface
self.config[“execution”][“stop_on_first_crash”]
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 1295, in _collate_results
“Subnodes of node: %s failed:\n%s” % (self.name, “\n”.join(msg))
Exception: Subnodes of node: val_bold failed:
Subnode 0 failed
Error: Traceback (most recent call last):

File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/utils.py”, line 94, in nodelist_runner
result = node.run(updatehash=updatehash)

File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 516, in run
result = self._run_interface(execute=True)

File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_interface
return self._run_command(execute)

File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 741, in _run_command
result = self._interface.run(cwd=outdir)

File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 419, in run
runtime = self._run_interface(runtime)

File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/images.py”, line 577, in _run_interface
img.to_filename(out_fname)

File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/filebasedimages.py”, line 334, in to_filename
self.to_file_map()

File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/analyze.py”, line 1010, in to_file_map
data = np.asanyarray(self.dataobj)

File “/usr/local/miniconda/lib/python3.7/site-packages/numpy/core/numeric.py”, line 553, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)

File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 391, in array
arr = self._get_scaled(dtype=dtype, slicer=())

File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 358, in _get_scaled
scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)

File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/volumeutils.py”, line 966, in apply_read_scaling
arr = arr + inter

MemoryError

#And second one>

Node: fmriprep_wf.single_subject_01_wf.func_preproc_task_rest_wf.bold_std_trans_wf.bold_reference_wf.gen_ref
Working directory: /tmp/work/fmriprep_wf/single_subject_01_wf/func_preproc_task_rest_wf/bold_std_trans_wf/bold_reference_wf/_std_target_MNI152NLin2009cAsym.resnative/gen_ref

Node inputs:

in_file =
mc_method = AFNI
multiecho = False
sbref_file =

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py”, line 67, in run_node
result[“result”] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 516, in run
result = self._run_interface(execute=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 635, in _run_interface
return self._run_command(execute)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py”, line 741, in _run_command
result = self._interface.run(cwd=outdir)
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 419, in run
runtime = self._run_interface(runtime)
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/interfaces/registration.py”, line 491, in _run_interface
ref_im += nb.four_to_three(nib_i)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/funcs.py”, line 172, in four_to_three
arr = np.asanyarray(img.dataobj)
File “/usr/local/miniconda/lib/python3.7/site-packages/numpy/core/numeric.py”, line 553, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 391, in array
arr = self._get_scaled(dtype=dtype, slicer=())
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/arrayproxy.py”, line 358, in _get_scaled
scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
File “/usr/local/miniconda/lib/python3.7/site-packages/nibabel/volumeutils.py”, line 966, in apply_read_scaling
arr = arr + inter
MemoryError

@David_Gregus Do you have the memory settings on docker set to something high? Docker might have its own memory limit, different than the 16 gb of ram on your machine. Also, is this a single participant or whole directory run? As troubleshooting steps I would try checking the memory limit on docker, and only running on a single subject.

Best,
Steven

Thank you for your response. Regarding number of subjects it was run only on single subject. About Docker I did not change default settings, and I read on this website that:
“By default, Docker containers have access to the full RAM and CPU resources of the host.”
When I type: sudo docker info
I receive among other stats:
CPUs: 4
Total Memory: 15.54GiB

Therefore I think it utilizes all my capacity. Do you have any ideas what else can be the problem please ? Thank you very much in advance.