Skip to content

Commit 5ab5fd5

Browse files
committed
added WSL+CUDA documentation
1 parent 431c08f commit 5ab5fd5

File tree

2 files changed

+110
-1
lines changed

2 files changed

+110
-1
lines changed

docs/guide/installation.dox

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ On the other hand, HPC library building system [Spack](https://spack.readthedocs
105105

106106
### WINDOWS
107107

108-
On windows the installation of the HILA preprocessor dependencies and HILA application dependencies are untested. For this reason the best option is to use the available [docker](#docker) container. One can also opt to use WSL, in this case see LINUX installation instructions.
108+
On windows the installation of the HILA preprocessor dependencies and HILA application dependencies are untested. For this reason the best option is to use the available [docker](#docker) container.
109+
110+
One can also opt to use WSL, which is compatible with CUDA. In this case, see guide \subpage wsl_installation
109111

110112

111113
### HPC{#HPC}

docs/guide/wsl_cuda_installation.dox

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
3+
\page wsl_installation Installing HILA on WSL
4+
5+
This section covers how to set up HILA on Windows using WSL, with specific instructions for CUDA configuration.
6+
7+
# Table of contents
8+
9+
1. [WSL Setup](#wsl-setup)
10+
2. [HILA Dependencies](#hila-dependencies)
11+
3. [CUDA Installation](#cuda-installation)
12+
4. [Environment Configuration](#environment-config)
13+
14+
# WSL Setup {#wsl-setup}
15+
16+
HILA is fully compatible with Windows Subsystem for Linux (WSL). If you already have WSL installed with Ubuntu, you can skip to [HILA Dependencies](#hila-dependencies). For new WSL installations, follow your preferred WSL setup method.
17+
18+
# HILA Dependencies {#hila-dependencies}
19+
20+
Once you have a working WSL Ubuntu installation, you'll need to install the required dependencies. First, update your system:
21+
22+
~~~bash
23+
sudo apt update && sudo apt upgrade
24+
~~~
25+
26+
Install LLVM (e.g. version 15):
27+
~~~bash
28+
export LLVM_VERSION=15
29+
sudo apt-get -y install clang-$LLVM_VERSION libclang-$LLVM_VERSION-dev
30+
~~~
31+
32+
Install other required dependencies:
33+
~~~bash
34+
sudo apt install build-essential libopenmpi-dev libfftw3-dev libomp-dev
35+
~~~
36+
37+
Clone the HILA repository:
38+
~~~bash
39+
git clone https://github.com/CFT-HY/HILA
40+
~~~
41+
42+
# CUDA Installation {#cuda-installation}
43+
44+
To use HILA with CUDA on WSL, do the following:
45+
46+
1. Have the NVIDIA drivers installed on Windows.
47+
48+
2. Install CUDA Toolkit (without drivers) in WSL:
49+
~~~bash
50+
# Add CUDA repository configuration
51+
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
52+
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
53+
54+
# Download and install CUDA repository package
55+
wget https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda-repo-wsl-ubuntu-12-8-local_12.8.0-1_amd64.deb
56+
sudo dpkg -i cuda-repo-wsl-ubuntu-12-8-local_12.8.0-1_amd64.deb
57+
58+
# Copy CUDA GPG key
59+
sudo cp /var/cuda-repo-wsl-ubuntu-12-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
60+
61+
# Update package list and install CUDA toolkit
62+
sudo apt-get update
63+
sudo apt-get -y install cuda-toolkit-12-8
64+
~~~
65+
66+
__Note:__ If you are missing certain libraries after installation (e.g. cufft), run the following commands:
67+
~~~bash
68+
sudo dpkg --configure -a
69+
sudo apt-get install cuda-libraries-dev-12-8
70+
~~~
71+
72+
Afterwards, you can remove the downloaded repository package to free up space:
73+
~~~bash
74+
rm cuda-repo-wsl-ubuntu-12-8-local_12.8.0-1_amd64.deb
75+
~~~
76+
77+
# Environment Configuration {#environment-config}
78+
79+
After installing CUDA, you need to configure your environment:
80+
81+
1. Add CUDA to your system PATH:
82+
~~~bash
83+
nano ~/.bashrc
84+
~~~
85+
86+
2. Add the following lines to the end of the file:
87+
~~~bash
88+
# CUDA Toolkit paths
89+
export PATH=/usr/local/cuda-12.8/bin${PATH:+:${PATH}}
90+
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
91+
~~~
92+
93+
3. Save the file (Ctrl+O, Enter, Ctrl+X) and reload your bash configuration:
94+
~~~bash
95+
source ~/.bashrc
96+
~~~
97+
98+
4. Verify the installation by running:
99+
~~~bash
100+
nvcc --version
101+
~~~
102+
103+
This should display the CUDA compiler version if everything is set up correctly.
104+
105+
You can now compile HILA applications with CUDA by defining `ARCH := cuda` in the Makefile.
106+
107+
*/

0 commit comments

Comments
 (0)