openfam::fam::fam_put
Copy a segment of memory from local memory to FAM.
Synopsis
void fam_put_blocking(void *local, Fam_Descriptor *descriptor, uint64_t
offset, uint64_t nbytes);
void fam_put_nonblocking(void *local, Fam_Descriptor *descriptor, uint64_t
offset, uint64_t nbytes);
Description
Copy (part of) some data item from local memory to FAM.
Input Arguments
Name | Description |
---|---|
local | Appropriately sized area of local memory to use as source. |
descriptor | Descriptor associated with the data item in FAM for the destination. |
offset | Byte offset from the start of the data item in FAM. |
nbytes | Number of bytes to copy. |
Return Values
These calls do not return a value on success; Both non-blocking and blocking calls
throw Fam_Exception
on error.
Fam Error Numbers
Error | Description |
---|---|
FAM_ERR_INVALID | API called with incorrect parameters. |
FAM_ERR_NOPERM | Caller does not have access rights. |
FAM_ERR_LIBFABRIC | Libfabric error occurred. |
FAM_ERR_NOTFOUND | Item not found in the region. |
FAM_ERR_RPC | Communication error from grpc layer. |
FAM_ERR_RPC_CLIENT_NOTFOUND | RPC service not available. |
FAM_ERR_METADATA | Metadata service error. |
FAM_ERR_MEMORY | Memory service error. |
FAM_ERR_RESOURCE | Resource not available. |
FAM_ERR_TIMEOUT | Number of libfabric retry count reached. |
Notes
See notes for fam_get.
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"); // allocate an integer array and initialize it int local[] = {0,1,2,3,4,5,6,7,8,9}; // replace elements 6-15 of the data item in FAM with values in local memory myFam->fam_put_blocking(local, descriptor, 6*sizeof(int), 10*sizeof(int)); // ... we now have completed a copy from local memory to FAM printf("Completed a copy from local memory to FAM\n"); } catch (Fam_Exception &e) { printf("fam API failed: %d: %s\n", e.fam_error(), e.fam_error_msg()); } // ... Finalization code follows }