O'Reilly logo

UPC: DISTRIBUTED SHARED MEMORY PROGRAMMING by Katherine Yelick, Thomas Sterling, William Carlson, Tarek El-Ghazawi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 3

Pointers and Arrays

The concept of pointers is a core element of the ISO C programming language and has proven to be a powerful programming tool. UPC defines a number of pointer classes that follow directly from C pointers and the UPC memory model. As in C, pointers are variables that contain the address of another variable. However, under the UPC memory model such pointers can reside in either the private space or the shared space. UPC pointers can also reference the private space or the shared space. These different variants of the UPC pointer semantics serve distinct programming scenarios. Pointers often lead to compact programs and result in efficient implementations. Pointers and array indexes are closely related in C, and they remain that way in UPC. Under UPC, pointers can be declared to have blocking factors similar to those in the case of arrays. Thus, given any array layout in the shared space, a pointer can be declared to traverse the elements of such an array in the same sequence that C pointers traverse array elements. In many cases, casting is also allowed from one pointer type to another.

3.1 UPC POINTERS

The syntax of pointer declarations in UPC is similar to those of C. However, with a memory model that has shared and private spaces, there are four major UPC pointer classes: private pointers pointing to the private space, private pointers pointing to the shared space, shared pointers pointing to the shared space, and shared pointers pointing to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required