1. Introductory Tutorial

  1. Tarek El-Ghazawi1,
  2. William Carlson2,
  3. Thomas Sterling3 and
  4. Katherine Yelick4

Published Online: 27 JAN 2005

DOI: 10.1002/0471478369.ch1

UPC: Distributed Shared Memory Programming

UPC: Distributed Shared Memory Programming

How to Cite

El-Ghazawi, T., Carlson, W., Sterling, T. and Yelick, K. (2005) Introductory Tutorial, in UPC: Distributed Shared Memory Programming, John Wiley & Sons, Inc., Hoboken, NJ, USA. doi: 10.1002/0471478369.ch1

Author Information

  1. 1

    The George Washington University, USA

  2. 2

    IDA Center for Computing Sciences, USA

  3. 3

    California Institute of Technology, USA

  4. 4

    University of California at Berkeley, USA

Publication History

  1. Published Online: 27 JAN 2005
  2. Published Print: 13 MAY 2005

Book Series:

  1. Wiley Series on Parallel and Distributed Computing

Book Series Editors:

  1. Albert Y. Zomaya

ISBN Information

Print ISBN: 9780471220480

Online ISBN: 9780471478362

SEARCH

Keywords:

  • Unified Parallel C (UPC);
  • single program, multiple data (SPMD);
  • UPC pointers

Summary

In this chapter we introduced the basic concepts of UPC in a tutorial style to enable programmers to write their first UPC code quickly. We have in particular demonstrated that UPC is a superset of C and all C programs will run under UPC. However this will naturally create several copies of the same program running in the SPMD mode.

Under UPC, multiple threads will be operating independently and each thread may have access to both private and shared data objects, variables and arrays. A private variable has one independent instance per thread. The total number of threads is THREADS and each thread identifies itself using MYTHREAD. THREAD and MYTHREAD can be thought of as special constants. Shared scalars have affinity with thread 0. Shared array elements, however, are distributed by default in a round robin fashion across the threads.

UPC has many synchronization constructs for barrier, split phase barrier, locks, and fence. UPC also provides the programmer with the ability to specify the memory consistency model, as relaxed or strict.

Work can be distributed based on THREADS and MYTHREAD. Work can be conveniently distributed, however, using upc_forall. All iterations must be independent in order to use upc_forall.

UPC provides rich pointer concepts. Threads can point to shared data using either shared or private pointers. In addition, C pointer declarations result in private pointers to private data. It is possible under UPC to cast one type of pointer to another.