Contents
For a full package listing, check Arch's CUDA package contents as the full list is too expansive to list here.
This is the CUDA proprietary toolkit, providing tools for running code on Maxwell through Blackwell NVIDIA GPUs via the r580 NVIDIA driver. This is NVIDIA's approach for hardware acceleration.
The NVIDIA driver version listed in the runfile name is the minimum NVIDIA driver version required.
The download size is around 4G, 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.2 && ln -sfv cuda-13.0.2 /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.2_580.95.05_linux.run \
--target cuda_13.0.2_580.95.05_linux \
--noexec
pushd cuda_13.0.2_580.95.05_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.2
as_root cp EULA.txt /opt/cuda-13.0.2
rm version.json EULA.txt
as_root mkdir -p /opt/cuda-13.0.2/bin
for lib in *; do
as_root cp -vR $lib/* /opt/cuda-13.0.2
rm -rf $lib
done
as_root ln -svf lib64 /opt/cuda-13.0.2/lib
for mf in $(find /opt/cuda-13.0.2 -name Makefile); do
as_root sed -i "s|/usr/local/cuda|/opt/cuda-13.0.2|g" "$mf"
done
popd
rm -rf cuda_13.0.2_580.95.05_linux
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.2/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.