EPIK
Scalable runtime performance measurement system
|
Identifier mapping data structure. More...
Typedefs | |
typedef struct EpkIdMap_struct | EpkIdMap |
Opaque data structure representing an ID mapping table. | |
Enumerations | |
enum | epk_idmap_mode_t { EPK_IDMAP_DENSE, EPK_IDMAP_SPARSE } |
Enumeration type defining the two differnt modes of an identifier mapping table. More... | |
Functions | |
Functions | |
EXTERN EpkIdMap * | epk_idmap_create (epk_idmap_mode_t mode, size_t capacity) |
Creates and returns a new instance of EpkIdMap with the given mode and initial capacity. | |
EXTERN void | epk_idmap_free (EpkIdMap *instance) |
Destroys the given instance of EpkIdMap and releases the allocated memory. | |
EXTERN size_t | epk_idmap_size (const EpkIdMap *instance) |
Returns the actual number of entries stored in the given mapping table instance. | |
EXTERN epk_idmap_mode_t | epk_idmap_mode (const EpkIdMap *instance) |
Returns the identifier mapping mode (dense/sparse) used for the given mapping table instance. | |
EXTERN void | epk_idmap_clear (EpkIdMap *instance) |
Removes all entries in the given mapping table instance. | |
EXTERN void | epk_idmap_add (EpkIdMap *instance, elg_ui4 local_id, elg_ui4 global_id) |
Adds the given mapping from local_id to global_id to the mapping table instance. | |
EXTERN elg_ui4 | epk_idmap_get (const EpkIdMap *instance, elg_ui4 local_id) |
Returns the global identifier for the given local_id stored in the mapping table instance. | |
EXTERN const elg_ui4 * | epk_idmap_data (const EpkIdMap *instance, size_t *count) |
Returns an pointer to the raw data of the given mapping table instance. |
This file provides type definitions and function prototypes for an identifier mapping data structure which is used to store mapping tables for converting local into global identifiers.
This mapping data structure can operate in two different modes (see epk_idmap_mode_t): A dense mapping can be used if the local identifiers are consecutively enumerated from 0 to N-1. In this case, only the global identifier are stored in the table at the corresponding entry, leading to compact storage and fast look-up. By contrast, if the local identifiers can consist of arbitrary numbers, a sparse mapping is necessary. Here, (local_id, global_id) tuples are stored, which requires a more complicated look-up procedure.
assert()
macro to check various conditions (especially the values of given parameters) at runtime, which can cause a performance penalty. typedef struct EpkIdMap_struct EpkIdMap |
enum epk_idmap_mode_t |
EXTERN void epk_idmap_add | ( | EpkIdMap * | instance, |
elg_ui4 | local_id, | ||
elg_ui4 | global_id | ||
) |
If the current capacity does not suffice, the data structure is automatically resized. If this memory reallocation request can not be fulfilled, an error message is printed and the program is aborted.
instance | Object to add the mapping to |
local_id | Local identifier |
global_id | Global identifier |
EXTERN void epk_idmap_clear | ( | EpkIdMap * | instance | ) |
It can be used, e.g., to reuse an mapping table object for new input data.
instance | Object to remove entries from |
EXTERN EpkIdMap* epk_idmap_create | ( | epk_idmap_mode_t | mode, |
size_t | capacity | ||
) |
If the memory allocation request can not be fulfilled, an error message is printed and the program is aborted.
mode | Mapping mode |
capacity | Initial capacity |
EXTERN const elg_ui4* epk_idmap_data | ( | const EpkIdMap * | instance, |
size_t * | count | ||
) |
In addition, the total number of IDs is stored at the location pointed to by count. For a dense mapping, this number is equal to the number of entries, whereas for a sparse mapping it is twice as much, since each entry consists of an local and an global identifier (in this order).
EXTERN void epk_idmap_free | ( | EpkIdMap * | instance | ) |
instance | Object to be freed |
EXTERN elg_ui4 epk_idmap_get | ( | const EpkIdMap * | instance, |
elg_ui4 | local_id | ||
) |
If no entry can be found, ELG_NO_ID is returned.
instance | Queried object |
local_id | Local identifier |
EXTERN epk_idmap_mode_t epk_idmap_mode | ( | const EpkIdMap * | instance | ) |
instance | Queried object |
EXTERN size_t epk_idmap_size | ( | const EpkIdMap * | instance | ) |
instance | Queried object |
![]() |
Copyright © 1998–2012 Forschungszentrum Jülich GmbH, Jülich Supercomputing Centre |