qsiprep icon indicating copy to clipboard operation
qsiprep copied to clipboard

Allow `topup` to use multiple threads

Open psadil opened this issue 1 year ago • 3 comments

Summary

topup can be started with multiple threads

❯ topup --help 2>&1| grep threads
	--nthr		Number of threads to use (cannot be greater than numbers of hardware cores), default 1

Multiple threads can produce decent speedups, but topup is currently limited to just 1 thread (around here).

Additional details

nipype doesn't have an option relating to number of threads, and it looks like the number of threads is not set in the sdcflows implementation.

Next steps

To work around the nipype implementation, one could use the args option, as in, for example

topup.inputs.args = (f"--nthr {omp_nthreads}")

Another option would be to define a new subclass of nipype.interfaces.fsl.epi.TOPUP that has a num_threads inputspec.

This seems like this would be relatively simple, so I'd be happy to submit a pull request.

psadil avatar Mar 25 '24 15:03 psadil

this is a huge deal. How long has this option been available?! If you're interested in starting a PR I would greatly appreciate it. If not, I'm likely to try to get this into the next release

mattcieslak avatar Mar 26 '24 16:03 mattcieslak

I'm not sure how long it's been around. I think that I could draft a pull request later this later this week/weekend. Would that fit the timeline for the release?

Thinking more about this, another tricky part could involve memory consumption--would want to double-check that it doesn't explode in unexpected ways.

psadil avatar Mar 27 '24 02:03 psadil

Looks like threading was introduced in 6.0.6. The qsiprep docker image currently uses 6.0.5, so use of multithreaded topup will need to wait until FSL is updated in the container.

psadil avatar Mar 28 '24 13:03 psadil