Similar to Matlab, MRtrix will, by default, spawn as many threads as it sees cores on the compute node where it's running. This will cause problems and significantly slow down the whole node. To prevent this, multi-threading should be disabled or carefully set to match the number of slots/cores assigned to your job.
As of approximately December 21, 2016, MRTrix will read the environment variable MRTRIX_NTHREADS
to globally set the number of threads it should use. By default when you login or start a new qlogin or qsub job, the CfN cluster settings assigns the SGE NSLOTS
var to MRTRIX_NTHREADS
, so that MRTrix will run with the same number of threads as the requested number of cores/slots for your job.
If for some reason (be sure about this!) you need to override the setting, you can do so in your script when you call an MRtrix command, by including the command line option -nthreads <N>
in your , where N is the number of threads.