OpenFAM Reference Implementation

openfam::fam::fam_progress

Returns the total count of pending I/O operations within the context./p>

Synopsis

uint64_t fam_progress(void);

Description

This method returns the total count of pending FAM operations that includes put/get, scatter/gather, atomic and copy operations.

Input Arguments

None.

Return Values

Count of number of Pending I/O operations. Throws Fam_Exception on error.

Fam Error Numbers

ErrorDescription
FAM_ERR_NOPERMCaller does not have access rights
FAM_ERR_LIBFABRICLibfabric error occurred.
FAM_ERR_RPCCommunication error from grpc layer.
FAM_ERR_RPC_CLIENT_NOTFOUNDRPC service not available.
FAM_ERR_TIMEOUTNumber of libfabric retry count reached.

Notes

Note that this method is used only with Libfabric based I/O Operations and cannot be used with 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));
		
		// check the number of pending I/O operations.
		uint64_t pending_io = myFam->fam_progress();
	        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);
		
		// check the number of pending atomic operations.
		uint64_t pending_atomic = myFam->fam_progress();
	        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
}