Skip to content

Instantly share code, notes, and snippets.

@razoumov
Last active September 21, 2024 21:25
Show Gist options
  • Select an option

  • Save razoumov/03cfc54cc388675389bb4343beb8a6b1 to your computer and use it in GitHub Desktop.

Select an option

Save razoumov/03cfc54cc388675389bb4343beb8a6b1 to your computer and use it in GitHub Desktop.
Installing Chapel with GPU support on a Linux computer with an NVIDIA GPU

First, make sure you have installed the right NVIDIA drivers along with the CUDA development kit. The details can vary depending on your Linux distribution and exact hardware. With the correct NVIDIA drivers and software, nvidia-smi on the command line should detect your GPU.

Next you need to download and compile Chapel. These steps below worked for me on a VM with AlmaLinux 9.4, but I imagine they should be fairly similar on other Linux distributions.

wget https://github.com/chapel-lang/chapel/releases/download/2.1.0/chapel-2.1.0.tar.gz
tar xvfz chapel-2.1.0.tar.gz
cd chapel-2.1.0
source util/setchplenv.bash
export CHPL_LLVM=bundled
export CHPL_COMM=none
export CHPL_TARGET_CPU=none
export CHPL_LOCALE_MODEL=gpu
export CHPL_GPU=nvidia
export CHPL_CUDA_PATH=/usr/local/cuda-12.4.  # specify your CUDA installation path
mkdir -p ~/chapel
./configure --chpl-home=$HOME/chapel   # inspect the settings
make -j4
make install

If successful, you should be able to use single-locale Chapel to compile and run a test code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment