Installing CUDA without sudo
Brain node is equipped with a graphic card (NVIDIA GeForce RTX 4060) for GPU computing. In order to use it, each user has to install their own version of CUDA in the their own home directory. Below, it is described one option for performing such installation, for details refer to https://docs.nvidia.com/cuda/cuda-installation-guide-linux/
- Pre-checks:
-
lspci | grep -i nvidia
- Outputs:
- 83:00.0 VGA compatible controller: NVIDIA Corporation Device 2808 (rev a1)
83:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1) - If empty refer to doc above.
-
hostnamectl
To verify the supported version of Linux. This should be relevant when installing newer versions of CUDA. -
gcc --version
If error you need to install the development tools from your Linux distribution or obtain a version ofgccand its accompanying toolchain.
- Installation:
- We will perform a run file installation. You can select the version you want from the following web: https://developer.nvidia.com/cuda-downloads
- Selecting the correct version of the OS and installer type runfile (local), you will be provided with two lines of code to start the installation. In this step is not necessary to run with root privileges, so you can remove the sudo from the commands:
-
wget https://developer.download.nvidia.com/compute/cuda/13.0.2/local_installers/cuda_13.0.2_580.95.05_linux.run
sh cuda_13.0.2_580.95.05_linux.runError message might appear:Existing package manager installation of the driver found. It is strongly recommended that you remove this before continuing.Select continue.Accept the EULA and deselect the driver installation. Go to Options > Toolkit Options > Change Toolkit Install Path. Enter a path to your local home.Go to Options > Toolkit Options > Library install path, and do the same. Proceed with the installation.Finally, the path where you installed cuda and the libraries have to be added to your ~/.bashrc file. Edit such file adding the following lines at the end of it:export PATH=<CUDA>/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<CUDA_LIB>/lib64/ - Where
<CUDA>and<CUDA_LIB>are your local paths.
Reset your connection or run source /home/username/.bashrc, to reload the environment variables.
- Verifying the installation:
- Run
-
nvcc --version
to confirm that CUDA is installed. Also, -
nvidia-smi
should output the correct hardware information. - According to NVIDIA documentation, a reboot is required at this point, as it was the case with my installation. If any errors persist with previous commands, a reboot of the node might be indeed necessary. Request a reboot to cluster admin: Sergi Ruiz-Barragan & Andrés Arco León (andres.arco@upc.edu)
The final check is to run:
from numba import cuda
print(cuda.gpus)
If everything is correct, they should output
<Managed Device 0>
Share: