openfam::fam::fam_lookup
Look up a descriptor to a region or data item in the metadata service.
Synopsis
Fam_Region_Descriptor *fam_lookup_region(char *regionName);
Fam_Descriptor *fam_lookup(char *itemName, char *regionName);
Description
These methods look up a descriptor registered with the metadata service using its name.
Input Arguments
| Name | Description |
|---|---|
| itemName | Name of the data item to be looked up. |
| regionName | Name of the region, or region containing the item. |
Return Values
A descriptor to the value in FAM. Throws an exception on error.
Exceptions
| Exception | Description |
|---|---|
| FAM_ERR_NOPERM | Caller does not have access rights. |
| FAM_ERR_NOTFOUND | the item or region name was not found by the metadata service. |
| FAM_ERR_GRPC | there is a communication error with memory server |
| FAM_ERR_RPC_CLIENT_NOTFOUND | Memory server initialization failure |
Notes
See the fam_create_region() and fam_allocate() APIs for discussion of regions and data items.
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 a descriptor (created by another PE) via the metadata service
Fam_Descriptor *arrayDescriptor = myFam->fam_lookup("myArray", "myOtherRegion");
} catch (Fam_Allocator_Exception &e) {
printf("Look up failed: %d: %s\n", e.fam_error(), e.fam_error_msg());
}
// ... continuation code here
}