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 installIf successful, you should be able to use single-locale Chapel to compile and run a test code.