Introduction to High-Performance Computing in Chapel: Glossary

Key Points

Introduction to Chapel
  • Chapel is a compiled language - any programs we make must be compiled with chpl.

  • The --fast flag instructs the Chapel compiler to optimise our code.

  • The -o flag tells the compiler what to name our output (otherwise it gets named a.out)

Basic syntax and variables
  • A comment is preceded with // or surrounded by /* and */`

  • All variables hold a certain type of data.

  • Using const instead of var prevents reassignment.

Ranges and arrays
  • A range is a sequence of integers.

  • An array holds a sequence of values.

  • Chapel arrays can start at any index, not just 0 or 1.

  • You can index arrays with the [] brackets.

Conditional statements
  • Conditional statements in Chapel are very similar to these in other languages.

Getting started with loops
  • Use for statement to organise a loop.

Procedures for functional programming
  • Functions in Chapel are called procedures.

  • Procedures can be recursive.

  • Procedures can take a variable number of parameters.

  • Procedures can have default parameter values.

Using command-line arguments
  • Config variables accept values from the command line at runtime, without you having to recompile the code.

Measuring code performance
  • Use UNIX time command or instrument your Chapel code to measure performance.

Intro to parallel computing
  • Concurrency and locality are orthogonal concepts in Chapel: where the tasks are running may not be indicative of when they run, and you can control both in Chapel.

Fire-and-forget tasks
  • Use begin or cobegin or coforall to spawn new tasks.

  • You can run more than one task per core, as the number of cores on a node is limited.

Synchronising tasks
  • You can explicitly synchronise tasks with sync statement.

  • You can also use sync and atomic variables to synchronise tasks.

Task parallelism with Chapel
  • There are many ways to implement task parallelism for the diffusion solver.

Running code on multiple machines
  • Locale in Chapel is a shared-memory node on a cluster.

  • We can cycle in serial or parallel through all locales.

Domains and data parallelism
  • Domains are multi-dimensional sets of integer indices.

  • A domain can be defined on a single locale or distributed across many locales.

  • There are many predefined distribution method: block, cyclic, etc.

  • Arrays are defined on top of domains and inherit their distribution model.

Glossary