GCP instance only using 3GB of available 24GB ram for fmriprep

I’m new to fmriprep/most of this stuff generally. I am setting up my lab’s compute infrastructure in Google Cloud and ran a command to execute fmriprep docker on my instance with the flags --nthreads 8 --omp-nthreads 8 --mem-mb 24000 (to specify that the system should utilize 24GB of ram/8 threads).

However, when I checked the usage with docker using - sudo docker ps -q | xargs sudo docker stats --no-stream during the execution, the system never used more than 3GB of ram. It seems from reading posts on this forum that for a single subject fmriprep running with this ram and CPU usage should take on the order of 1-3 hours, but mine takes days to execute for a single subject (including freesurfer). Is there a way I can specify to use all of the available ram?

Try not setting the thread value. The default (same as setting threads to “0”) uses the max amount of resources available. The only situations I have come across that warrant setting/restricting the threads count is for some processes (like some ANTs registration functions) that aren’t as reproducible if you use multiple threads.

Also, the --mem-mb argument you specified sets only the maximum amount of memory fMRIPrep can use. If you are on a processor with less than 24 GB, than that argument will not have any effect. Hope this helps!

Hi Steven,

Thanks for the pointers! I tried this and, but I’m not sure how much it helped in terms of improving the runtime. From what I can find online, it seems like 16 cores with 8GB of ram should be sufficient to run fmriprep on a single subject in a matter of a couple hours. Mine are taking days to complete for a single subject, and I notice all the time estimates online are listed without freesurfer.

Is this a reasonable amount of time for things to be taking WITH freesurfer?

Thanks for your help!


Hard to say without knowing more about your data. How many runs are there per subject?

There are 2 sessions per subject - is that what you mean?