openfam::fam::fam_fence
Ensures that FAM operations issued by the calling PE thread before the fence are completed before FAM operations issued after the fence are dispatched.
Synopsis
void fam_fence(void);
Description
This method orders FAM operations (put, scatter, atomics, copy) issued by the calling PE thread before the fence to be performed before FAM operations issued by the calling PE thread after the fence. This method is non-blocking.
Input Arguments
None.
Return Values
None. Throws an exception on error.
Exceptions
Exception | Description |
---|---|
Fam_Datapath_Exception | error occurred during write operation over fabric. |
FAM_ERR_LIBFABRIC | libfabric error occurred. |
FAM_ERR_NOPERM | Caller does not have access rights |
Notes
Note that this method does NOT order fam_map()-enabled load/store accesses by the processor to FAM.
Example
#include <string.h> #include <fam/fam.h> #include <fam/fam_exception.h> using namespace std; using namespace openfam; int main(void) { fam *myFam = new fam(); // ... Initialization code here try { // look up the descriptor to a previously allocated data item // (a 50-element integer array) Fam_Descriptor *descriptor = myFam->fam_lookup("myItem","myRegion"); // local data int local[] = {0,1,2,3,4}; uint64_t indexes[] = {0, 7, 3, 5, 6}; // scatter local data in myItem[0,7,3,5,6] respectively myFam->fam_scatter_nonblocking(local, descriptor, 5, indexes, sizeof(int)); // ensure that the scatter is performed before subsequent FAM updates myFam->fam_fence(); // now update later elements of the array in FAM int newLocal[] = {0,1,2,3,4,5,6,7,8,9}; // update elements 11 - 20 in FAM using values in local memory myFam->fam_put_nonblocking(newLocal, descriptor, 10*sizeof(int), sizeof(local)); // ... subsequent code here } catch (Fam_Exception &e) { printf("fam API failed: %d: %s\n", e.fam_error(), e.fam_error_msg()); } // ... Finalization code follows }