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
Når du installerer flere pakker i et skript, må installasjonen gjøres som root bruker. Det finnes tre generelle alternativer som kan brukes til å gjøre dette:
Kjør hele skriptet som root bruker (ikke anbefalt).
Bruk sudo kommandoen fra sudo pakken.
Use su -c "command arguments" (anførselstegn kreves) som vil be om root passordet for hver iterasjon av løkken.
En måte å håndtere denne situasjonen på er å lage en kort bash funksjon som automatisk velger riktig metode. Når kommandoen er satt i miljøet, trenger den ikke å settes på nytt.
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
Nå henter du hovedprofilen:
source /etc/profile
For a full package listing, check Arch's CUDA package contents as the full list is too expansive to list here.