Contents
For a full package listing, check Arch's CUDA package contents as the full list is too expansive to list here.
The CUDA proprietary toolkit provides tools for running code on NVIDIA GPUs. This is otherwise known as hardware acceleration.
The NVIDIA driver version listed in the runfile name is the minimum NVIDIA driver version required. You must install an older version of CUDA if you cannot install a newer driver version.
The download size is over 5G, so you should consider if and when you will want to download this runfile. For this reason, it is not recommended to download it when using limited hotspot data. Its size can largely be attributed to containing compilers as well as the NVIDIA driver. The driver only accounts for 10% of the runfile's size.
First create the installation directory and symlink as the
root
user:
mkdir -pv /opt/cuda-13.0.0 && ln -sfv cuda-13.0.0 /opt/cuda
When installing multiple packages in a script, the installation needs to be done as the root user. There are three general options that can be used to do this:
Run the entire script as the root user (not recommended).
Use the sudo command from the sudo package.
Use su -c "command arguments" (quotes required) which will ask for the root password for every iteration of the loop.
One way to handle this situation is to create a short bash function that automatically selects the appropriate method. Once the command is set in the environment, it does not need to be set again.
as_root() { if [ $EUID = 0 ]; then $* elif [ -x /usr/bin/sudo ]; then sudo $* else su -c \\"$*\\" fi } export -f as_root
Start a subshell that will exit on an error:
bash -e
Install CUDA by running the following commands:
sh cuda_13.0.0_580.65.06_linux.run \ --target cuda_13.0.0_580.65.06_linux \ --noexec pushd cuda_13.0.0_580.65.06_linux/builds rm -rf cuda_nsight cuda_sanitizer_api nsight_{compute,systems} rm -rvf bin integration NVIDIA*.run as_root cp version.json /opt/cuda-13.0.0 as_root cp EULA.txt /opt/cuda-13.0.0 rm version.json EULA.txt as_root mkdir -p /opt/cuda-13.0.0/bin for lib in *; do as_root cp -vR $lib/* /opt/cuda-13.0.0 rm -rf $lib done as_root ln -svf lib64 /opt/cuda-13.0.0/lib for mf in $(find /opt/cuda-13.0.0 -name Makefile); do as_root sed -i "s|/usr/local/cuda|/opt/cuda-13.0.0|g" "$mf" done popd rm -rf cuda_13.0.0_580.65.06_linux
The above instructions extract the runfile and installs components manually. In the past, this was not needed. However, once cuda_installer failed to load as it relied on an older libxml2 ABI, this process became the preferred solution. It will remain as it allows for more control, despite being a more complicated solution.
Now exit the subshell process:
exit
As the root
user, allow the use of
new compilers:
sed -e "/.*unsupported GNU version.*/d" \ -e "/.*unsupported clang version.*/d" \ -i /opt/cuda-13.0.0/targets/x86_64-linux/include/crt/host_config.h
This technically is not supported and there may be compilation errors in other packages as a result. However, it's a better compromise than installing older compilers just for one package. This package is still being developed but takes a long time to adapt to newer software.
--target
: This parameter
specifies the extraction directory.
--noexec
: This parameter
does ensures the toolkit does not get triggered for installation.
Ensure the libraries are cached as the root
user:
cat > /etc/ld.so.conf.d/cuda.conf << EOF &&
/opt/cuda/lib64
/opt/cuda/nvvm/lib64
/opt/cuda/extras/CUPTI/lib64
EOF
ldconfig
Now in order to use the toolkit, it needs to be included in the path.
As the root
user, create the
profile (dependent on The
Bash Shell Startup Files) for CUDA:
cat > /etc/profile.d/cuda.sh << "EOF"
# Begin /etc/profile.d/cuda.sh
pathprepend /opt/cuda/bin PATH
# End /etc/profile.d/cuda.sh
EOF
Now source the main profile:
source /etc/profile
For a full package listing, check Arch's CUDA package contents as the full list is too expansive to list here.