Clone wiki

upcxx / events / SC21

UPC++ SC21 Virtual Tutorial

The Pagoda project was pleased to present a half-day UPC++ Tutorial at the SC21 conference in November. The tutorial includes interactive hands-on exercises along with an introduction to the UPC++ library and in-depth case studies of applications using UPC++. Speakers notably include Professor Katherine Yelick, a highly distinguished lecturer and internationally recognized and decorated researcher.

When: The tutorial was presented via SC21 HUBB on Monday, November 15th, 2021.
Where: Tutorial page at the SC21 site
The live session has ended. The lecture videos are now available on-demand at YouTube (see below).

Promotional Video

SC21 UPC++ Tutorial Promotion


Setting up UPC++

There are several ways to access a working UPC++ environment:

Installs on the major DOE centers

We maintain public installs of UPC++ at several DOE centers.

See Using UPC++ on NERSC Cori, OLCF Summit, and ALCF Theta

Download and install from source

UPC++ supports a wide range of UNIX-like systems and architectures, ranging from supercomputers to laptops, including Linux, macOS and Windows 10 (via WSL).

Visit the UPC++ download page for links to download and install UPC++ on your own system.

Docker containers with UPC++

We're providing a Linux Docker container for the UPC++ tutorial.

Assuming you have a Linux-compatible Docker environment, you can get a working UPC++ environment with the following command:

docker run -it --rm upcxx/sc21-linux-amd64

The UPC++ commands are upcxx (compiler wrapper) and upcxx-run (run wrapper), and the home directory contains the tutorial exercises and some example codes.

Getting Started with the Library

For training materials to get started using UPC++, see the UPC++ Training Page

Day of Tutorial

  • Tutorial Slides (PDF)
  • The live session has ended. The lecture videos are now available on-demand at YouTube (see below).

Lecture videos

The tutorial lecture videos used during the live tutorial are available on YouTube (with high-quality captions available) :

Start Time Duration Content
13:00 CST 5 min Live welcome on Zoom
13:05 CST 27 min Video Part 1: Introduction
13:32 CST 5 min Hands-on 1, Q&A on Zoom
13:37 CST 27 min Video Part 2: Programming 1
14:04 CST 2 min Q&A on Zoom
14:06 CST 23 min Video Part 3: Programming 2
14:29 CST 5 min Hands-on 2, Q&A on Zoom
14:34 CST 21 min Video Part 4: Programming 3
14:55 CST 5 min Hands-on 3, Q&A on Zoom
15:00 CST 30 min Break (no content)
15:30 CST 33 min Video Part 5: Advanced Topics
16:03 CST 2 min Q&A on Zoom
16:05 CST 18 min Video Part 6: Applications 1
16:23 CST 2 min Q&A on Zoom
16:25 CST 16 min Video Part 7: Applications 2
16:41 CST 19 min Q&A on Zoom

YouTube playlist of all videos

Setting up the Hands-on Exercises

  1. Install or find a working UPC++ environment (see above)

  2. Download the tutorial content, which includes the starter files for exercises. The tutorial content is available in all of the following places:

  3. Navigate to the exercises directory (possibly tutorials/2021-11/exercises)

  4. The sections below describe each example in more detail

Exercise 0

Exercise 0 just tests you have a working UPC++ environment.

From the exercises directory of the tutorial materials, type this command to build and run hello world:

make run-ex0

This will build and run hello world using the default network backend. Note that on batch scheduled supercomputers this must be run inside a batch session.

You should see output similar to:

/usr/local/upcxx/bin/upcxx -Wall ex0.cpp  -o ex0
/usr/local/upcxx/bin/upcxx-run -n 4 ./ex0
Hello world from process 1 out of 4 processes
Hello world from process 2 out of 4 processes
Hello world from process 3 out of 4 processes
Hello world from process 0 out of 4 processes


  • make: upcxx: Command not found This means the UPC++ install was not found in your environment. You can either add the UPC++ bin directory to your $PATH variable, or set environment variable to the root of the UPC++ install: export UPCXX_INSTALL=/path/to/upcxx/install/tree

  • Job spawn failures (e.g. ssh: connect to host foo port 22: Connection refused). If you failed to launch a distributed job, the simplest resolution for the purposes of the tutorial exercises is to recompile for the single-node SMP backend, using the command: env UPCXX_NETWORK=smp make clean run-ex0 Assuming this fixes your problem, use a similar command for running the subsequent exercises (replacing run-ex0 with run-ex1, etc.)

Exercise 1

Working source file: ex1.cpp in exercises directory

Make command: make run-ex1 in exercises directory

Exercise 1 slide

Correct Output: Output lines in a correct solution should be ordered by rank.

output.txt :
Hello from process 0 out of 4
Hello from process 1 out of 4
Hello from process 2 out of 4
Hello from process 3 out of 4

Exercise 2

Working source file: ex2.cpp in exercises directory

Make command: make run-ex2 in exercises directory

Exercise 2 slide

Correct Output:

Running 1-d Jacobi on 4 procs, iters=100 global_domain_sz=1024
Running jacobi_rget...
  result = 51900  PASSED
Running jacobi_rput...
  result = 51900  PASSED

Exercise 3

Working source file: ex3.hpp in exercises directory

Make command: make run-ex3 in exercises directory

Exercise 3 slide

Correct Output:

erase() SUCCESS
update() SUCCESS

Extra Credit: Exercise 4

If you finish early, there is an optional exercise 4 (not explicitly covered during the presentation). This exercise asks you to fill in code for a more advanced version of a distributed hash table that uses RMA to accelerate transfers of large value data (exploiting zero-copy RDMA on systems where that's available).

Working source file: ex4.hpp in exercises directory.

Search for EXERCISE in the file for detailed instructions.

Make command: make run-ex4 in exercises directory

Correct Output:

Constructing a DistrRMAMap<uint64_t,uint64_t>...
Inserting 100 key/value pairs from each of 4 ranks, with value sizes 8..800000 bytes...
Inserts complete!
Now issuing 100 finds from 4 ranks to verify...
Find complete!
Testing insert collision...

Thanks for attending the UPC++ Tutorial!!!

Prior SC20 Tutorial

Back to UPC++ Home