Skip to content

Different stats output with different thread number allocation #354

Description

@pavgreen9

Question/Support Request

I was running fastsurfer on a single participant across different thread counts in docker, however the result was unexpected

Depending on the CPU allocation, the time taken to process the image and the stats output was different. This applied across different machines and the same machine.

On our current main machine when we specify 16 threads (which makes use of the whole 32 threads during parallel processing), the time taken to preprocess the image takes 0.26 hours. Surprisingly, however, when using 4 and 8 threads, the time taken was about the same - 0.25 to 0.26 hours. However, once we over allocated our available threads by double (32), the processing time took 1.2 hours. Slightly confused as to why this would happen as it is expected that fastsurfer would allocate the maximum available threads only. Similarly, on our past machine, when we specify 4 threads (on an 8 thread machine), the time taken to preprocess the image is roughly 40-50 minutes. While allocating 8 threads (which overallocates 16 during parallel processing) increases the processing time to 1.5 hours.

Our main concern is with regards to Fastsurfer stats output. The output across different threads were different in the volume segmentation, and surface area and thickness calculation. In terms of volume segmentation, differences were around a few hundred mm^3 depending on the thread count used on the same machine and also the same thread count across different machines. The surface area calculations differ by 10-50 mm^2, while thickness would differ by a few 0.x mm depending on the thread count.

The reason I was testing this out was considering whether I should run multiple docker containers at once whilst limiting each container's CPU usage, which would allow us to preprocess multiple participants at once. However, this usually resulted in a (core dumped) error, and considering the differing stats outcome, I'm not sure if this is a good approach.

My question is whether

  • This is expected behavior as the output should be the same regardless of thread count allocation
  • Whether this difference is huge enough to warrant preprocessing with an "ideal" thread count
  • Is an overallocation of threads a big issue to the output? and why does the processing time differ so much
  • Are there are other ways of running multiple participants concurrently using docker

Environment

  • FastSurfer Version: 2.1.1 on Docker
  • OS: Ubuntu 22.04
  • CPU: i9 13900k
  • GPU: RTX 4090

Execution

docker run --gpus all
-v /home/chan/Documents/MRI/Participants/${participant}:/data
-v /home/chan/Documents/MRI/Output:/output
-v /home/chan/Documents/MRI:/fs_license
--rm --user $(id -u):$(id -g) deepmi/fastsurfer:latest
--fs_license /fs_license/license.txt
--t1 /data/${participant}.nii
--sid ${participant} --sd /output
--parallel
--threads 16
--batch 16
--vox_size 1

Threads tested on 1, 4, 8, 16, 20, 24, and 32

The images we are running on are anisotropic images (5x.5x1.0) which are downsamples to 1mm3 using fastsurfer's vox_size flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions