CUDA-12.8.1

Introduction to CUDA

The CUDA proprietary toolkit provides tools for running code on NVIDIA GPUs. This is otherwise known as hardware acceleration.

[Note]

Note

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.

Additional Downloads

CUDA Dependencies

Required

NVIDIA

Optional

GDB and GLU-9.0.3

Installation of CUDA

First create the installation directory and symlink as the root user:

mkdir -pv /opt/cuda-12.8.1 &&
ln -sfv cuda-12.8.1 /opt/cuda

Install CUDA by running the following command as the root user:

sh cuda_12.8.1_570.124.06_linux.run \
  --silent  \
  --toolkit \
  --toolkitpath=/opt/cuda-12.8.1

Now as the root user, allow the use of new compilers:

sed -e "/.*unsupported GNU version.*/d" \
    -e "/.*unsupported clang version.*/d" \
    -i /opt/cuda-12.8.1/targets/x86_64-linux/include/crt/host_config.h
[Important]

Important

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.

Finally, patch a header file to fix building against glibc-2.41, again as the root user:

patch -Np1 /opt/cuda-12.8.1/targets/x86_64-linux/include/crt/math_functions.h \
  -i cuda-12.8.1-glibc-2.41-1.patch

Command Explanations

--silent: This parameter is required or else this toolkit will be unable to be installed.

--toolkit: This option forces the toolkit to be installed as the NVIDIA driver is also included and will be installed otherwise, which can cause issues.

--toolkitpath=/opt/cuda-12.8.1: This parameter changes the installation path.

Configuring CUDA

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

Immediately after installation, update the current PATH for your current shell:

source /etc/profile.d/cuda.sh

Contents

For a full package listing, check Arch's CUDA package contents as the full list is too expansive to list here.