openfam::fam::fam_copy
Copy data from one FAM-resident data item to another FAM-resident data item.
Synopsis
void *fam_copy(Fam_Descriptor *src, uint64_t srcOffset, Fam_Descriptor *dest, uint64_t destOffset, uint64_t nbytes);
Description
Initiates a copy operation of data from one FAM-resident data item to another FAM-resident data item and returns a pointer to the wait object associated with the copy operation.
Input Arguments
Name | Description |
---|---|
src | Descriptor associated with the source data item in FAM. |
srcOffset | Offset within the source descriptor where copy starts. |
dest | Descriptor associated with the destination data item in FAM. |
destOffset | Offset within the destination descriptor where the copy starts. |
nbytes | Number of bytes to copy. |
Return Values
Returns a pointer to the wait object for the copy operation.
This object can be used to wait for the completion of the copy operation.
Throws 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_OUTOFRANGE | Data access out of range. |
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_METADATA | Metadata service error. |
FAM_ERR_MEMORY | Memory service error. |
FAM_ERR_RESOURCE | Resource not available. |
Notes
Note that the method is non-blocking: it returns after the copy
has been initiated, and does not wait for completion of the transfer.
Also note that fam_copy()
performs an inconsistent copy, in that the
copied data may reflect updates that are performed concurrently with
the copy operation, rather than a point-in-time snapshot of the source
data item that is consistent as of the beginning of copy operation. If
the application desires a consistent copy, it is responsible for
coordinating PE activity during the copy.
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 (source) data item. Fam_Descriptor *descriptor = myFam->fam_lookup("myItem", "myRegion"); // look up the descriptor to a previously allocated (destination) data item. Fam_Descriptor *destCopy = myFam->fam_lookup("myItem2", "myRegion"); // create a new copy and returns a waitObject to copy operation. void *waitObj = myFam->fam_copy(descriptor, 0, destCopy, 0, 10*sizeof(int)); // Wait for copy operation to complete. myFam->fam_copy_wait(waitObj); printf("Copy to new location in FAM successful\n"); } catch (Fam_Exception &e) { printf("fam API failed: %d: %s\n", e.fam_error(), e.fam_error_msg()); } // ... subsequent code here }