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 5

Dynamic Shared Memory Allocation

Dynamic memory allocation has been used extensively in applications for several important reasons. For example, dynamic memory allocation provides flexibility when the data sizes change during the lifetime of a program, and allows memory reuse for better utilization of the memory resources when data sizes are very large. In the private space of a UPC program, dynamic memory allocation can be done using the standard dynamic memory allocation functions available in ISO C. Dynamic memory allocation in the shared space is also possible. However, this is accomplished by special UPC memory allocation and deallocation functions. In this chapter we discuss dynamic shared memory allocation in UPC.

Dynamic shared memory allocation functions can be collective or noncollective. A function is collective if it is required to be called by all threads to produce the required impact. A function is noncollective if it should be called by a single thread. UPC has three basic dynamic shared memory allocation functions and one deallocation function. The allocation functions can create a global shared space collectively or noncollectively, or a local shared space by a thread. All dynamically allocated shared space can be released using the same deallocation function.

5.1 ALLOCATING A GLOBAL SHARED MEMORY SPACE COLLECTIVELY

To allocate one global shared space collectively, upc_all_alloc() is used. The upc_all_alloc() function is a collective function that ...

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