Cross-array section reduction and multicast with callback set at contribute time
Cross array sections and multicasts have basic testing in mega test.
Cross array section reductions have questionable support.
To test this, create several arrays that are all different instances of the same type. Create a section across those arrays that uses only a few elements of each.
Initiatlize those sections, record the cookie in each section element.
Create a multiphase test that triggers computation in a broadcast to all arrays. Have each element that is in a section contribute to their section with a callback to a single element function target (could be in main). Then initiate another phase via a broadcast on all arrays and have the same section operation reduce back to a different callback function target.
Verify that each function root is only invoked once and that it has a contribution from each element in the section.
#2 Updated by Raghavendra Kanakagiri over 1 year ago
For the cross array section reduction to work the reduction client should be set first.
The example code in:
is wrong, and should be changed to incorporate setReductionClient().
mcastMgr->setReductionClient(sectionProxy, new CkCallback(CkReductionTarget(Main,rednPong), thisProxy));
and in the mcastPing():
mcastMgr->contribute(sizeof(int), &(msg->hiNo), CkReduction::sum_int, sectionCookie);
If the reduction client is not set, the program does not throw any error, but the reduction produces a wrong output.
Should add a new example (Juan's) to the code base.
#3 Updated by Eric Bohm over 1 year ago
Is the callback version broken? The desired functionality is that one can pass any reduction target as the destination in the callback.
Our typical use case is that we make a section, initialize it with a multicast so every member can record the cookie. Then they contribute back to something in startup so that the computation can proceed with the guarantee that the section reduction will work. Then when suitable conditions are met, reductions go along the tree to other reduction roots. Such as a termination callback when all beads are minimized, or a synchronization callback for temper exchange when all tempers have hit the temper exchange iteration.