This is very specific to totalsegmentator, please @wasserth read the following
Currently, Total Segmentator uses torch that can use a nvidia card, if the user doesn’t have it it default to slow CPU. But there is a marvelous package GitHub - zainsharief/torchvulkan: Cross-Platform Vulkan Backend for PyTorch · GitHub that I have tested it works really good, that adds Vulkan computation capabilities to torch, ENABLING ALL GPUs, not just nvidia. Two changes required:
import torchvulkan
device = torch.device("vulkan" if torchvulkan.is_available() else "cpu")
That’s it, it would run a lot faster in AMD cards for instance, it also allows the use of MoltenVk in macos.
Hi Alex, it looks good. I have no skills in working with the terminal; thus, practically, what would I do to install Vulkan on my Mac. I went to GitHub, but I have no clue what to do now. Some of your guidance would be helpful.Best regards.
I have installed iterm2, as required.
I have a Mac mini with a M2 pro chip, thus ,I take, silicone
I tried both lines which you sent, and then I got those answers
Sorry, I did the second step by copying a line of code at the Homebrew address, which seems to have worked quite well. For step 3 I went to Molten VK but I don’t know what to do next. Sorry
I am another novice - I managed to install MoltenVK via brew terminal. If I follow the instructions from the project website “pip install torchvulkan” I get the error “torchvulkan not found” either in terminal (“brew install torchvulkan”) or slicer python console (“pip install torchvulkan”) or (import torchvulkan
device = torch.device(“vulkan” if torchvulkan.is_available() else “cpu”))
hello, you need torch>=2.15 for torchvulkan to be available
Also, torchvulkan should be accesible first from your iterm2 console, slicer is still not ready for it yet
Thanks, I installed Homebrew through .vtk, then ran the line of code ,which you sent previously. I ran 3DSlicer; total segmentator, but could not find a difference with its usual processing time…I have a Mac mini, chio M2 pro, 16GBmemory, Mac Os Tahoe
torchvulkan comes with moltenvk shipped, so no need to install that
@Philipp_G It seems like you might have an Intel Mac - which unfortunately torchvulkan is unable to support due to the lack of pytorch support on them.
the correct backend order should be cuda/mps → vulkan → CPU since we currently have parity performance with mps which is more stable, hence why @philippepellerin didn’t notice much of a difference.
I downloaded the latest release of Slicer: 2026.11.09, and TotalSegmentator runs much faster. I don’t know whether it is because I previously installed Homebrew, since I can’t see any specific message when I launch the task…
I have made a lot of tests but I can’t get MPS to work at all
# MPS (Apple GPU) must not be used: 3D convolutions (aten::conv3d / convtranspose3d), which nnUNet
# relies on, are not implemented on the MPS backend and fail with a hard error
# ("RuntimeError: Conv3D is not supported on MPS") that PYTORCH_ENABLE_MPS_FALLBACK cannot fix.
# Therefore the CPU is used on Macs (unless Vulkan is usable), even when an MPS device is available.
# Tracking: pytorch/pytorch#130256 (ConvTranspose3D FP32) was closed May 2026 as supported in
# torch>=2.8 (via #154696/#145366); FP16/BF16 ConvTranspose3D is still unsupported (#160739, PR #188732
# open) and aten::slow_conv3d_forward (#117949) is still open. Re-enable only after testing
# "--device mps" end-to-end with the Slicer PyTorch version in FP32 (no AMP/autocast).
# Set this to True to try the MPS device again. PYTORCH_ENABLE_MPS_FALLBACK=1 is set for the
# TotalSegmentator process when the MPS device is used.
ENABLE_MPS = False