A distributed object is physically partitioned over all processors in the system. It is identified by a unique integer id. The system constant DistObj_minDynamicId partitions the entire space of ids is into two regions: one managed by the application to name statically known objects, and the other managed by the fresh id generator DistObj_freshId.
Distributed objects created by DistObj_all_allocate is a collection of memory blocks, one on each processor. The mapping of object names to memory block addresses is handled by DistObj_localAddr. A collection of threads can use a common distributed object to perform barrier synchronization or integer reduction.
DistObj_freshId, DistObj_all_allocate, DistObj_all_destroy, DistObj_all_barrier, and DistObj_all_reduceInt are split-phase operations. A split-phase operation returns OK if it has completed upon return (i.e., no need to create a thread to wait for the the result), and WAIT otherwise. DistObj_all_allocate, DistObj_all_destroy, DistObj_all_barrier, and DistObj_all_reduceInt must be called by one thread per processor on all processors.
A system constant that divides the space of object ids into two regions. Ids smaller than DistObj_minDynamicId are managed by the application to name statically known objects. Ids no smaller than DistObj_minId are managed by the fresh id generator DistObj_freshId. The id 0 is reserved by the runtime system. DistObj_minDynamicId is currently set to 64.
Allocate a fresh object id that is no smaller than DistObj_minId and return its value in *idPtr. Increment the counter ctr upon completion. In the current implementation, processor 0 acts as the centralized id allocator to guarantee the uniqueness of ids.
Allocate the distributed object with id id. size is the number of bytes to allocate on each processor. Increment the counter ctr upon completion.
There must not be any existing object with id id.
Deallocate the distributed object with id id. Increment the counter ctr upon completion.
DistObj_all_destroy currently does nothing. Therefore id cannot be reused for new objects.
Return the address of the memory block allocated to object id on the local processor.
Perform barrier synchronization over all partitions of the distributed object id. Increment the counter ctr upon completion.
DistObj_all_barrier cannot execute concurrently with DistObj_all_barrier or DistObj_all_reduceInt on the same object.
Perform a reduce operation on all partitions of the distributed object id. The associative integer function combiner is used to combine values from different partitions. The user places the input values in *(int*)DistObj_localAddr(id). When DistObj_all_reduceInt completes, the result is stored in *(int*)DistObj_localAddr(id) on all processors, and the counter ctr is incremented.
DistObj_all_reduceInt cannot execute concurrently with DistObj_all_barrier or DistObj_all_reduceInt on the same object.
Execute the function f on all processors. f takes two integer arguments arg1 and arg2.