External Email - Use Caution        

Seems like you're running out of memory when using more than 1 threads. Can you allocate more memory to the VM?
You can also try running Synthseg without the --robust flag?

From: freesurfer-bounces@nmr.mgh.harvard.edu <freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of Giulio Siracusano <giuliosiracusano@gmail.com>
Sent: Monday, May 1, 2023 4:16 PM
To: freesurfer@nmr.mgh.harvard.edu <freesurfer@nmr.mgh.harvard.edu>
Subject: [Freesurfer] SynthSeg terminates with 'std::bad_alloc' error when using --threads option (>1)
 

        External Email - Use Caution        

Hello experts,
I've installed FreeSurfer 7.3.2 and used SynthSeg with --parc --robust and --threads options. The Virtual Machine I use has 4 cores and 20GB of ram, running Ubuntu 18.04.
I've executed the same command without --threads option and it works perfectly, even running 4 different subjects at the time.
As usual, I've used as input NIFTI archives of raw scans (one .nii file per subject)
But, If I run one single subject with SynthSeg and I use --threads option >1, it terminates
with the error underneath:

SynthSeg-robust 2.0
using 4 threads
predicting 1/1
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

I've tested with 4, 3, 2 threads and it doesn't work.
I've also checked for memory allocation and the maximum it reaches is approx 50%, before terminating.
I use tensorflow-cpu==2.12.0

Any help is appreciated

Regards

GS