Parallel programming in Chapel
November 9th and 16th, 2023
10:00am - noon Pacific Time
This course is a general introduction to the main principles of parallel coding using the Chapel programming language to illustrate the basic concepts and ideas. Chapel is a relatively new language for both shared and distributed memory programming, with easy-to-use, high-level abstractions for both task and data parallelism, making it ideal for a novice HPC user to learn parallel programming. Chapel is incredibly intuitive, striving to merge the ease-of-use of Python and the performance of traditional compiled languages such as C and Fortran. Parallel constructs that typically take tens of lines of MPI code can be expressed in only a few lines of Chapel code. Chapel is open source and can run on any Unix-like operating system, with hardware support from laptops to large HPC systems.
Instructors: Alex Razoumov (SFU)
Prerequisites: basic understanding of HPC at the introductory level (how to submit jobs with Slurm scheduler) and basic knowledge of the Linux command line.
Software: For the hands-on, we will use Chapel on our training cluster. To access the training cluster, you will
need a remote secure shell (SSH) client installed on your computer. On Windows we recommend
the free Home Edition of MobaXterm. On Mac and Linux computers SSH is
usually pre-installed (try typing ssh
in a terminal to make sure it is there). We will provide guest accounts to all
participants. No need to install Chapel on your computer.
Part 1: basic language features
Introduction to Chapel
Basic syntax and variables
Ranges and arrays
Conditional statements
Getting started with loops
Using command-line arguments
Measuring code performance
Part 2: task parallelism
Intro to parallel computing
Fire-and-forget tasks
Synchronization of threads
Task-parallelizing the heat transfer solver
Part 3: data parallelism
Single-locale data parallelism
Parallelizing the Julia set problem
Multi-locale Chapel
Domains and data parallelism
Heat transfer solver on distributed domains
Solutions
You can find the solutions here.
Links
- Chapel homepage
- What is Chapel? (HPE Developer Portal)
- LinuxCon 2023 Introducing Chapel slides (PDF)
- Getting started guide for Python programmers
- Learn X=Chapel in Y minutes
- Chapel on StackOverflow
- Watch Chapel: Productive, Multiresolution Parallel Programming talk by Brad Chamberlain
- WestGrid’s April 2019 webinar Working with distributed unstructured data in Chapel
- WestGrid’s March 2020 webinar Working with data files and external C libraries in Chapel discusses writing arrays to NetCDF and HDF5 files from Chapel