This repository contains GPU programming examples using Chapel.
Examples are in their own directories with an associated README file describing the concepts introduced very briefly alongside some links for further reading. These directories are
- 00-intro: No GPU programming here, just fundamental Chapel concepts
- 01-basics: Allocating Chapel arrays and running Chapel loops on GPU
- 02-locale:
Running the same code on the GPU and CPU using
locale
variables - 03-math-reduce: Kernels with some math operations and reductions
- 04-math-reduce-comm: Same as above, but with CPU-GPU data transfers
Here's some quick start instructions. For more detailed information, please
check out Chapel
documentation and the GPU
technical note. The following
assumes that either nvcc
or hipcc
exists and accessible in the terminal
session.
- Download the latest Chapel release
- Untar and go into the directory
$ tar xzvf chapel-X.Y.Z.tar.gz
$ cd chapel-X.Y.Z
- Set Chapel environment with GPU support enabled
$ source util/setchplenv.bash
$ export CHPL_LOCALE_MODEL=gpu # otherwise, GPU support is not enabled
- Build Chapel
$ make
- Compile and run examples
$ cd <path to this repo>
$ cd 00-intro
$ chpl 00-intro.chpl
$ ./00-intro
NOTE: If you expand on these examples and want to run some performance
analysis, make sure to use --fast
when compiling. e.g.
$ chpl --fast 00-intro.chpl
- GPU Programming in Chapel blog series
- GPU Technote
- Vendor-Neutral GPU Programming in
Chapel,
an HPE Developer community talk
- or a playlist of short live demos contained in it
- A recorded live demo session going over similar examples