External Email - Use Caution        


You could try setting the environment variable OMP_NUM_THREADS, e.g., in zsh/bash shell,  on a machine with 4 performance cores,

$ export OMP_NUM_THREADS=4

The test command I ran did not take long to run, but it looks like it used 3 of the 4 performance cores on an M1 Mac with OMP_NUM_THREADS=4.  See attached screenshot, mri_coreg_omp_num_threads.png

- R.



On Dec 3, 2024, at 17:06, Hemond, Christopher <Christopher.Hemond@umassmemorial.org> wrote:

        External Email - Use Caution        


Dear Doug and team,
Thanks very much for your support.  I’ve tried multiple different thread numbers between 1 and 10 with no effect.  I can successfully use multithreading to accelerate other applications like mri_synthseg.
I tried adding combinations of both ‘fs_time’ as well as ‘--debug’  to the command, but I do not see any difference in final output, nor any CPU load/usage readout at the end of the command….  Just the usual “mri_coreg RunTimeSec <X> sec”.  
Could this be related to the ARM processor in Mac?  It seems to cause many other issues, especially with some SPM commands including processing specification.
Many thanks,
Chris
 
 

From: Hemond, Christopher <Christopher.Hemond@umassmemorial.org>
Date: Monday, November 25, 2024 at 4:32
PM
To: freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu>
Subject: mri_coreg threads parallel processing clarification

Dear experts,
Thanks in advance for any help you can provide.  I’m using “mri_coreg” and trying to accelerate it with the “--threads” (and/or “--nthreads”) flags. However in the subsequent command feedback it looks like it is still using just one thread (see output below, “nthreads 1”; and also it is no faster).  Am I doing something obviously wrong?  There are no errors and it executes successfully…   Not sure if relevant but I’m using this for nifty (.nii.gz) files, my command is:
“mri_coreg --ref <path/to/ref.nii.gz> --mov <path/to/mov.nii.gz> --reg <path/to/registration.lta> --threads 10”
 
I’m on MacOS running a recent dev download (freesurfer-macOS-darwin_arm64-dev-20241011), but I’ve tried it on 7.4.1 with no success either.
 
 
INFO: using NIfTI-1 sform (sform_code=1)
Setting cras translation parameters to align volume centers
Init matrix params -0.4553 -6.3123 39.4428  0.0000  0.0000  0.0000  1.0000  1.0000  1.0000  0.0000  0.0000  0.0000 
Initial Matrix (RAS2RAS)
 1.00000   0.00000   0.00000   0.45535;
 0.00000   1.00000   0.00000   6.31235;
 0.00000   0.00000   1.00000  -39.44280;
 0.00000   0.00000   0.00000   1.00000;
Initial parameters to be opt -0.4553 -6.3123 39.4428  0.0000  0.0000  0.0000 
Creating random numbers for coordinate dithering
Performing intensity dithering
Performing intensity dithering on mov with computed dither
Separation list (2):  4  2   min = 2
DoSmoothing 1
DoCoordDither 1
DoIntensityDither 1
nitersmax 4
ftol 1.000e-07
linmintol 1.000e-03
SatPct 99.990000
Hist FWHM 7.000000 7.000000
nthreads 1
movsat = 3917.0000
mov gstd 0.9539 0.9539 0.7422
Smoothing mov
 
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, transmission, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer