Summary of what happened:
Running fmriprep-docker on a Mac Studio (M1 Max: 10 Core CPU and 32GB RAM; macOS Ventura 13.1) for a single subject takes a very long time.
E.g.:
Subject with 1 T1 weighted structural image, 1 EPI (>820 volumes), 1 phasedifference fieldmap (acquired with a Siemens scanner) takes ~ 16h without freesurfer surface reconstruction and ~ 3-4 days with freesurfer reconstruction.
Subject with 1 T1 weighted strucutral image, 8 EPIs (>190 volumes each), 1 phasedifference fieldmap (acquired with a Siemens scanner) takes ~ 26h without freesurfer surface reconstruction.
This is nowhere close to the expected run time mentioned in the docs (FAQ, Tips, and Tricks — fmriprep version documentation ).
We have > 150 Subjects to be preprocessed and at this rate it would take several months to complete (currently we do not have access to a HPC). Therefore, I am wondering whether there are any options that I am missing that might help accelerate fmriprep?
Thank you very much for any help in advance!
Best,
Tibor
Command used (and if a helper script was used, a link to the helper script or the command generated):
participant_label=participant01
max_mem_mb=24000
max_cores_cpu=8
freesurfer_file=~/freesurfer_license.txt
sourcepath=/path_to/sourcedata
preprocpath=/path_to/derivatives/preproc
workdirpath=/path_to/derivatives/workdir
fmriprep-docker ${sourcepath} ${preprocpath} \
participant \
--participant-label ${participant_label} \
--fs-license-file ${freesurfer_file} \
--nthreads ${max_cores_cpu} \
--stop-on-first-crash \
--mem-mb ${max_mem_mb} \
-v \
-w ${workdirpath} \
--dummy-scans 3 \
--fs-no-reconall
Version:
Tried on both v20.2.7 and v23.1.4
Environment (Docker, Singularity, custom installation):
Docker v4.21.1 with 8 CPU cores and 27 GB RAM assigned.
Data formatted according to a validatable standard? Please provide the output of the validator:
Data is Bids valid.
Steven
August 31, 2023, 12:47pm
2
Hi @tiborst ,
You can try Brainlife.io to parallelize processing over the cloud.
Best,
Steven
tiborst:
M1
opened 02:57AM - 27 Jun 21 UTC
closed 02:23PM - 04 Jul 21 UTC
question
<!--
Before submitting a question, please search fMRIPrep's GitHub issues and h… ttps://neurostars.org
For your question, include the following:
------------------------
What are you trying to accomplish?
What have you tried?
-->
I was trying to use fmriprep on my M1 chip Mac Mini with Docker Wrapper. After I typed in the command in terminal, it started to test BIDS compatibility. It went well till saying 'Slic-timing correction will be included', then error messages pop up.
I wonder if it's a M1 chip issue or I did something wrong. I actually successfully did the same preprocessing using fmriprep on another Windows 10 Laptop.
Any help is appreciated.
Below is my command and the error messages:
```
(base) yuqianni@Yuqians-Mac-mini ~ % fmriprep-docker /Users/yuqianni/Desktop/affective_video_raw_data /Users/yuqianni/Desktop/affective_video_preprocessing participant --participant-label 02 --fs-license-file /Users/yuqianni/Freesurfer/freesurfer.txt --fd-spike-threshold 0.5 --dvars-spike-threshold 1.5
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Warning: <8GB of RAM is available within your Docker environment.
Some parts of fMRIPrep may fail to complete.
Continue anyway? [y/N]y
RUNNING: docker run --rm -e DOCKER_VERSION_8395080871=20.10.7 -it -v /Users/yuqianni/Freesurfer/freesurfer.txt:/opt/freesurfer/license.txt:ro -v /Users/yuqianni/Desktop/affective_video_raw_data:/data:ro -v /Users/yuqianni/Desktop/affective_video_preprocessing:/out nipreps/fmriprep:20.2.1 /data /out participant --participant-label 02 --fd-spike-threshold 0.5 --dvars-spike-threshold 1.5
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/validation.py:46: UserWarning: The ability to pass arguments to BIDSLayout that control indexing is likely to be removed in future; possibly as early as PyBIDS 0.14. This includes the `config_filename`, `ignore`, `force_index`, and `index_metadata` arguments. The recommended usage pattern is to initialize a new BIDSLayoutIndexer with these arguments, and pass it to the BIDSLayout via the `indexer` argument.
warnings.warn("The ability to pass arguments to BIDSLayout that control "
bids-validator@1.4.0
This dataset appears to be BIDS compatible.
Summary: Available Tasks: Available Modalities:
56 Files, 2.77GB Functional localizer T1w
11 - Subjects Passive Viewing bold
1 - Session
If you have any questions, please post on https://neurostars.org/tags/bids.
210627-02:47:56,244 nipype.workflow IMPORTANT:
Running fMRIPREP version 20.2.1:
* BIDS dataset path: /data.
* Participant list: ['02'].
* Run identifier: 20210627-024727_75af46ec-dd70-4569-b17a-3f5aa343f084.
* Output spaces: MNI152NLin2009cAsym:res-native.
* Pre-run FreeSurfer's SUBJECTS_DIR: /out/freesurfer.
210627-02:47:58,315 nipype.workflow INFO:
No single-band-reference found for sub-02_task-functionallocalizer_run-01_bold.nii.gz.
210627-02:47:59,929 nipype.workflow IMPORTANT:
Slice-timing correction will be included.
210627-02:48:00,252 nipype.workflow INFO:
No single-band-reference found for sub-02_task-view_run-01_bold.nii.gz.
210627-02:48:01,632 nipype.workflow IMPORTANT:
Slice-timing correction will be included.
210627-02:48:01,953 nipype.workflow INFO:
No single-band-reference found for sub-02_task-view_run-02_bold.nii.gz.
210627-02:48:03,337 nipype.workflow IMPORTANT:
Slice-timing correction will be included.
Process Process-2:
Traceback (most recent call last):
File "/usr/local/miniconda/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/local/miniconda/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/workflow.py", line 82, in build_workflow
retval["workflow"] = init_fmriprep_wf()
File "<string>", line 2, in __setitem__
File "/usr/local/miniconda/lib/python3.7/multiprocessing/managers.py", line 796, in _callmethod
kind, result = conn.recv()
File "/usr/local/miniconda/lib/python3.7/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/usr/local/miniconda/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/usr/local/miniconda/lib/python3.7/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
Traceback (most recent call last):
File "/usr/local/miniconda/lib/python3.7/multiprocessing/managers.py", line 788, in _callmethod
conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/miniconda/bin/fmriprep", line 10, in <module>
sys.exit(main())
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 45, in main
fmriprep_wf = retval.get("workflow", None)
File "<string>", line 2, in get
File "/usr/local/miniconda/lib/python3.7/multiprocessing/managers.py", line 792, in _callmethod
self._connect()
File "/usr/local/miniconda/lib/python3.7/multiprocessing/managers.py", line 779, in _connect
conn = self._Client(self._token.address, authkey=self._authkey)
File "/usr/local/miniconda/lib/python3.7/multiprocessing/connection.py", line 492, in Client
c = SocketClient(address)
File "/usr/local/miniconda/lib/python3.7/multiprocessing/connection.py", line 619, in SocketClient
s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
fMRIPrep: Please report errors to https://github.com/nipreps/fmriprep/issues
```
This just isn’t going to work without someone contributing a Docker image and build process for the M1 architecture. You may have some success installing fMRIPrep in a conda environment instead of Docker:
$ git clone https://github.com/nipreps/fmriprep.git
$ cd fmriprep
$ git checkout $VERSION
$ conda env create -f env.yml
$ conda activate fmriprep
$ pip install -r requirements.txt .
If you inspect the Dockerfile
, you should be able to see all of the other tools that need installing, such as AFNI, FreeSurfer, Connectome Workbench, etc. Note that any of these tools might also not be compiled for the M1/M2 architecture, so I can’t guarantee any performance.
We also can only give limited support for “bare-metal” installations, so taking this route is accepting some responsibility for figuring things out. I definitely cannot help with reproducing bugs on a Mac.
stebo85
September 5, 2023, 12:48am
4
Dear @tiborst ,
I am currently working on brining our www.Neurodesk.org project to Apple Silicon and one thing I found with respect to performance is that activating Rosetta for x86 images brings a 5 fold speedup in my tests and I haven’t seen a downside yet:
You find this under “Features in development”:
I hope that helps
Kind regards
Steffen
1 Like