OpenMPI
0.1.1
|
maffinity (memory affinity) framework component interface definitions. More...
#include "opal_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/maffinity/maffinity_types.h"
Go to the source code of this file.
Data Structures | |
struct | opal_maffinity_base_component_2_0_0_t |
Structure for maffinity components. More... | |
struct | opal_maffinity_base_module_1_0_0_t |
Structure for maffinity modules. More... | |
Macros | |
#define | OPAL_MAFFINITY_BASE_VERSION_2_0_0 |
Typedefs | |
typedef int(* | opal_maffinity_base_module_init_1_0_0_fn_t )(void) |
Module initialization function. More... | |
typedef int(* | opal_maffinity_base_module_set_fn_t )(opal_maffinity_base_segment_t *segments, size_t num_segments) |
Module function to set memory affinity. More... | |
typedef int(* | opal_maffinity_base_module_node_name_to_id_fn_t )(char *node_name, int *node_id) |
translate memory node name (such as "mem0") to memory node id | |
typedef int(* | opal_maffinity_base_module_bind_fn_t )(opal_maffinity_base_segment_t *segments, size_t num_segments, int node_id) |
bind memory to node | |
typedef struct opal_maffinity_base_component_2_0_0_t | opal_maffinity_base_component_2_0_0_t |
Convenience typedef. | |
typedef struct opal_maffinity_base_module_1_0_0_t | opal_maffinity_base_module_1_0_0_t |
Convenience typedef. | |
maffinity (memory affinity) framework component interface definitions.
Intent
Simple component to set memory affinity for pages. Note that this framework assumes that processor affinity is being used (it doesn't make much sense to use memory affinity unless processes are bound to specific processors, otherwise the processes may move around and the memory may end up being remote).
maffinity components are typically used with shared memory operations, but can be used elsewhere as well. The idea is to get memory physically located with the process that is going to use it. For memory allocated to a processor-bound process, functions such as malloc() do this naturally. However, when working with memory shared by multiple processes on a NUMA machine, it can be extremely advantageous to ensure that pages containing the data structures for a given process are physically local to the processor where that process is bound.
One process will allocate a large shared memory block and all will need to participate to make pages local to specific processors.
There is one main module function (opal_maffinity_base_module_set_fn_t) that takes an array of segment descriptions within the block. Each process will get a different set of segment descriptions (i.e., the segments belonging to that process). Components then do whatever is necessary to make pages local to their respective processes (i.e., the processors where the processes are running).
#define OPAL_MAFFINITY_BASE_VERSION_2_0_0 |
typedef int(* opal_maffinity_base_module_init_1_0_0_fn_t)(void) |
Module initialization function.
Should return OPAL_SUCCESS.
typedef int(* opal_maffinity_base_module_set_fn_t)(opal_maffinity_base_segment_t *segments, size_t num_segments) |
Module function to set memory affinity.
Take an array of maffinity_base_segment_t instances to describe which memory should physically reside with which process.
This function is intended to be invoked by each process immediately after they mmap / attach the shared memory. In some cases, it will be a no-op for some processes (i.e., machines where a single function call in the creating process sets the memory affinity for the entire region), but in other cases all processes will need to participate (e.g., the first_use component, each each process will "touch" the pages that are supposed to be local to them).