External Email - Use Caution        

Not a developer, but this is something that comes up frequently in most analysis situations.

For qsub, you should be able to just make separate scripts for each subject and submit them all at once and let the scheduler node handle the rest. 

E.g. If you have sub1.sh, sub2.sh,....subn.sh as the submission scripts you can just submit them all:

for j in sub*.sh; do
qsub ${j}
done

You may consider writing a wrapper that will create all the subscripts based on an input...e.g.:


SUBNAME=$1

Echo "#!/bin/bash
#$ -cwd
#$ -o /data/holly-host/UserName/logs/
#$ -j y
#$ -S /bin/bash
#$ -N reconall

export FREESURFER_HOME=/usr/local/freesurfer/8.2.0-1
export FS_LICENSE=/usr/local/freesurfer/8.2.0-1/license.txt
export SUBJECTS_DIR=/data/holly-host/hliu/freesurfer_subjects

source $FREESURFER_HOME/SetUpFreeSurfer.sh

mkdir -p $SUBJECTS_DIR

env | grep -E "FREESURFER|FS_LICENSE|SUBJECTS_DIR"

recon-all -all -i /data/holly-host/UserName/anat/${SUBNAME}_t1w.nii -s sub-01
SegmentAAN.sh sub-01

" > ${SUBNAME}.sh





From: freesurfer-request@nmr.mgh.harvard.edu <freesurfer-request@nmr.mgh.harvard.edu>
Sent: Tuesday, June 9, 2026 9:36 AM
To: freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu>
Subject: [EXTERNAL] Freesurfer Digest, Vol 268, Issue 8
 
Caution: This message came from an external sender outside your organization.




Send Freesurfer mailing list submissions to
        freesurfer@nmr.mgh.harvard.edu

To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
        freesurfer-request@nmr.mgh.harvard.edu

You can reach the person managing the list at
        freesurfer-owner@nmr.mgh.harvard.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Freesurfer digest..."

Today's Topics:

   1. Re: Recon-all for multiple subjects on parallel (Huaiyu Liu)


----------------------------------------------------------------------

Message: 1
Date: Tue, 9 Jun 2026 14:35:49 +0000
From: Huaiyu Liu <huaiyu.liu@ucl.ac.uk>
Subject: [Freesurfer] Re: Recon-all for multiple subjects on parallel
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Message-ID: <DB8PR01MB5899E8997D209D3F51B01799DB1D2@DB8PR01MB5899.eurp
        rd01.prod.exchangelabs.com>
Content-Type: multipart/alternative;    boundary="_000_DB8PR01MB5899E8
        997D209D3F51B01799DB1D2DB8PR01MB5899eurp_"

        External Email - Use Caution

Dear FS Developers,

I recently asked a question about how to run recon-all in parallel for multiple subjects (like 4-8).
Could someone give me some clues, I would be really apperciate.

Best,
Huaiyu
________________________________
From: Huaiyu Liu <huaiyu.liu@ucl.ac.uk>
Sent: Thursday, May 28, 2026 18:21
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Subject: Recon-all for multiple subjects on parallel

Dear FreeSurfer Developers,

I am using the following code on my department's HPC to (1) reconstruct a single participant’s T1w image and (2) perform brainstem segmentation.
The code works well, but I have 40 participants in total. Hence, I wonder how I can run recon-all and brainstem segmentation for multiple subjects in parallel.
Could you tell me the code?

1) FreeSurfer version: --freesurfer-linux 8.2.0-1 on my department's HPC (high-performance cluster)

2) My shell script for recon-all and brainstem segmentation for single subject:
#!/bin/bash
#$ -cwd
#$ -o /data/holly-host/UserName/logs/
#$ -j y
#$ -S /bin/bash
#$ -N reconall

export FREESURFER_HOME=/usr/local/freesurfer/8.2.0-1
export FS_LICENSE=/usr/local/freesurfer/8.2.0-1/license.txt
export SUBJECTS_DIR=/data/holly-host/hliu/freesurfer_subjects

source $FREESURFER_HOME/SetUpFreeSurfer.sh

mkdir -p $SUBJECTS_DIR

env | grep -E "FREESURFER|FS_LICENSE|SUBJECTS_DIR"

recon-all -all -i /data/holly-host/UserName/anat/sub-01_t1w.nii -s sub-01
SegmentAAN.sh sub-01

3) My command for submit the jobs to the cluster with 32 GB of RAM request

qsub -l vf=32G -l h_vmem=32G reconall

Thank you very much for your time and consideration, I look forward to hearing from you.

Best,
Huaiyu
_________________________________________
Huaiyu Liu (Ted)
Postdoctoral Research Fellow
Department of Imaging Neuroscience, Functional Imaging Laboratory
University College London
12 Queen Square, London WC1N 3AR






-------------- next part --------------
A message part incompatible with plain text digests has been removed ...
Name: not available
Type: text/html
Size: 12204 bytes
Desc: not available

------------------------------

Subject: Digest Footer

_______________________________________________
Freesurfer mailing list -- freesurfer@nmr.mgh.harvard.edu
To unsubscribe send an email to freesurfer-leave@nmr.mgh.harvard.edu
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman3%2Flists%2Ffreesurfer%40nmr.mgh.harvard.edu%2F&data=05%7C02%7CQFinn%40houstonmethodist.org%7Cb348baab7da346dfbfed08dec6347a83%7C7218dbf5328642dc9b7ec61ab35f8f3f%7C0%7C0%7C639166125867281955%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=B53iB6xixHbFj3WgOJ%2B5z58Y0CsKPQ5xyj2OJcWoDUQ%3D&reserved=0


------------------------------

End of Freesurfer Digest, Vol 268, Issue 8
******************************************
The information in this e-mail is intended only for the person to whom it is addressed.  If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline&data=05%7C02%7CQFinn%40houstonmethodist.org%7Cb348baab7da346dfbfed08dec6347a83%7C7218dbf5328642dc9b7ec61ab35f8f3f%7C0%7C0%7C639166125867335188%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=h3bJQMDPNo0lF4oFdtWWlQ5M8Eq00CsjCVl8tDEQaJY%3D&reserved=0 <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline&data=05%7C02%7CQFinn%40houstonmethodist.org%7Cb348baab7da346dfbfed08dec6347a83%7C7218dbf5328642dc9b7ec61ab35f8f3f%7C0%7C0%7C639166125867379567%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=1y%2F%2BJJgnxk%2FBOaf15LHZJ5X1qYRvqTrcp2QcuPkj2KU%3D&reserved=0> .


Houston Methodist. Leading Medicine.


Houston Methodist Hospital has been named the Best Hospital in Texas for patient care and quality for the 14th year in a row by U.S. News & World Report. We are proud to be a top-ranked hospital in the country, and nationally ranked in 10 specialties. For more than 100 years, we have been honored to provide you with the highest quality care possible. That’s the difference between practicing medicine and leading it. For you.

houstonmethodist.org
x.com/MethodistHosp
facebook.com/HoustonMethodist

***CONFIDENTIALITY NOTICE*** This e-mail is the property of Houston Methodist and/or its relevant affiliates and may contain restricted and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender and delete all copies of the message. Thank you.