openfam::fam::fam_size
Get the size of a region or data item.
Synopsis
uint64_t fam_size(Fam_Descriptor *descriptor);
uint64_t fam_size(Fam_Region_Descriptor *descriptor);
Description
These methods return the size associated with the data item or region descriptor.
Input Arguments
Name | Description |
---|---|
descriptor | Descriptor associated with the region or the data item. |
Return Values
Returns the size associated with region or the data item descriptor on success. Throws an exception on error.
Fam Error Numbers
Error | Description |
---|---|
FAM_ERR_NOPERM | Caller does not have access rights |
FAM_ERR_NOTFOUND | the data item name not found in FAM |
FAM_ERR_GRPC | there is a communication error with memory server |
FAM_ERR_RPC_CLIENT_NOTFOUND | Memory server initialization failure |
Example
#include <stdlib.h> #include <stdio.h> #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 { // get a region descriptor from the metadata service Fam_Region_Descriptor *region = myFam->fam_lookup_region("myRegion"); // Get region size uint64_t region_size = myFam->fam_size(region); printf("Region_size: %d\n", region_size); // Get a descriptor (created by another PE) via the metadata service Fam_Descriptor *arrayDescriptor = myFam->fam_lookup("myArray", "myOtherRegion"); // Get data item size uint64_t data_size = myFam->fam_size(arrayDescriptor); printf("array_size: %d\n", data_size); } catch (Fam_Exception &e) { printf("Fam API failed: %d: %s\n", e.fam_error(), e.fam_error_msg()); } // ... continuation code here }