finnlennartsson / kpum_noddi

repo for processing of DKI/NODDI data for preterm project at KPUM
0 stars 0 forks source link

Install NVIDIA CUDA on WSL #23

Closed finnlennartsson closed 1 year ago

finnlennartsson commented 1 year ago

https://developer.nvidia.com/cuda/wsl https://learn.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl

https://ubuntu.com/tutorials/enabling-gpu-acceleration-on-ubuntu-on-wsl2-with-the-nvidia-cuda-platform#2-install-the-appropriate-windows-vgpu-driver-for-wsl

finnlennartsson commented 1 year ago

The main purpose for this was to use CUDA for FSL's eddy routine. However, the new version with FSL ships with eddy_cuda10.2. So as long as CUDA 10.2 (or higher is installed), this works out of the box for WSL.

(base) finn@LaptopFinn:~$ nvidia-smi
Thu Apr 20 09:19:03 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.104      Driver Version: 528.79       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0 Off |                  N/A |
| N/A   49C    P8     4W /  35W |    514MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A        22      G   /Xwayland                       N/A      |
+-----------------------------------------------------------------------------+

See https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GPU:

CUDA/GPU acceleration Some FSL tools are CUDA-capable:

From FSL 6.0.6 onwards, the released versions of these tools have been compiled against the CUDA 10.2 Toolkit.

The toolkit is statically linked into the executable files, so all that is needed to run them is a NVIDIA GPU and CUDA driver that suppports CUDA 10.2 or newer - you do not need to install the CUDA Toolkit in order to run these tools.

If you need to run any of these tools on an older GPU which does not support CUDA 10.2, you can recompile the code against the CUDA Toolkit of your choice.