OpenFAM Reference Implementation

openfam::fam::fam_get_option

Get the value for a pre-defined option in the FAM library.

Synopsis

const void *fam_get_option(char *optionName);

Description

This method can be used to retrieve values of state variables maintained within OpenFAM or set using the options argument to fam_initialize(). The supported names (and returned types) are implementation specific.

Input Arguments

NameDescription
optionNameName of the option to be retrieved.
The following option names are available:
NameDescriptionReturn typeDefault Value
"VERSION" Version of the current implementation of the OpenFAM API. char* "3.0"
"DEFAULT_REGION_NAME" The default Region name used with in the program. char* "default"
"CIS_SERVER" Client Interface Server set by the application. char* "127.0.0.1"
"GRPC_PORT" Grpc port used by Client Interface Server. char* "8787"
"LIBFABRIC_PROVIDER" Libfabric provider type set by the application. char* "sockets"
"FAM_THREAD_MODEL" Thread model used by the application. char* "FAM_THREAD_SERIALIZE"
"CIS_INTERFACE_TYPE" Interface Type for CIS Server. char* "FAM_THREAD_SERIALIZE"
"OPENFAM_MODEL" OpenFAM allocator model used by the application. char* "memory_server"
"FAM_CONTEXT_MODEL" Fam context model used by the application. char* "FAM_CONTEXT_DEFAULT"
"PE_COUNT" Number of PEs running the application program. int* 1
"PE_ID" PE id of the current program. int* 0
"RUNTIME" Runtime environment used by the application. char* "PMIX"
"NUM_CONSUMER" Number of consumer threads running in shared memory allocator. char* "1"
"FAM_DEFAULT_MEMORY_TYPE" Memory type used for region creation and allocation. (Volatile/Persistent) char* "VOLATILE"
"IF_DEVICE" Device Name to be used for data path operations with remote memory servers. char* "cxi0" for cxi devices and "ib0" for Infiniband devices.

 

Note: The following options are not supported in current implementation and should not be used, even though they have default values. "DEFAULT_REGION_NAME" and "FAM_CONTEXT_MODEL"

Return Values

A pointer to the value of the option. Throws Fam_Exception on error.

Fam Error Numbers

ErrorDescription
FAM_ERR_INVALIDIf optionName not found.

Notes

None.

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 {
		// assume that library version is one of the supported options
		const char * libraryVersion = (const char *)myFam->fam_get_option(strdup("VERSION"));
		printf("%s\n", libraryVersion);
	} catch (Fam_Exception& e) {
		printf("FAM API failed: %s\n", e.fam_error_msg());
		myFam->fam_abort(-1); // abort the program
		return -1;
	}
	
	// ... finalization code here

}