Berkeley UPC System Internals Documentation version 2022.10.0 |
The Berkeley UPC compiler project is seeking to develop a fully-portable, high-performance UPC compiler that will run on a wide variety of shared-memory and distributed-memory platforms using different network interconnects, including large-scale multiprocessors, PC clusters, and clusters of shared memory multiprocessors. One of the main goals of the project is to experiment with parallel compiler optimization techniques, without being tied to a particular system architecture or network. Portability is achieved by translating UPC programs to an intermediate representation in C, which can then be compiled using the system's ANSI C compiler and linked to a standardized runtime system and communication system tailored to the specific platform.
|
The figure shows the high-level system diagram for a UPC application compiled using the Berkeley UPC compiler. The generated C code runs on top of the UPC runtime system, which provides platform independence and implements language-specific features such as shared memory allocation and shared pointer manipulation. The runtime system implements remote operations by calling the GASNet communication interface, which provides hardware-independent lightweight networking primitives. |
The Berkeley UPC-to-C translator performs source to source translation from UPC code to ANSI-compliant C code, with shared memory operations transformed into calls to the Berkeley UPC runtime. The translator is based on the Open64 compiler suite; please refer to their documentation for information about the design and specific features of that compiler. Numerous modifications have been added to the translator to support UPC features, and the translator's C front end has also been extended to support both 32- and 64-bit platforms. A detailed description of our modifications can be found here.
The figure gives a high-level overview of the translation process. Upon receiving a preprocessed UPC program, the translator invokes the UPC front end, whose function is to parse, type-check, and generate the Whirl intermediate format for the program. UPC-specific information such as shared types and block sizes of distributed arrays are kept in the symbol table, so the translator could take advantage of such information during optimizations. The back end operates on the Whirl intermediate language and lowers shared memory operations into equivalent runtime library calls. The Berkeley UPC runtime provides a wide of variety of shared memory accesses from non-blocking to bulk, so that the translator could experiment with different strategies for communication optimizations such as message pipelining and prefetching. Finally the whirl2c component translates Whirl into ANSI-compliant C code, with shared variables declared as the opaque pointer-to-shared construct. |
![]() |
The Berkeley UPC runtime specification documents the platform-independent interface between compiler-generated C code and the UPC runtime system. It provides platform-independent job/thread control, shared memory access (put/get operations and bulk transfer operations), shared pointer manipulation and arithmetic, shared memory management, UPC barriers and UPC locks. The shared memory operations provide very flexible non-blocking shared memory access with a wide range of synchronization alternatives.
In addition to providing platform independence, the Berkeley Runtime interface provides a cleanly-documented, compiler-independent "UPC abstract machine" that can be used as a compilation target by other front-end UPC compilers.
GASNet is a language-independent, networking middleware layer that provides network-independent, high-performance communication primitives including Remote Memory Access (RMA) and Active Messages (AM). It has been used to implement parallel programming models and libraries such as UPC, UPC++, Co-Array Fortran, Legion, Chapel, and many others. The interface is primarily intended as a compilation target and for use by runtime library writers (as opposed to end users), and the primary goals are high performance, interface portability, and expressiveness. GASNet stands for "Global-Address Space Networking".
The design of GASNet is partitioned into two layers to maximize porting ease without sacrificing performance: the lower level is a narrow but very general interface called the GASNet core API - the design is based heavily on Active Messages, and is implemented directly on top of each individual network architecture. The upper level is a wider and more expressive interface called the GASNet extended API, which provides high-level operations such as remote memory access and various collective operations. |
|
The Berkeley UPC runtime was initially implemented over GASNet-1, circa 2004. Since then, the GASNet-1 product has been superceded by GASNet-EX, a major specification upgrade and implementation renovation effort funded primarily by the Exascale Computing Project. GASNet-EX is a superset of GASNet-1, providing both backwards compatibility and a wide set of new features and functionality. The Berkeley UPC runtime is now implemented over GASNet-EX and takes advantage of some of the new functionality, most notably using the support for network hardware offload of atomic memory operations to implement <upc_atomic.h>. GASNet-EX releases continue to improve speed, scalability and portability of the networking layer, and the Berkeley UPC runtime inherits those improvements.