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 Fam_Exception on error.
Fam Error Numbers
| Error | Description |
|---|---|
| FAM_ERR_NOPERM | Caller does not have access rights |
| FAM_ERR_LIBFABRIC | Libfabric error occurred. |
| FAM_ERR_RPC | Communication error from grpc layer. |
| FAM_ERR_RPC_CLIENT_NOTFOUND | RPC service not available. |
| FAM_ERR_TIMEOUT | Number of libfabric retry count reached. |
Notes
Note that this method does NOT order or wait
for completion of fam_map()-enabled load/store accesses by the
processor to FAM.
For a given context, only one fam_quiet should be invoked at a time. fam_quiet on same context should not be invoked in parallel from multiple threads.
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
}