OpenFAM Reference Implementation

openfam::fam::fam_quiet

Ensures that all pending operations to FAM issued by the calling PE thread have completed before proceeding

Synopsis

void fam_quiet(void);

Description

This method blocks the calling PE thread until all its pending FAM operations are complete.

Input Arguments

None.

Return Values

None. Throws an exception on error.

Exceptions

ExceptionDescription
Fam_Datapath_Exceptionerror occurred during write operation over fabric.
FAM_ERR_LIBFABRIClibfabric error occurred.
Fam_Timeout_Exceptionnumber of libfabric retry count reached the timeout limit. (Only for blocking call)
FAM_ERR_NOPERMCaller does not have access rights

Notes

Note that this method does NOT order or wait for completion of 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[] = {10, 17, 13, 15, 16};
		
		// scatter local data in myItem[10,17,13,15,16] respectively
		myFam->fam_scatter_nonblocking(local, descriptor, 5, indexes, sizeof(int));
		
		// ensure that the scatter operation is complete
		myFam->fam_quiet();
		
		// look up the descriptor to a previously allocated completion flag
		Fam_Descriptor *flagDescriptor = myFam->fam_lookup("completionFlag", "myRegion");
		
		// atomically set the completion flag in FAM
		myFam->fam_set(flagDescriptor, 0, 1);
		
		// ensure that the set operation is complete
		myFam->fam_quiet();
		
		// we now have the correct items in FAM, and the completion flag has been set
		
		// ... subsequent code here
	} catch (Fam_Exception &e) {
		printf("fam API failed: %d: %s\n", e.fam_error(), e.fam_error_msg());
	}
		
	// ... Finalization code follows
}