I am writing a distributed-shared memory library using GASNET_SEGMENT_EVERYTHING, and for that I need to communicate the address of an allocation from some root node to all other nodes, like an MPI_Bcast. However, I am having a tough time understanding how to implement this. Can someone give me an example on how to mimic MPI_Send with active messages, or explain how the undocumented gasnet_coll_broadcast
from gasnet_coll.h
works?
The best source of information for the GASNet collectives API in the current GASNet-EX release is the GASNet-EX specification (search for the section entitled // Collectives (Coll)
).
Here's a simple example of initiating a non-blocking broadcast operation and then synchronously awaiting its completion:
gex_Event_Wait(gex_Coll_BroadcastNB(myteam, root_rank, dstmem, srcmem, payloadsz, 0));
The example above is taken from the GASNet test testcollperf, and there are other examples in GASNet test testcoll; although these tests are respectively written as a performance microbenchmark and a correctness validation test (and not really intended to serve as example codes).