1
1

* rename ompi_hash_table opal_hash_table

This commit was SVN r6324.
Этот коммит содержится в:
Brian Barrett 2005-07-03 16:52:32 +00:00
родитель 764a9314db
Коммит 9f0c969bb4
39 изменённых файлов: 295 добавлений и 295 удалений

Просмотреть файл

@ -366,10 +366,10 @@ static void attribute_value_construct(attribute_value_t *item);
static void ompi_attrkey_item_construct(ompi_attrkey_item_t *item); static void ompi_attrkey_item_construct(ompi_attrkey_item_t *item);
static void ompi_attrkey_item_destruct(ompi_attrkey_item_t *item); static void ompi_attrkey_item_destruct(ompi_attrkey_item_t *item);
static int set_value(ompi_attribute_type_t type, void *object, static int set_value(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, int key, opal_hash_table_t **keyhash, int key,
attribute_value_t *new_attr, attribute_value_t *new_attr,
bool predefined, bool need_lock); bool predefined, bool need_lock);
static int get_value(ompi_hash_table_t *keyhash, int key, static int get_value(opal_hash_table_t *keyhash, int key,
attribute_value_t **attribute, int *flag); attribute_value_t **attribute, int *flag);
static void *translate_to_c(attribute_value_t *val); static void *translate_to_c(attribute_value_t *val);
static MPI_Fint translate_to_fortran_mpi1(attribute_value_t *val); static MPI_Fint translate_to_fortran_mpi1(attribute_value_t *val);
@ -398,7 +398,7 @@ static OBJ_CLASS_INSTANCE(ompi_attrkey_item_t,
* Static variables * Static variables
*/ */
static ompi_hash_table_t *keyval_hash; static opal_hash_table_t *keyval_hash;
static ompi_bitmap_t *key_bitmap; static ompi_bitmap_t *key_bitmap;
static unsigned int int_pos = 12345; static unsigned int int_pos = 12345;
@ -443,7 +443,7 @@ ompi_attrkey_item_destruct(ompi_attrkey_item_t *item)
/* Remove the key entry from the hash and free the key */ /* Remove the key entry from the hash and free the key */
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
ompi_hash_table_remove_value_uint32(keyval_hash, item->key); opal_hash_table_remove_value_uint32(keyval_hash, item->key);
FREE_KEY(item->key); FREE_KEY(item->key);
OMPI_THREAD_UNLOCK(&alock); OMPI_THREAD_UNLOCK(&alock);
} }
@ -460,7 +460,7 @@ int ompi_attr_init(void)
void *bogus = (void*) 1; void *bogus = (void*) 1;
MPI_Fint *p = (MPI_Fint*) &bogus; MPI_Fint *p = (MPI_Fint*) &bogus;
keyval_hash = OBJ_NEW(ompi_hash_table_t); keyval_hash = OBJ_NEW(opal_hash_table_t);
if (NULL == keyval_hash) { if (NULL == keyval_hash) {
return MPI_ERR_SYSRESOURCE; return MPI_ERR_SYSRESOURCE;
} }
@ -476,7 +476,7 @@ int ompi_attr_init(void)
} }
} }
if (OMPI_SUCCESS != (ret = ompi_hash_table_init(keyval_hash, if (OMPI_SUCCESS != (ret = opal_hash_table_init(keyval_hash,
ATTR_TABLE_SIZE))) { ATTR_TABLE_SIZE))) {
return ret; return ret;
} }
@ -527,7 +527,7 @@ int ompi_attr_create_keyval(ompi_attribute_type_t type,
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
ret = CREATE_KEY(key); ret = CREATE_KEY(key);
if (OMPI_SUCCESS == ret) { if (OMPI_SUCCESS == ret) {
ret = ompi_hash_table_set_value_uint32(keyval_hash, *key, attr); ret = opal_hash_table_set_value_uint32(keyval_hash, *key, attr);
} }
OMPI_THREAD_UNLOCK(&alock); OMPI_THREAD_UNLOCK(&alock);
if (OMPI_SUCCESS != ret) { if (OMPI_SUCCESS != ret) {
@ -564,7 +564,7 @@ int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
/* Find the key-value pair */ /* Find the key-value pair */
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
ret = ompi_hash_table_get_value_uint32(keyval_hash, *key, ret = opal_hash_table_get_value_uint32(keyval_hash, *key,
(void **) &key_item); (void **) &key_item);
OMPI_THREAD_UNLOCK(&alock); OMPI_THREAD_UNLOCK(&alock);
@ -589,7 +589,7 @@ int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
int ompi_attr_delete(ompi_attribute_type_t type, void *object, int ompi_attr_delete(ompi_attribute_type_t type, void *object,
ompi_hash_table_t *keyhash, int key, opal_hash_table_t *keyhash, int key,
bool predefined, bool need_lock) bool predefined, bool need_lock)
{ {
ompi_attrkey_item_t *key_item; ompi_attrkey_item_t *key_item;
@ -614,7 +614,7 @@ int ompi_attr_delete(ompi_attribute_type_t type, void *object,
/* Check if the key is valid in the master keyval hash */ /* Check if the key is valid in the master keyval hash */
ret = ompi_hash_table_get_value_uint32(keyval_hash, key, ret = opal_hash_table_get_value_uint32(keyval_hash, key,
(void **) &key_item); (void **) &key_item);
if ((OMPI_SUCCESS != ret) || (NULL == key_item) || if ((OMPI_SUCCESS != ret) || (NULL == key_item) ||
@ -635,7 +635,7 @@ int ompi_attr_delete(ompi_attribute_type_t type, void *object,
yes, then delete the attribute and key entry from the object's key yes, then delete the attribute and key entry from the object's key
hash */ hash */
ret = ompi_hash_table_get_value_uint32(keyhash, key, (void**) &attr); ret = opal_hash_table_get_value_uint32(keyhash, key, (void**) &attr);
if (OMPI_SUCCESS == ret) { if (OMPI_SUCCESS == ret) {
switch (type) { switch (type) {
case COMM_ATTR: case COMM_ATTR:
@ -658,7 +658,7 @@ int ompi_attr_delete(ompi_attribute_type_t type, void *object,
} }
OBJ_RELEASE(attr); OBJ_RELEASE(attr);
ret = ompi_hash_table_remove_value_uint32(keyhash, key); ret = opal_hash_table_remove_value_uint32(keyhash, key);
if (OMPI_SUCCESS != ret) { if (OMPI_SUCCESS != ret) {
goto exit; goto exit;
} }
@ -684,7 +684,7 @@ int ompi_attr_delete(ompi_attribute_type_t type, void *object,
* attribute. * attribute.
*/ */
int ompi_attr_set_c(ompi_attribute_type_t type, void *object, int ompi_attr_set_c(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, opal_hash_table_t **keyhash,
int key, void *attribute, bool predefined, bool need_lock) int key, void *attribute, bool predefined, bool need_lock)
{ {
attribute_value_t *new_attr = OBJ_NEW(attribute_value_t); attribute_value_t *new_attr = OBJ_NEW(attribute_value_t);
@ -704,7 +704,7 @@ int ompi_attr_set_c(ompi_attribute_type_t type, void *object,
* an attribute. * an attribute.
*/ */
int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object, int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, opal_hash_table_t **keyhash,
int key, MPI_Fint attribute, int key, MPI_Fint attribute,
bool predefined, bool need_lock) bool predefined, bool need_lock)
{ {
@ -726,7 +726,7 @@ int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object,
* an attribute. * an attribute.
*/ */
int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object, int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, opal_hash_table_t **keyhash,
int key, MPI_Aint attribute, int key, MPI_Aint attribute,
bool predefined, bool need_lock) bool predefined, bool need_lock)
{ {
@ -746,7 +746,7 @@ int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object,
* Front-end function called by the C MPI API functions to get * Front-end function called by the C MPI API functions to get
* attributes. * attributes.
*/ */
int ompi_attr_get_c(ompi_hash_table_t *keyhash, int key, int ompi_attr_get_c(opal_hash_table_t *keyhash, int key,
void **attribute, int *flag) void **attribute, int *flag)
{ {
attribute_value_t *val; attribute_value_t *val;
@ -765,7 +765,7 @@ int ompi_attr_get_c(ompi_hash_table_t *keyhash, int key,
* Front-end function called by the Fortran MPI-1 API functions to get * Front-end function called by the Fortran MPI-1 API functions to get
* attributes. * attributes.
*/ */
int ompi_attr_get_fortran_mpi1(ompi_hash_table_t *keyhash, int key, int ompi_attr_get_fortran_mpi1(opal_hash_table_t *keyhash, int key,
MPI_Fint *attribute, int *flag) MPI_Fint *attribute, int *flag)
{ {
attribute_value_t *val; attribute_value_t *val;
@ -784,7 +784,7 @@ int ompi_attr_get_fortran_mpi1(ompi_hash_table_t *keyhash, int key,
* Front-end function called by the Fortran MPI-2 API functions to get * Front-end function called by the Fortran MPI-2 API functions to get
* attributes. * attributes.
*/ */
int ompi_attr_get_fortran_mpi2(ompi_hash_table_t *keyhash, int key, int ompi_attr_get_fortran_mpi2(opal_hash_table_t *keyhash, int key,
MPI_Aint *attribute, int *flag) MPI_Aint *attribute, int *flag)
{ {
attribute_value_t *val; attribute_value_t *val;
@ -803,8 +803,8 @@ int ompi_attr_get_fortran_mpi2(ompi_hash_table_t *keyhash, int key,
* Copy all the attributes from one MPI object to another * Copy all the attributes from one MPI object to another
*/ */
int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object, int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
void *new_object, ompi_hash_table_t *oldkeyhash, void *new_object, opal_hash_table_t *oldkeyhash,
ompi_hash_table_t *newkeyhash) opal_hash_table_t *newkeyhash)
{ {
int ret; int ret;
int err; int err;
@ -833,7 +833,7 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
/* Get the first key-attr in the object's key hash */ /* Get the first key-attr in the object's key hash */
ret = ompi_hash_table_get_first_key_uint32(oldkeyhash, &key, ret = opal_hash_table_get_first_key_uint32(oldkeyhash, &key,
(void **) &old_attr, (void **) &old_attr,
&node); &node);
@ -845,7 +845,7 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
/* Get the attr_item in the main keyval hash - so that we know /* Get the attr_item in the main keyval hash - so that we know
what the copy_attr_fn is */ what the copy_attr_fn is */
err = ompi_hash_table_get_value_uint32(keyval_hash, key, err = opal_hash_table_get_value_uint32(keyval_hash, key,
(void **) &hash_value); (void **) &hash_value);
new_attr = OBJ_NEW(attribute_value_t); new_attr = OBJ_NEW(attribute_value_t);
@ -893,7 +893,7 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
OBJ_RELEASE(new_attr); OBJ_RELEASE(new_attr);
} }
ret = ompi_hash_table_get_next_key_uint32(oldkeyhash, &key, ret = opal_hash_table_get_next_key_uint32(oldkeyhash, &key,
(void **) &old_attr, (void **) &old_attr,
in_node, &node); in_node, &node);
} }
@ -909,7 +909,7 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
* Delete all the attributes on an MPI object * Delete all the attributes on an MPI object
*/ */
int ompi_attr_delete_all(ompi_attribute_type_t type, void *object, int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
ompi_hash_table_t *keyhash) opal_hash_table_t *keyhash)
{ {
int key_ret, del_ret; int key_ret, del_ret;
uint32_t key, oldkey; uint32_t key, oldkey;
@ -934,7 +934,7 @@ int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
/* Get the first key in local object's key hash */ /* Get the first key in local object's key hash */
key_ret = ompi_hash_table_get_first_key_uint32(keyhash, key_ret = opal_hash_table_get_first_key_uint32(keyhash,
&key, &old_attr, &key, &old_attr,
&node); &node);
del_ret = OMPI_SUCCESS; del_ret = OMPI_SUCCESS;
@ -948,7 +948,7 @@ int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
/* Move to the next node */ /* Move to the next node */
key_ret = ompi_hash_table_get_next_key_uint32(keyhash, key_ret = opal_hash_table_get_next_key_uint32(keyhash,
&key, &old_attr, &key, &old_attr,
in_node, &node); in_node, &node);
/* Now delete this attribute */ /* Now delete this attribute */
@ -968,7 +968,7 @@ int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
* Back-end function to set an attribute on an MPI object * Back-end function to set an attribute on an MPI object
*/ */
static int set_value(ompi_attribute_type_t type, void *object, static int set_value(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, int key, opal_hash_table_t **keyhash, int key,
attribute_value_t *new_attr, attribute_value_t *new_attr,
bool predefined, bool need_lock) bool predefined, bool need_lock)
{ {
@ -995,7 +995,7 @@ static int set_value(ompi_attribute_type_t type, void *object,
if (need_lock) { if (need_lock) {
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
} }
ret = ompi_hash_table_get_value_uint32(keyval_hash, key, ret = opal_hash_table_get_value_uint32(keyval_hash, key,
(void **) &key_item); (void **) &key_item);
/* If key not found */ /* If key not found */
@ -1018,7 +1018,7 @@ static int set_value(ompi_attribute_type_t type, void *object,
/* Now see if the key is present in the object's key hash. If so, /* Now see if the key is present in the object's key hash. If so,
delete the old attribute value. */ delete the old attribute value. */
ret = ompi_hash_table_get_value_uint32(*keyhash, key, (void**) &old_attr); ret = opal_hash_table_get_value_uint32(*keyhash, key, (void**) &old_attr);
if (OMPI_SUCCESS == ret) { if (OMPI_SUCCESS == ret) {
switch (type) { switch (type) {
case COMM_ATTR: case COMM_ATTR:
@ -1042,7 +1042,7 @@ static int set_value(ompi_attribute_type_t type, void *object,
OBJ_RELEASE(old_attr); OBJ_RELEASE(old_attr);
} }
ret = ompi_hash_table_set_value_uint32(*keyhash, key, new_attr); ret = opal_hash_table_set_value_uint32(*keyhash, key, new_attr);
if (need_lock) { if (need_lock) {
OMPI_THREAD_UNLOCK(&alock); OMPI_THREAD_UNLOCK(&alock);
@ -1067,7 +1067,7 @@ static int set_value(ompi_attribute_type_t type, void *object,
* in small, standalone functions that are called from several * in small, standalone functions that are called from several
* different places. * different places.
*/ */
static int get_value(ompi_hash_table_t *keyhash, int key, static int get_value(opal_hash_table_t *keyhash, int key,
attribute_value_t **attribute, int *flag) attribute_value_t **attribute, int *flag)
{ {
int ret; int ret;
@ -1081,7 +1081,7 @@ static int get_value(ompi_hash_table_t *keyhash, int key,
*flag = 0; *flag = 0;
OMPI_THREAD_LOCK(&alock); OMPI_THREAD_LOCK(&alock);
ret = ompi_hash_table_get_value_uint32(keyval_hash, key, ret = opal_hash_table_get_value_uint32(keyval_hash, key,
(void**) &key_item); (void**) &key_item);
if (OMPI_ERR_NOT_FOUND == ret) { if (OMPI_ERR_NOT_FOUND == ret) {
@ -1097,7 +1097,7 @@ static int get_value(ompi_hash_table_t *keyhash, int key,
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
ret = ompi_hash_table_get_value_uint32(keyhash, key, &attr); ret = opal_hash_table_get_value_uint32(keyhash, key, &attr);
OMPI_THREAD_UNLOCK(&alock); OMPI_THREAD_UNLOCK(&alock);
if (OMPI_SUCCESS == ret) { if (OMPI_SUCCESS == ret) {
*attribute = attr; *attribute = attr;

Просмотреть файл

@ -30,7 +30,7 @@
#include "include/constants.h" #include "include/constants.h"
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/gpr/gpr_types.h" #include "mca/gpr/gpr_types.h"
#define ATTR_HASH_SIZE 10 #define ATTR_HASH_SIZE 10
@ -167,14 +167,14 @@ typedef struct ompi_attrkey_item_t ompi_attrkey_item_t;
*/ */
static inline static inline
int ompi_attr_hash_init(ompi_hash_table_t **keyhash) int ompi_attr_hash_init(opal_hash_table_t **keyhash)
{ {
*keyhash = OBJ_NEW(ompi_hash_table_t); *keyhash = OBJ_NEW(opal_hash_table_t);
if (NULL == keyhash) { if (NULL == keyhash) {
fprintf(stderr, "Error while creating the local attribute list\n"); fprintf(stderr, "Error while creating the local attribute list\n");
return MPI_ERR_SYSRESOURCE; return MPI_ERR_SYSRESOURCE;
} }
if (OMPI_SUCCESS != ompi_hash_table_init(*keyhash, ATTR_HASH_SIZE)) { if (OMPI_SUCCESS != opal_hash_table_init(*keyhash, ATTR_HASH_SIZE)) {
return MPI_ERR_SYSRESOURCE; return MPI_ERR_SYSRESOURCE;
} }
@ -274,7 +274,7 @@ int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
* (read: better) this way. * (read: better) this way.
*/ */
int ompi_attr_set_c(ompi_attribute_type_t type, void *object, int ompi_attr_set_c(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, opal_hash_table_t **keyhash,
int key, void *attribute, bool predefined, bool need_lock); int key, void *attribute, bool predefined, bool need_lock);
/** /**
@ -311,7 +311,7 @@ int ompi_attr_set_c(ompi_attribute_type_t type, void *object,
* (read: better) this way. * (read: better) this way.
*/ */
int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object, int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, opal_hash_table_t **keyhash,
int key, MPI_Fint attribute, int key, MPI_Fint attribute,
bool predefined, bool need_lock); bool predefined, bool need_lock);
@ -349,7 +349,7 @@ int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object,
* (read: better) this way. * (read: better) this way.
*/ */
int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object, int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object,
ompi_hash_table_t **keyhash, opal_hash_table_t **keyhash,
int key, MPI_Aint attribute, int key, MPI_Aint attribute,
bool predefined, bool need_lock); bool predefined, bool need_lock);
@ -375,7 +375,7 @@ int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object,
* (read: better) this way. * (read: better) this way.
*/ */
int ompi_attr_get_c(ompi_hash_table_t *keyhash, int key, int ompi_attr_get_c(opal_hash_table_t *keyhash, int key,
void **attribute, int *flag); void **attribute, int *flag);
@ -402,7 +402,7 @@ int ompi_attr_get_c(ompi_hash_table_t *keyhash, int key,
* (read: better) this way. * (read: better) this way.
*/ */
int ompi_attr_get_fortran_mpi1(ompi_hash_table_t *keyhash, int key, int ompi_attr_get_fortran_mpi1(opal_hash_table_t *keyhash, int key,
MPI_Fint *attribute, int *flag); MPI_Fint *attribute, int *flag);
@ -429,7 +429,7 @@ int ompi_attr_get_fortran_mpi1(ompi_hash_table_t *keyhash, int key,
* (read: better) this way. * (read: better) this way.
*/ */
int ompi_attr_get_fortran_mpi2(ompi_hash_table_t *keyhash, int key, int ompi_attr_get_fortran_mpi2(opal_hash_table_t *keyhash, int key,
MPI_Aint *attribute, int *flag); MPI_Aint *attribute, int *flag);
@ -451,7 +451,7 @@ int ompi_attr_get_fortran_mpi2(ompi_hash_table_t *keyhash, int key,
*/ */
int ompi_attr_delete(ompi_attribute_type_t type, void *object, int ompi_attr_delete(ompi_attribute_type_t type, void *object,
ompi_hash_table_t *keyhash , int key, opal_hash_table_t *keyhash , int key,
bool predefined, bool need_lock); bool predefined, bool need_lock);
@ -469,8 +469,8 @@ int ompi_attr_delete(ompi_attribute_type_t type, void *object,
*/ */
int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object, int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
void *new_object, ompi_hash_table_t *oldkeyhash, void *new_object, opal_hash_table_t *oldkeyhash,
ompi_hash_table_t *newkeyhash); opal_hash_table_t *newkeyhash);
/** /**
@ -484,7 +484,7 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
*/ */
int ompi_attr_delete_all(ompi_attribute_type_t type, void *object, int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
ompi_hash_table_t *keyhash); opal_hash_table_t *keyhash);
/** /**

Просмотреть файл

@ -82,7 +82,7 @@ int ompi_comm_set ( ompi_communicator_t *newcomm,
ompi_proc_t **local_procs, ompi_proc_t **local_procs,
int remote_size, int remote_size,
ompi_proc_t **remote_procs, ompi_proc_t **remote_procs,
ompi_hash_table_t *attr, opal_hash_table_t *attr,
ompi_errhandler_t *errh, ompi_errhandler_t *errh,
mca_base_component_t *topocomponent ) mca_base_component_t *topocomponent )
{ {

Просмотреть файл

@ -18,7 +18,7 @@
#define OMPI_COMMUNICATOR_H #define OMPI_COMMUNICATOR_H
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "errhandler/errhandler.h" #include "errhandler/errhandler.h"
#include "threads/mutex.h" #include "threads/mutex.h"
@ -102,7 +102,7 @@ struct ompi_communicator_t {
ompi_group_t *c_remote_group; ompi_group_t *c_remote_group;
/* Attributes */ /* Attributes */
ompi_hash_table_t *c_keyhash; opal_hash_table_t *c_keyhash;
/**< inscribing cube dimension */ /**< inscribing cube dimension */
int c_cube_dim; int c_cube_dim;
@ -342,7 +342,7 @@ struct ompi_communicator_t {
ompi_proc_t **local_procs, ompi_proc_t **local_procs,
int remote_size, int remote_size,
ompi_proc_t **remote_procs, ompi_proc_t **remote_procs,
ompi_hash_table_t *attr, opal_hash_table_t *attr,
ompi_errhandler_t *errh, ompi_errhandler_t *errh,
mca_base_component_t *topocomponent ); mca_base_component_t *topocomponent );
/** /**

Просмотреть файл

@ -36,7 +36,7 @@
#include <string.h> #include <string.h>
#include "include/constants.h" #include "include/constants.h"
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "class/ompi_pointer_array.h" #include "class/ompi_pointer_array.h"
#include "mpi.h" #include "mpi.h"
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
@ -101,7 +101,7 @@ typedef struct ompi_datatype_t {
uint64_t bdt_used; /**< which basic datatypes are used in the data description */ uint64_t bdt_used; /**< which basic datatypes are used in the data description */
/* Attribute fields */ /* Attribute fields */
ompi_hash_table_t *d_keyhash; opal_hash_table_t *d_keyhash;
int32_t d_f_to_c_index; int32_t d_f_to_c_index;
char name[MPI_MAX_OBJECT_NAME]; char name[MPI_MAX_OBJECT_NAME];
dt_type_desc_t desc; /**< the data description */ dt_type_desc_t desc; /**< the data description */

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/pml/base/pml_base_module_exchange.h" #include "mca/pml/base/pml_base_module_exchange.h"
#include "btl_gm.h" #include "btl_gm.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/pml/base/pml_base_module_exchange.h" #include "mca/pml/base/pml_base_module_exchange.h"
#include "btl_mvapi.h" #include "btl_mvapi.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/pml/base/pml_base_module_exchange.h" #include "mca/pml/base/pml_base_module_exchange.h"
#include "btl_openib.h" #include "btl_openib.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/pml/base/pml_base_module_exchange.h" #include "mca/pml/base/pml_base_module_exchange.h"
#include "btl_template.h" #include "btl_template.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "threads/condition.h" #include "threads/condition.h"
#include "util/output.h" #include "util/output.h"
#include "util/proc_info.h" #include "util/proc_info.h"

Просмотреть файл

@ -19,7 +19,7 @@
#include <string.h> #include <string.h>
#include "include/sys/atomic.h" #include "include/sys/atomic.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/pml/base/pml_base_module_exchange.h" #include "mca/pml/base/pml_base_module_exchange.h"
#include "ptl_elan.h" #include "ptl_elan.h"
#include "ptl_elan_peer.h" #include "ptl_elan_peer.h"

Просмотреть файл

@ -23,7 +23,7 @@
#include <string.h> #include <string.h>
#include "include/sys/atomic.h" #include "include/sys/atomic.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/pml/base/pml_base_module_exchange.h" #include "mca/pml/base/pml_base_module_exchange.h"
#include "ptl_gm.h" #include "ptl_gm.h"
#include "ptl_gm_peer.h" #include "ptl_gm_peer.h"

Просмотреть файл

@ -45,7 +45,7 @@ struct mca_ptl_mx_component_t {
struct mca_ptl_mx_module_t** mx_ptls; /**< array of available PTL moduless */ struct mca_ptl_mx_module_t** mx_ptls; /**< array of available PTL moduless */
ompi_free_list_t mx_send_frags; /**< free list of mx send fragments */ ompi_free_list_t mx_send_frags; /**< free list of mx send fragments */
ompi_free_list_t mx_recv_frags; /**< free list of mx recv fragments */ ompi_free_list_t mx_recv_frags; /**< free list of mx recv fragments */
ompi_hash_table_t mx_procs; /**< hash table of procs */ opal_hash_table_t mx_procs; /**< hash table of procs */
opal_list_t mx_pending_acks; /**< queue of pending sends */ opal_list_t mx_pending_acks; /**< queue of pending sends */
ompi_mutex_t mx_lock; /**< lock for accessing module state */ ompi_mutex_t mx_lock; /**< lock for accessing module state */
}; };

Просмотреть файл

@ -98,8 +98,8 @@ int mca_ptl_mx_component_open(void)
OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_lock, ompi_mutex_t); OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_send_frags, ompi_free_list_t); OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_send_frags, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_recv_frags, ompi_free_list_t); OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_recv_frags, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_procs, ompi_hash_table_t); OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_procs, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_pending_acks, ompi_hash_table_t); OBJ_CONSTRUCT(&mca_ptl_mx_component.mx_pending_acks, opal_hash_table_t);
/* register MX module parameters */ /* register MX module parameters */
mca_ptl_mx_component.mx_filter = mca_ptl_mx_component.mx_filter =
@ -190,7 +190,7 @@ mca_ptl_base_module_t** mca_ptl_mx_component_init(
NULL); /* use default allocator */ NULL); /* use default allocator */
/* intialize process hash table */ /* intialize process hash table */
ompi_hash_table_init(&mca_ptl_mx_component.mx_procs, 256); opal_hash_table_init(&mca_ptl_mx_component.mx_procs, 256);
/* initialize mx ptls */ /* initialize mx ptls */
if(OMPI_SUCCESS != mca_ptl_mx_module_init()) if(OMPI_SUCCESS != mca_ptl_mx_module_init())

Просмотреть файл

@ -60,7 +60,7 @@ void mca_ptl_mx_proc_destruct(mca_ptl_mx_proc_t* proc)
{ {
/* remove from list of all proc instances */ /* remove from list of all proc instances */
OMPI_THREAD_LOCK(&mca_ptl_mx_component.mx_lock); OMPI_THREAD_LOCK(&mca_ptl_mx_component.mx_lock);
ompi_hash_table_remove_proc(&mca_ptl_mx_component.mx_procs, &proc->proc_name); opal_hash_table_remove_proc(&mca_ptl_mx_component.mx_procs, &proc->proc_name);
OMPI_THREAD_UNLOCK(&mca_ptl_mx_component.mx_lock); OMPI_THREAD_UNLOCK(&mca_ptl_mx_component.mx_lock);
/* release resources */ /* release resources */
@ -83,7 +83,7 @@ mca_ptl_mx_proc_t* mca_ptl_mx_proc_create(ompi_proc_t* ompi_proc)
mca_ptl_mx_proc_t* ptl_proc; mca_ptl_mx_proc_t* ptl_proc;
OMPI_THREAD_LOCK(&mca_ptl_mx_component.mx_lock); OMPI_THREAD_LOCK(&mca_ptl_mx_component.mx_lock);
ptl_proc = (mca_ptl_mx_proc_t*)ompi_hash_table_get_proc( ptl_proc = (mca_ptl_mx_proc_t*)opal_hash_table_get_proc(
&mca_ptl_mx_component.mx_procs, &ompi_proc->proc_name); &mca_ptl_mx_component.mx_procs, &ompi_proc->proc_name);
if(NULL != ptl_proc) { if(NULL != ptl_proc) {
OMPI_THREAD_UNLOCK(&mca_ptl_mx_component.mx_lock); OMPI_THREAD_UNLOCK(&mca_ptl_mx_component.mx_lock);
@ -97,7 +97,7 @@ mca_ptl_mx_proc_t* mca_ptl_mx_proc_create(ompi_proc_t* ompi_proc)
ptl_proc->proc_name = ompi_proc->proc_name; ptl_proc->proc_name = ompi_proc->proc_name;
/* add to hash table of all proc instance */ /* add to hash table of all proc instance */
ompi_hash_table_set_proc( opal_hash_table_set_proc(
&mca_ptl_mx_component.mx_procs, &mca_ptl_mx_component.mx_procs,
&ptl_proc->proc_name, &ptl_proc->proc_name,
ptl_proc); ptl_proc);
@ -139,7 +139,7 @@ mca_ptl_mx_proc_t* mca_ptl_mx_proc_lookup(const ompi_process_name_t *name)
{ {
mca_ptl_mx_proc_t* proc; mca_ptl_mx_proc_t* proc;
OMPI_THREAD_LOCK(&mca_ptl_mx_component.mx_lock); OMPI_THREAD_LOCK(&mca_ptl_mx_component.mx_lock);
proc = (mca_ptl_mx_proc_t*)ompi_hash_table_get_proc( proc = (mca_ptl_mx_proc_t*)opal_hash_table_get_proc(
&mca_ptl_mx_component.mx_procs, name); &mca_ptl_mx_component.mx_procs, name);
OMPI_THREAD_UNLOCK(&mca_ptl_mx_component.mx_lock); OMPI_THREAD_UNLOCK(&mca_ptl_mx_component.mx_lock);
return proc; return proc;

Просмотреть файл

@ -59,7 +59,7 @@ struct mca_ptl_tcp_component_t {
size_t tcp_frag_size; /**< buffer limit for the TCP PTL */ size_t tcp_frag_size; /**< buffer limit for the TCP PTL */
ompi_free_list_t tcp_send_frags; /**< free list of tcp send fragments */ ompi_free_list_t tcp_send_frags; /**< free list of tcp send fragments */
ompi_free_list_t tcp_recv_frags; /**< free list of tcp recv fragments */ ompi_free_list_t tcp_recv_frags; /**< free list of tcp recv fragments */
ompi_hash_table_t tcp_procs; /**< hash table of tcp proc structures */ opal_hash_table_t tcp_procs; /**< hash table of tcp proc structures */
opal_list_t tcp_pending_acks; /**< list of pending acks - retry as sends complete */ opal_list_t tcp_pending_acks; /**< list of pending acks - retry as sends complete */
opal_list_t tcp_events; /**< list of pending events */ opal_list_t tcp_events; /**< list of pending events */
struct mca_ptl_tcp_proc_t* tcp_local; /**< the tcp proc instance corresponding to the local process */ struct mca_ptl_tcp_proc_t* tcp_local; /**< the tcp proc instance corresponding to the local process */

Просмотреть файл

@ -178,12 +178,12 @@ int mca_ptl_tcp_component_open(void)
/* initialize objects */ /* initialize objects */
OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_lock, ompi_mutex_t); OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_procs, ompi_hash_table_t); OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_procs, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_pending_acks, opal_list_t); OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_pending_acks, opal_list_t);
OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_events, opal_list_t); OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_send_frags, ompi_free_list_t); OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_send_frags, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_recv_frags, ompi_free_list_t); OBJ_CONSTRUCT(&mca_ptl_tcp_component.tcp_recv_frags, ompi_free_list_t);
ompi_hash_table_init(&mca_ptl_tcp_component.tcp_procs, 256); opal_hash_table_init(&mca_ptl_tcp_component.tcp_procs, 256);
/* register TCP module parameters */ /* register TCP module parameters */
mca_ptl_tcp_component.tcp_if_include = mca_ptl_tcp_component.tcp_if_include =
@ -538,7 +538,7 @@ int mca_ptl_tcp_component_control(int param, void* value, size_t size)
case MCA_PTL_ENABLE: case MCA_PTL_ENABLE:
if(*(int*)value) { if(*(int*)value) {
ompi_event_add(&mca_ptl_tcp_component.tcp_recv_event, 0); ompi_event_add(&mca_ptl_tcp_component.tcp_recv_event, 0);
if(ompi_hash_table_get_size(&mca_ptl_tcp_component.tcp_procs) > 0) { if(opal_hash_table_get_size(&mca_ptl_tcp_component.tcp_procs) > 0) {
ompi_progress_events(OMPI_EVLOOP_NONBLOCK); ompi_progress_events(OMPI_EVLOOP_NONBLOCK);
} }
} else { } else {

Просмотреть файл

@ -62,7 +62,7 @@ void mca_ptl_tcp_proc_destruct(mca_ptl_tcp_proc_t* proc)
{ {
/* remove from list of all proc instances */ /* remove from list of all proc instances */
OMPI_THREAD_LOCK(&mca_ptl_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_ptl_tcp_component.tcp_lock);
ompi_hash_table_remove_proc(&mca_ptl_tcp_component.tcp_procs, &proc->proc_name); opal_hash_table_remove_proc(&mca_ptl_tcp_component.tcp_procs, &proc->proc_name);
OMPI_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock);
/* release resources */ /* release resources */
@ -86,7 +86,7 @@ mca_ptl_tcp_proc_t* mca_ptl_tcp_proc_create(ompi_proc_t* ompi_proc)
mca_ptl_tcp_proc_t* ptl_proc; mca_ptl_tcp_proc_t* ptl_proc;
OMPI_THREAD_LOCK(&mca_ptl_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_ptl_tcp_component.tcp_lock);
ptl_proc = (mca_ptl_tcp_proc_t*)ompi_hash_table_get_proc( ptl_proc = (mca_ptl_tcp_proc_t*)opal_hash_table_get_proc(
&mca_ptl_tcp_component.tcp_procs, &ompi_proc->proc_name); &mca_ptl_tcp_component.tcp_procs, &ompi_proc->proc_name);
if(NULL != ptl_proc) { if(NULL != ptl_proc) {
OMPI_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock);
@ -100,7 +100,7 @@ mca_ptl_tcp_proc_t* mca_ptl_tcp_proc_create(ompi_proc_t* ompi_proc)
ptl_proc->proc_name = ompi_proc->proc_name; ptl_proc->proc_name = ompi_proc->proc_name;
/* add to hash table of all proc instance */ /* add to hash table of all proc instance */
ompi_hash_table_set_proc( opal_hash_table_set_proc(
&mca_ptl_tcp_component.tcp_procs, &mca_ptl_tcp_component.tcp_procs,
&ptl_proc->proc_name, &ptl_proc->proc_name,
ptl_proc); ptl_proc);
@ -143,7 +143,7 @@ mca_ptl_tcp_proc_t* mca_ptl_tcp_proc_lookup(const orte_process_name_t *name)
{ {
mca_ptl_tcp_proc_t* proc; mca_ptl_tcp_proc_t* proc;
OMPI_THREAD_LOCK(&mca_ptl_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_ptl_tcp_component.tcp_lock);
proc = (mca_ptl_tcp_proc_t*)ompi_hash_table_get_proc( proc = (mca_ptl_tcp_proc_t*)opal_hash_table_get_proc(
&mca_ptl_tcp_component.tcp_procs, name); &mca_ptl_tcp_component.tcp_procs, name);
OMPI_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock);
return proc; return proc;

Просмотреть файл

@ -21,7 +21,7 @@
#include "mpi.h" #include "mpi.h"
#include "errhandler/errhandler.h" #include "errhandler/errhandler.h"
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
@ -35,7 +35,7 @@ struct ompi_win_t {
/* Attributes */ /* Attributes */
ompi_hash_table_t *w_keyhash; opal_hash_table_t *w_keyhash;
/* index in Fortran <-> C translation array */ /* index in Fortran <-> C translation array */

Просмотреть файл

@ -23,7 +23,7 @@ noinst_LTLIBRARIES = libclass.la
headers = \ headers = \
opal_free_list.h \ opal_free_list.h \
ompi_hash_table.h \ opal_hash_table.h \
opal_list.h \ opal_list.h \
opal_object.h \ opal_object.h \
opal_value_array.h opal_value_array.h
@ -31,7 +31,7 @@ headers = \
libclass_la_SOURCES = \ libclass_la_SOURCES = \
$(headers) \ $(headers) \
opal_free_list.c \ opal_free_list.c \
ompi_hash_table.c \ opal_hash_table.c \
opal_list.c \ opal_list.c \
opal_object.c \ opal_object.c \
opal_value_array.c opal_value_array.c

Просмотреть файл

@ -22,27 +22,27 @@
#include "include/constants.h" #include "include/constants.h"
#include "util/output.h" #include "util/output.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
/* /*
* ompi_hash_table_t * opal_hash_table_t
*/ */
#define HASH_MULTIPLIER 31 #define HASH_MULTIPLIER 31
static void ompi_hash_table_construct(ompi_hash_table_t* ht); static void opal_hash_table_construct(opal_hash_table_t* ht);
static void ompi_hash_table_destruct(ompi_hash_table_t* ht); static void opal_hash_table_destruct(opal_hash_table_t* ht);
OBJ_CLASS_INSTANCE( OBJ_CLASS_INSTANCE(
ompi_hash_table_t, opal_hash_table_t,
opal_object_t, opal_object_t,
ompi_hash_table_construct, opal_hash_table_construct,
ompi_hash_table_destruct opal_hash_table_destruct
); );
static void ompi_hash_table_construct(ompi_hash_table_t* ht) static void opal_hash_table_construct(opal_hash_table_t* ht)
{ {
OBJ_CONSTRUCT(&ht->ht_nodes, opal_list_t); OBJ_CONSTRUCT(&ht->ht_nodes, opal_list_t);
ht->ht_table = NULL; ht->ht_table = NULL;
@ -51,10 +51,10 @@ static void ompi_hash_table_construct(ompi_hash_table_t* ht)
} }
static void ompi_hash_table_destruct(ompi_hash_table_t* ht) static void opal_hash_table_destruct(opal_hash_table_t* ht)
{ {
size_t i; size_t i;
ompi_hash_table_remove_all(ht); opal_hash_table_remove_all(ht);
for(i=0; i<ht->ht_table_size; i++) { for(i=0; i<ht->ht_table_size; i++) {
OBJ_DESTRUCT(ht->ht_table+i); OBJ_DESTRUCT(ht->ht_table+i);
} }
@ -65,7 +65,7 @@ static void ompi_hash_table_destruct(ompi_hash_table_t* ht)
} }
int ompi_hash_table_init(ompi_hash_table_t* ht, size_t table_size) int opal_hash_table_init(opal_hash_table_t* ht, size_t table_size)
{ {
size_t i; size_t i;
size_t power2 = 1; size_t power2 = 1;
@ -88,7 +88,7 @@ int ompi_hash_table_init(ompi_hash_table_t* ht, size_t table_size)
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int ompi_hash_table_remove_all(ompi_hash_table_t* ht) int opal_hash_table_remove_all(opal_hash_table_t* ht)
{ {
size_t i; size_t i;
for(i=0; i<ht->ht_table_size; i++) { for(i=0; i<ht->ht_table_size; i++) {
@ -110,39 +110,39 @@ int ompi_hash_table_remove_all(ompi_hash_table_t* ht)
/***************************************************************************/ /***************************************************************************/
/* /*
* ompi_uint32_hash_node_t * opal_uint32_hash_node_t
*/ */
struct ompi_uint32_hash_node_t struct opal_uint32_hash_node_t
{ {
opal_list_item_t super; opal_list_item_t super;
uint32_t hn_key; uint32_t hn_key;
void *hn_value; void *hn_value;
}; };
typedef struct ompi_uint32_hash_node_t ompi_uint32_hash_node_t; typedef struct opal_uint32_hash_node_t opal_uint32_hash_node_t;
static OBJ_CLASS_INSTANCE(ompi_uint32_hash_node_t, static OBJ_CLASS_INSTANCE(opal_uint32_hash_node_t,
opal_list_item_t, opal_list_item_t,
NULL, NULL,
NULL); NULL);
int ompi_hash_table_get_value_uint32(ompi_hash_table_t* ht, uint32_t key, int opal_hash_table_get_value_uint32(opal_hash_table_t* ht, uint32_t key,
void **ptr) void **ptr)
{ {
opal_list_t* list = ht->ht_table + (key & ht->ht_mask); opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
ompi_uint32_hash_node_t *node; opal_uint32_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_get_value_uint32:" ompi_output(0, "opal_hash_table_get_value_uint32:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERROR; return OMPI_ERROR;
} }
#endif #endif
for(node = (ompi_uint32_hash_node_t*)opal_list_get_first(list); for(node = (opal_uint32_hash_node_t*)opal_list_get_first(list);
node != (ompi_uint32_hash_node_t*)opal_list_get_end(list); node != (opal_uint32_hash_node_t*)opal_list_get_end(list);
node = (ompi_uint32_hash_node_t*)opal_list_get_next(node)) { node = (opal_uint32_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) { if (node->hn_key == key) {
*ptr = node->hn_value; *ptr = node->hn_value;
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -152,31 +152,31 @@ int ompi_hash_table_get_value_uint32(ompi_hash_table_t* ht, uint32_t key,
} }
int ompi_hash_table_set_value_uint32(ompi_hash_table_t* ht, int opal_hash_table_set_value_uint32(opal_hash_table_t* ht,
uint32_t key, void* value) uint32_t key, void* value)
{ {
opal_list_t* list = ht->ht_table + (key & ht->ht_mask); opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
ompi_uint32_hash_node_t *node; opal_uint32_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_set_value_uint32:" ompi_output(0, "opal_hash_table_set_value_uint32:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
for(node = (ompi_uint32_hash_node_t*)opal_list_get_first(list); for(node = (opal_uint32_hash_node_t*)opal_list_get_first(list);
node != (ompi_uint32_hash_node_t*)opal_list_get_end(list); node != (opal_uint32_hash_node_t*)opal_list_get_end(list);
node = (ompi_uint32_hash_node_t*)opal_list_get_next(node)) { node = (opal_uint32_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) { if (node->hn_key == key) {
node->hn_value = value; node->hn_value = value;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
} }
node = (ompi_uint32_hash_node_t*)opal_list_remove_first(&ht->ht_nodes); node = (opal_uint32_hash_node_t*)opal_list_remove_first(&ht->ht_nodes);
if(NULL == node) { if(NULL == node) {
node = OBJ_NEW(ompi_uint32_hash_node_t); node = OBJ_NEW(opal_uint32_hash_node_t);
if(NULL == node) if(NULL == node)
return OMPI_ERR_OUT_OF_RESOURCE; return OMPI_ERR_OUT_OF_RESOURCE;
} }
@ -188,21 +188,21 @@ int ompi_hash_table_set_value_uint32(ompi_hash_table_t* ht,
} }
int ompi_hash_table_remove_value_uint32(ompi_hash_table_t* ht, uint32_t key) int opal_hash_table_remove_value_uint32(opal_hash_table_t* ht, uint32_t key)
{ {
opal_list_t* list = ht->ht_table + (key & ht->ht_mask); opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
ompi_uint32_hash_node_t *node; opal_uint32_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_remove_value_uint32:" ompi_output(0, "opal_hash_table_remove_value_uint32:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
for(node = (ompi_uint32_hash_node_t*)opal_list_get_first(list); for(node = (opal_uint32_hash_node_t*)opal_list_get_first(list);
node != (ompi_uint32_hash_node_t*)opal_list_get_end(list); node != (opal_uint32_hash_node_t*)opal_list_get_end(list);
node = (ompi_uint32_hash_node_t*)opal_list_get_next(node)) { node = (opal_uint32_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) { if (node->hn_key == key) {
opal_list_remove_item(list, (opal_list_item_t*)node); opal_list_remove_item(list, (opal_list_item_t*)node);
opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node); opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node);
@ -216,39 +216,39 @@ int ompi_hash_table_remove_value_uint32(ompi_hash_table_t* ht, uint32_t key)
/***************************************************************************/ /***************************************************************************/
/* /*
* ompi_uint64_hash_node_t * opal_uint64_hash_node_t
*/ */
struct ompi_uint64_hash_node_t struct opal_uint64_hash_node_t
{ {
opal_list_item_t super; opal_list_item_t super;
uint64_t hn_key; uint64_t hn_key;
void* hn_value; void* hn_value;
}; };
typedef struct ompi_uint64_hash_node_t ompi_uint64_hash_node_t; typedef struct opal_uint64_hash_node_t opal_uint64_hash_node_t;
static OBJ_CLASS_INSTANCE(ompi_uint64_hash_node_t, static OBJ_CLASS_INSTANCE(opal_uint64_hash_node_t,
opal_list_item_t, opal_list_item_t,
NULL, NULL,
NULL); NULL);
int ompi_hash_table_get_value_uint64(ompi_hash_table_t* ht, uint64_t key, int opal_hash_table_get_value_uint64(opal_hash_table_t* ht, uint64_t key,
void **ptr) void **ptr)
{ {
opal_list_t* list = ht->ht_table + (key & ht->ht_mask); opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
ompi_uint64_hash_node_t *node; opal_uint64_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_get_value_uint64:" ompi_output(0, "opal_hash_table_get_value_uint64:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERROR; return OMPI_ERROR;
} }
#endif #endif
for(node = (ompi_uint64_hash_node_t*)opal_list_get_first(list); for(node = (opal_uint64_hash_node_t*)opal_list_get_first(list);
node != (ompi_uint64_hash_node_t*)opal_list_get_end(list); node != (opal_uint64_hash_node_t*)opal_list_get_end(list);
node = (ompi_uint64_hash_node_t*)opal_list_get_next(node)) { node = (opal_uint64_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) { if (node->hn_key == key) {
*ptr = node->hn_value; *ptr = node->hn_value;
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -258,31 +258,31 @@ int ompi_hash_table_get_value_uint64(ompi_hash_table_t* ht, uint64_t key,
} }
int ompi_hash_table_set_value_uint64(ompi_hash_table_t* ht, int opal_hash_table_set_value_uint64(opal_hash_table_t* ht,
uint64_t key, void* value) uint64_t key, void* value)
{ {
opal_list_t* list = ht->ht_table + (key & ht->ht_mask); opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
ompi_uint64_hash_node_t *node; opal_uint64_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_set_value_uint64:" ompi_output(0, "opal_hash_table_set_value_uint64:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
for(node = (ompi_uint64_hash_node_t*)opal_list_get_first(list); for(node = (opal_uint64_hash_node_t*)opal_list_get_first(list);
node != (ompi_uint64_hash_node_t*)opal_list_get_end(list); node != (opal_uint64_hash_node_t*)opal_list_get_end(list);
node = (ompi_uint64_hash_node_t*)opal_list_get_next(node)) { node = (opal_uint64_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) { if (node->hn_key == key) {
node->hn_value = value; node->hn_value = value;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
} }
node = (ompi_uint64_hash_node_t*)opal_list_remove_first(&ht->ht_nodes); node = (opal_uint64_hash_node_t*)opal_list_remove_first(&ht->ht_nodes);
if(NULL == node) { if(NULL == node) {
node = OBJ_NEW(ompi_uint64_hash_node_t); node = OBJ_NEW(opal_uint64_hash_node_t);
if(NULL == node) { if(NULL == node) {
return OMPI_ERR_OUT_OF_RESOURCE; return OMPI_ERR_OUT_OF_RESOURCE;
} }
@ -295,21 +295,21 @@ int ompi_hash_table_set_value_uint64(ompi_hash_table_t* ht,
} }
int ompi_hash_table_remove_value_uint64(ompi_hash_table_t* ht, uint64_t key) int opal_hash_table_remove_value_uint64(opal_hash_table_t* ht, uint64_t key)
{ {
opal_list_t* list = ht->ht_table + (key & ht->ht_mask); opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
ompi_uint64_hash_node_t *node; opal_uint64_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_remove_value_uint64:" ompi_output(0, "opal_hash_table_remove_value_uint64:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
for(node = (ompi_uint64_hash_node_t*)opal_list_get_first(list); for(node = (opal_uint64_hash_node_t*)opal_list_get_first(list);
node != (ompi_uint64_hash_node_t*)opal_list_get_end(list); node != (opal_uint64_hash_node_t*)opal_list_get_end(list);
node = (ompi_uint64_hash_node_t*)opal_list_get_next(node)) { node = (opal_uint64_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key == key) { if (node->hn_key == key) {
opal_list_remove_item(list, (opal_list_item_t*)node); opal_list_remove_item(list, (opal_list_item_t*)node);
opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node); opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node);
@ -323,36 +323,36 @@ int ompi_hash_table_remove_value_uint64(ompi_hash_table_t* ht, uint64_t key)
/***************************************************************************/ /***************************************************************************/
/* /*
* ompi_ptr_hash_node_t * opal_ptr_hash_node_t
*/ */
struct ompi_ptr_hash_node_t struct opal_ptr_hash_node_t
{ {
opal_list_item_t super; opal_list_item_t super;
void* hn_key; void* hn_key;
size_t hn_key_size; size_t hn_key_size;
void* hn_value; void* hn_value;
}; };
typedef struct ompi_ptr_hash_node_t ompi_ptr_hash_node_t; typedef struct opal_ptr_hash_node_t opal_ptr_hash_node_t;
static void ompi_ptr_hash_node_construct(ompi_ptr_hash_node_t* hn) static void opal_ptr_hash_node_construct(opal_ptr_hash_node_t* hn)
{ {
hn->hn_key_size = 0; hn->hn_key_size = 0;
hn->hn_key = NULL; hn->hn_key = NULL;
hn->hn_value = NULL; hn->hn_value = NULL;
} }
static void ompi_ptr_hash_node_destruct(ompi_ptr_hash_node_t* hn) static void opal_ptr_hash_node_destruct(opal_ptr_hash_node_t* hn)
{ {
if(NULL != hn->hn_key) { if(NULL != hn->hn_key) {
free(hn->hn_key); free(hn->hn_key);
} }
} }
static OBJ_CLASS_INSTANCE(ompi_ptr_hash_node_t, static OBJ_CLASS_INSTANCE(opal_ptr_hash_node_t,
opal_list_item_t, opal_list_item_t,
ompi_ptr_hash_node_construct, opal_ptr_hash_node_construct,
ompi_ptr_hash_node_destruct); opal_ptr_hash_node_destruct);
static inline uint32_t ompi_hash_value(size_t mask, const void *key, static inline uint32_t ompi_hash_value(size_t mask, const void *key,
@ -368,23 +368,23 @@ static inline uint32_t ompi_hash_value(size_t mask, const void *key,
return (h & mask); return (h & mask);
} }
int ompi_hash_table_get_value_ptr(ompi_hash_table_t* ht, const void* key, int opal_hash_table_get_value_ptr(opal_hash_table_t* ht, const void* key,
size_t key_size, void **ptr) size_t key_size, void **ptr)
{ {
opal_list_t* list = ht->ht_table + ompi_hash_value(ht->ht_mask, key, opal_list_t* list = ht->ht_table + ompi_hash_value(ht->ht_mask, key,
key_size); key_size);
ompi_ptr_hash_node_t *node; opal_ptr_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_get_value_ptr:" ompi_output(0, "opal_hash_table_get_value_ptr:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERROR; return OMPI_ERROR;
} }
#endif #endif
for(node = (ompi_ptr_hash_node_t*)opal_list_get_first(list); for(node = (opal_ptr_hash_node_t*)opal_list_get_first(list);
node != (ompi_ptr_hash_node_t*)opal_list_get_end(list); node != (opal_ptr_hash_node_t*)opal_list_get_end(list);
node = (ompi_ptr_hash_node_t*)opal_list_get_next(node)) { node = (opal_ptr_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key_size == key_size && if (node->hn_key_size == key_size &&
memcmp(node->hn_key, key, key_size) == 0) { memcmp(node->hn_key, key, key_size) == 0) {
*ptr = node->hn_value; *ptr = node->hn_value;
@ -395,23 +395,23 @@ int ompi_hash_table_get_value_ptr(ompi_hash_table_t* ht, const void* key,
} }
int ompi_hash_table_set_value_ptr(ompi_hash_table_t* ht, const void* key, int opal_hash_table_set_value_ptr(opal_hash_table_t* ht, const void* key,
size_t key_size, void* value) size_t key_size, void* value)
{ {
opal_list_t* list = ht->ht_table + ompi_hash_value(ht->ht_mask, key, opal_list_t* list = ht->ht_table + ompi_hash_value(ht->ht_mask, key,
key_size); key_size);
ompi_ptr_hash_node_t *node; opal_ptr_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_set_value_ptr:" ompi_output(0, "opal_hash_table_set_value_ptr:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
for(node = (ompi_ptr_hash_node_t*)opal_list_get_first(list); for(node = (opal_ptr_hash_node_t*)opal_list_get_first(list);
node != (ompi_ptr_hash_node_t*)opal_list_get_end(list); node != (opal_ptr_hash_node_t*)opal_list_get_end(list);
node = (ompi_ptr_hash_node_t*)opal_list_get_next(node)) { node = (opal_ptr_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key_size == key_size && if (node->hn_key_size == key_size &&
memcmp(node->hn_key, key, key_size) == 0) { memcmp(node->hn_key, key, key_size) == 0) {
node->hn_value = value; node->hn_value = value;
@ -419,9 +419,9 @@ int ompi_hash_table_set_value_ptr(ompi_hash_table_t* ht, const void* key,
} }
} }
node = (ompi_ptr_hash_node_t*)opal_list_remove_first(&ht->ht_nodes); node = (opal_ptr_hash_node_t*)opal_list_remove_first(&ht->ht_nodes);
if(NULL == node) { if(NULL == node) {
node = OBJ_NEW(ompi_ptr_hash_node_t); node = OBJ_NEW(opal_ptr_hash_node_t);
if(NULL == node) { if(NULL == node) {
return OMPI_ERR_OUT_OF_RESOURCE; return OMPI_ERR_OUT_OF_RESOURCE;
} }
@ -436,23 +436,23 @@ int ompi_hash_table_set_value_ptr(ompi_hash_table_t* ht, const void* key,
} }
int ompi_hash_table_remove_value_ptr(ompi_hash_table_t* ht, int opal_hash_table_remove_value_ptr(opal_hash_table_t* ht,
const void* key, size_t key_size) const void* key, size_t key_size)
{ {
opal_list_t* list = ht->ht_table + ompi_hash_value(ht->ht_mask, opal_list_t* list = ht->ht_table + ompi_hash_value(ht->ht_mask,
key, key_size); key, key_size);
ompi_ptr_hash_node_t *node; opal_ptr_hash_node_t *node;
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_remove_value_ptr: " ompi_output(0, "opal_hash_table_remove_value_ptr: "
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
for(node = (ompi_ptr_hash_node_t*)opal_list_get_first(list); for(node = (opal_ptr_hash_node_t*)opal_list_get_first(list);
node != (ompi_ptr_hash_node_t*)opal_list_get_end(list); node != (opal_ptr_hash_node_t*)opal_list_get_end(list);
node = (ompi_ptr_hash_node_t*)opal_list_get_next(node)) { node = (opal_ptr_hash_node_t*)opal_list_get_next(node)) {
if (node->hn_key_size == key_size && if (node->hn_key_size == key_size &&
memcmp(node->hn_key, key, key_size) == 0) { memcmp(node->hn_key, key, key_size) == 0) {
free(node->hn_key); free(node->hn_key);
@ -469,18 +469,18 @@ int ompi_hash_table_remove_value_ptr(ompi_hash_table_t* ht,
int int
ompi_hash_table_get_first_key_uint32(ompi_hash_table_t *ht, uint32_t *key, opal_hash_table_get_first_key_uint32(opal_hash_table_t *ht, uint32_t *key,
void **value, void **node) void **value, void **node)
{ {
size_t i; size_t i;
ompi_uint32_hash_node_t *list_node; opal_uint32_hash_node_t *list_node;
/* Go through all the lists and return the first element off the /* Go through all the lists and return the first element off the
first non-empty list */ first non-empty list */
for (i = 0; i < ht->ht_table_size; ++i) { for (i = 0; i < ht->ht_table_size; ++i) {
if (opal_list_get_size(ht->ht_table + i) > 0) { if (opal_list_get_size(ht->ht_table + i) > 0) {
list_node = (ompi_uint32_hash_node_t*) list_node = (opal_uint32_hash_node_t*)
opal_list_get_first(ht->ht_table + i); opal_list_get_first(ht->ht_table + i);
*node = list_node; *node = list_node;
*key = list_node->hn_key; *key = list_node->hn_key;
@ -496,19 +496,19 @@ ompi_hash_table_get_first_key_uint32(ompi_hash_table_t *ht, uint32_t *key,
int int
ompi_hash_table_get_next_key_uint32(ompi_hash_table_t *ht, uint32_t *key, opal_hash_table_get_next_key_uint32(opal_hash_table_t *ht, uint32_t *key,
void **value, void *in_node, void **value, void *in_node,
void **out_node) void **out_node)
{ {
size_t i; size_t i;
opal_list_t *list; opal_list_t *list;
opal_list_item_t *item; opal_list_item_t *item;
ompi_uint32_hash_node_t *next; opal_uint32_hash_node_t *next;
/* Try to simply get the next value in the list. If there isn't /* Try to simply get the next value in the list. If there isn't
one, find the next non-empty list and take the first value */ one, find the next non-empty list and take the first value */
next = (ompi_uint32_hash_node_t*) in_node; next = (opal_uint32_hash_node_t*) in_node;
list = ht->ht_table + (next->hn_key & ht->ht_mask); list = ht->ht_table + (next->hn_key & ht->ht_mask);
item = opal_list_get_next(next); item = opal_list_get_next(next);
if (opal_list_get_end(list) == item) { if (opal_list_get_end(list) == item) {
@ -532,7 +532,7 @@ ompi_hash_table_get_next_key_uint32(ompi_hash_table_t *ht, uint32_t *key,
typecasting) */ typecasting) */
*out_node = (void *) item; *out_node = (void *) item;
next = (ompi_uint32_hash_node_t *) *out_node; next = (opal_uint32_hash_node_t *) *out_node;
*key = next->hn_key; *key = next->hn_key;
*value = next->hn_value; *value = next->hn_value;
@ -541,18 +541,18 @@ ompi_hash_table_get_next_key_uint32(ompi_hash_table_t *ht, uint32_t *key,
int int
ompi_hash_table_get_first_key_uint64(ompi_hash_table_t *ht, uint64_t *key, opal_hash_table_get_first_key_uint64(opal_hash_table_t *ht, uint64_t *key,
void **value, void **node) void **value, void **node)
{ {
size_t i; size_t i;
ompi_uint64_hash_node_t *list_node; opal_uint64_hash_node_t *list_node;
/* Go through all the lists and return the first element off the /* Go through all the lists and return the first element off the
first non-empty list */ first non-empty list */
for (i = 0; i < ht->ht_table_size; ++i) { for (i = 0; i < ht->ht_table_size; ++i) {
if (opal_list_get_size(ht->ht_table + i) > 0) { if (opal_list_get_size(ht->ht_table + i) > 0) {
list_node = (ompi_uint64_hash_node_t*) list_node = (opal_uint64_hash_node_t*)
opal_list_get_first(ht->ht_table + i); opal_list_get_first(ht->ht_table + i);
*node = list_node; *node = list_node;
*key = list_node->hn_key; *key = list_node->hn_key;
@ -568,19 +568,19 @@ ompi_hash_table_get_first_key_uint64(ompi_hash_table_t *ht, uint64_t *key,
int int
ompi_hash_table_get_next_key_uint64(ompi_hash_table_t *ht, uint64_t *key, opal_hash_table_get_next_key_uint64(opal_hash_table_t *ht, uint64_t *key,
void **value, void *in_node, void **value, void *in_node,
void **out_node) void **out_node)
{ {
size_t i; size_t i;
opal_list_t *list; opal_list_t *list;
opal_list_item_t *item; opal_list_item_t *item;
ompi_uint64_hash_node_t *next; opal_uint64_hash_node_t *next;
/* Try to simply get the next value in the list. If there isn't /* Try to simply get the next value in the list. If there isn't
one, find the next non-empty list and take the first value */ one, find the next non-empty list and take the first value */
next = (ompi_uint64_hash_node_t*) in_node; next = (opal_uint64_hash_node_t*) in_node;
list = ht->ht_table + (next->hn_key & ht->ht_mask); list = ht->ht_table + (next->hn_key & ht->ht_mask);
item = opal_list_get_next(next); item = opal_list_get_next(next);
if (opal_list_get_end(list) == item) { if (opal_list_get_end(list) == item) {
@ -604,7 +604,7 @@ ompi_hash_table_get_next_key_uint64(ompi_hash_table_t *ht, uint64_t *key,
typecasting) */ typecasting) */
*out_node = (void *) item; *out_node = (void *) item;
next = (ompi_uint64_hash_node_t *) *out_node; next = (opal_uint64_hash_node_t *) *out_node;
*key = next->hn_key; *key = next->hn_key;
*value = next->hn_value; *value = next->hn_value;

Просмотреть файл

@ -23,8 +23,8 @@
* concurrently. * concurrently.
*/ */
#ifndef OMPI_HASH_TABLE_H #ifndef OPAL_HASH_TABLE_H
#define OMPI_HASH_TABLE_H #define OPAL_HASH_TABLE_H
#include "ompi_config.h" #include "ompi_config.h"
#include "include/types.h" #include "include/types.h"
@ -34,10 +34,10 @@
extern "C" { extern "C" {
#endif #endif
OMPI_DECLSPEC extern opal_class_t ompi_hash_table_t_class; OMPI_DECLSPEC extern opal_class_t opal_hash_table_t_class;
struct ompi_hash_table_t struct opal_hash_table_t
{ {
opal_object_t super; /**< subclass of opal_object_t */ opal_object_t super; /**< subclass of opal_object_t */
opal_list_t ht_nodes; /**< free list of hash nodes */ opal_list_t ht_nodes; /**< free list of hash nodes */
@ -46,7 +46,7 @@ struct ompi_hash_table_t
size_t ht_size; /**< number of values on table */ size_t ht_size; /**< number of values on table */
size_t ht_mask; size_t ht_mask;
}; };
typedef struct ompi_hash_table_t ompi_hash_table_t; typedef struct opal_hash_table_t opal_hash_table_t;
@ -61,7 +61,7 @@ typedef struct ompi_hash_table_t ompi_hash_table_t;
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_init(ompi_hash_table_t* ht, size_t table_size); OMPI_DECLSPEC int opal_hash_table_init(opal_hash_table_t* ht, size_t table_size);
/** /**
@ -72,7 +72,7 @@ OMPI_DECLSPEC int ompi_hash_table_init(ompi_hash_table_t* ht, size_t table_size)
* *
*/ */
static inline size_t ompi_hash_table_get_size(ompi_hash_table_t *ht) static inline size_t opal_hash_table_get_size(opal_hash_table_t *ht)
{ {
return ht->ht_size; return ht->ht_size;
} }
@ -85,7 +85,7 @@ static inline size_t ompi_hash_table_get_size(ompi_hash_table_t *ht)
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_remove_all(ompi_hash_table_t *ht); OMPI_DECLSPEC int opal_hash_table_remove_all(opal_hash_table_t *ht);
/** /**
* Retrieve value via uint32_t key. * Retrieve value via uint32_t key.
@ -100,7 +100,7 @@ OMPI_DECLSPEC int ompi_hash_table_remove_all(ompi_hash_table_t *ht);
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_value_uint32(ompi_hash_table_t* table, uint32_t key, OMPI_DECLSPEC int opal_hash_table_get_value_uint32(opal_hash_table_t* table, uint32_t key,
void** ptr); void** ptr);
/** /**
@ -113,7 +113,7 @@ OMPI_DECLSPEC int ompi_hash_table_get_value_uint32(ompi_hash_table_t* table, uin
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_set_value_uint32(ompi_hash_table_t* table, uint32_t key, void* value); OMPI_DECLSPEC int opal_hash_table_set_value_uint32(opal_hash_table_t* table, uint32_t key, void* value);
/** /**
* Remove value based on uint32_t key. * Remove value based on uint32_t key.
@ -124,7 +124,7 @@ OMPI_DECLSPEC int ompi_hash_table_set_value_uint32(ompi_hash_table_t* table, uin
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_remove_value_uint32(ompi_hash_table_t* table, uint32_t key); OMPI_DECLSPEC int opal_hash_table_remove_value_uint32(opal_hash_table_t* table, uint32_t key);
/** /**
* Retrieve value via uint64_t key. * Retrieve value via uint64_t key.
@ -139,7 +139,7 @@ OMPI_DECLSPEC int ompi_hash_table_remove_value_uint32(ompi_hash_table_t* table,
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_value_uint64(ompi_hash_table_t *table, uint64_t key, OMPI_DECLSPEC int opal_hash_table_get_value_uint64(opal_hash_table_t *table, uint64_t key,
void **ptr); void **ptr);
/** /**
@ -152,7 +152,7 @@ OMPI_DECLSPEC int ompi_hash_table_get_value_uint64(ompi_hash_table_t *table, uin
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_set_value_uint64(ompi_hash_table_t *table, uint64_t key, void* value); OMPI_DECLSPEC int opal_hash_table_set_value_uint64(opal_hash_table_t *table, uint64_t key, void* value);
/** /**
* Remove value based on uint64_t key. * Remove value based on uint64_t key.
@ -163,7 +163,7 @@ OMPI_DECLSPEC int ompi_hash_table_set_value_uint64(ompi_hash_table_t *table, uin
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_remove_value_uint64(ompi_hash_table_t *table, uint64_t key); OMPI_DECLSPEC int opal_hash_table_remove_value_uint64(opal_hash_table_t *table, uint64_t key);
/** /**
* Retrieve value via arbitrary length binary key. * Retrieve value via arbitrary length binary key.
@ -178,7 +178,7 @@ OMPI_DECLSPEC int ompi_hash_table_remove_value_uint64(ompi_hash_table_t *table,
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_value_ptr(ompi_hash_table_t *table, const void* key, OMPI_DECLSPEC int opal_hash_table_get_value_ptr(opal_hash_table_t *table, const void* key,
size_t keylen, void **ptr); size_t keylen, void **ptr);
/** /**
@ -191,7 +191,7 @@ OMPI_DECLSPEC int ompi_hash_table_get_value_ptr(ompi_hash_table_t *table, const
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_set_value_ptr(ompi_hash_table_t *table, const void* key, size_t keylen, void* value); OMPI_DECLSPEC int opal_hash_table_set_value_ptr(opal_hash_table_t *table, const void* key, size_t keylen, void* value);
/** /**
* Remove value based on arbitrary length binary key. * Remove value based on arbitrary length binary key.
@ -202,7 +202,7 @@ OMPI_DECLSPEC int ompi_hash_table_set_value_ptr(ompi_hash_table_t *table, const
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_remove_value_ptr(ompi_hash_table_t *table, const void* key, size_t keylen); OMPI_DECLSPEC int opal_hash_table_remove_value_ptr(opal_hash_table_t *table, const void* key, size_t keylen);
/** The following functions are only for allowing iterating through /** The following functions are only for allowing iterating through
@ -227,7 +227,7 @@ OMPI_DECLSPEC int ompi_hash_table_remove_value_ptr(ompi_hash_table_t *table, con
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_first_key_uint32(ompi_hash_table_t *table, uint32_t *key, OMPI_DECLSPEC int opal_hash_table_get_first_key_uint32(opal_hash_table_t *table, uint32_t *key,
void **value, void **node); void **value, void **node);
@ -245,7 +245,7 @@ OMPI_DECLSPEC int ompi_hash_table_get_first_key_uint32(ompi_hash_table_t *table,
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_next_key_uint32(ompi_hash_table_t *table, uint32_t *key, OMPI_DECLSPEC int opal_hash_table_get_next_key_uint32(opal_hash_table_t *table, uint32_t *key,
void **value, void *in_node, void **value, void *in_node,
void **out_node); void **out_node);
@ -263,7 +263,7 @@ OMPI_DECLSPEC int ompi_hash_table_get_next_key_uint32(ompi_hash_table_t *table,
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_first_key_uint64(ompi_hash_table_t *table, uint64_t *key, OMPI_DECLSPEC int opal_hash_table_get_first_key_uint64(opal_hash_table_t *table, uint64_t *key,
void **value, void **node); void **value, void **node);
@ -281,7 +281,7 @@ OMPI_DECLSPEC int ompi_hash_table_get_first_key_uint64(ompi_hash_table_t *table,
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_get_next_key_uint64(ompi_hash_table_t *table, uint64_t *key, OMPI_DECLSPEC int opal_hash_table_get_next_key_uint64(opal_hash_table_t *table, uint64_t *key,
void **value, void *in_node, void **value, void *in_node,
void **out_node); void **out_node);
@ -291,4 +291,4 @@ OMPI_DECLSPEC int ompi_hash_table_get_next_key_uint64(ompi_hash_table_t *table,
#endif #endif
#endif /* OMPI_HASH_TABLE_H */ #endif /* OPAL_HASH_TABLE_H */

Просмотреть файл

@ -23,7 +23,7 @@
#include "mpi.h" #include "mpi.h"
#include "include/constants.h" #include "include/constants.h"
#include "opal/class/opal_value_array.h" #include "opal/class/opal_value_array.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#if 0 #if 0
/* JMS commented out for now -- see lookup_keyvals() below for an /* JMS commented out for now -- see lookup_keyvals() below for an
explanation */ explanation */
@ -66,7 +66,7 @@ static int param_register(const char *type_name, const char *component_name,
mca_base_param_storage_t *file_value, mca_base_param_storage_t *file_value,
mca_base_param_storage_t *override_value); mca_base_param_storage_t *override_value);
static bool param_lookup(size_t index, mca_base_param_storage_t *storage, static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
ompi_hash_table_t *attrs); opal_hash_table_t *attrs);
static bool param_set_override(size_t index, static bool param_set_override(size_t index,
mca_base_param_storage_t *storage, mca_base_param_storage_t *storage,
mca_base_param_type_t type); mca_base_param_type_t type);
@ -74,7 +74,7 @@ static bool lookup_override(mca_base_param_t *param,
mca_base_param_storage_t *storage); mca_base_param_storage_t *storage);
static bool lookup_keyvals(mca_base_param_t *param, static bool lookup_keyvals(mca_base_param_t *param,
mca_base_param_storage_t *storage, mca_base_param_storage_t *storage,
ompi_hash_table_t *attrs); opal_hash_table_t *attrs);
static bool lookup_env(mca_base_param_t *param, static bool lookup_env(mca_base_param_t *param,
mca_base_param_storage_t *storage); mca_base_param_storage_t *storage);
static bool lookup_file(mca_base_param_t *param, static bool lookup_file(mca_base_param_t *param,
@ -237,7 +237,7 @@ int mca_base_param_lookup_int(int index, int *value)
/* /*
* Look up an integer MCA parameter, including in attributes * Look up an integer MCA parameter, including in attributes
*/ */
int mca_base_param_kv_lookup_int(int index, ompi_hash_table_t *attrs, int mca_base_param_kv_lookup_int(int index, opal_hash_table_t *attrs,
int *value) int *value)
{ {
mca_base_param_storage_t storage; mca_base_param_storage_t storage;
@ -282,7 +282,7 @@ int mca_base_param_lookup_string(int index, char **value)
/* /*
* Look up a string MCA parameter, including in attributes. * Look up a string MCA parameter, including in attributes.
*/ */
int mca_base_param_kv_lookup_string(int index, ompi_hash_table_t *attrs, int mca_base_param_kv_lookup_string(int index, opal_hash_table_t *attrs,
char **value) char **value)
{ {
mca_base_param_storage_t storage; mca_base_param_storage_t storage;
@ -987,7 +987,7 @@ static bool param_set_override(size_t index,
* Lookup a parameter in multiple places * Lookup a parameter in multiple places
*/ */
static bool param_lookup(size_t index, mca_base_param_storage_t *storage, static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
ompi_hash_table_t *attrs) opal_hash_table_t *attrs)
{ {
size_t size; size_t size;
mca_base_param_t *array; mca_base_param_t *array;
@ -1077,7 +1077,7 @@ static bool lookup_override(mca_base_param_t *param,
*/ */
static bool lookup_keyvals(mca_base_param_t *param, static bool lookup_keyvals(mca_base_param_t *param,
mca_base_param_storage_t *storage, mca_base_param_storage_t *storage,
ompi_hash_table_t *attrs) opal_hash_table_t *attrs)
{ {
#if 1 #if 1
/* JMS: Comment this out for now, because it drags in all of /* JMS: Comment this out for now, because it drags in all of

Просмотреть файл

@ -60,7 +60,7 @@
#include "opal/class/opal_value_array.h" #include "opal/class/opal_value_array.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
/** /**
* The types of MCA parameters. * The types of MCA parameters.
@ -272,7 +272,7 @@ extern "C" {
* called first to associate a keyval with the index. * called first to associate a keyval with the index.
*/ */
OMPI_DECLSPEC int mca_base_param_kv_lookup_int(int index, OMPI_DECLSPEC int mca_base_param_kv_lookup_int(int index,
struct ompi_hash_table_t *attrs, struct opal_hash_table_t *attrs,
int *value); int *value);
/** /**
@ -320,7 +320,7 @@ extern "C" {
* have been called first to associate a keyval with the index. * have been called first to associate a keyval with the index.
*/ */
OMPI_DECLSPEC int mca_base_param_kv_lookup_string(int index, OMPI_DECLSPEC int mca_base_param_kv_lookup_string(int index,
struct ompi_hash_table_t *attrs, struct opal_hash_table_t *attrs,
char **value); char **value);
/** /**

Просмотреть файл

@ -34,7 +34,7 @@
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/base/mca_base_param.h" #include "mca/base/mca_base_param.h"
/** /**

Просмотреть файл

@ -43,7 +43,7 @@ static OBJ_CLASS_INSTANCE(
NULL); NULL);
void* ompi_hash_table_get_proc(ompi_hash_table_t* ht, void* opal_hash_table_get_proc(opal_hash_table_t* ht,
const orte_process_name_t* proc) const orte_process_name_t* proc)
{ {
uint32_t key = (proc->cellid << 24) + (proc->jobid << 16) + proc->vpid; uint32_t key = (proc->cellid << 24) + (proc->jobid << 16) + proc->vpid;
@ -52,8 +52,8 @@ void* ompi_hash_table_get_proc(ompi_hash_table_t* ht,
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_get_proc:" ompi_output(0, "opal_hash_table_get_proc:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return NULL; return NULL;
} }
#endif #endif
@ -68,8 +68,8 @@ void* ompi_hash_table_get_proc(ompi_hash_table_t* ht,
} }
int ompi_hash_table_set_proc( int opal_hash_table_set_proc(
ompi_hash_table_t* ht, opal_hash_table_t* ht,
const orte_process_name_t* proc, const orte_process_name_t* proc,
void* value) void* value)
{ {
@ -79,8 +79,8 @@ int ompi_hash_table_set_proc(
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_set_value_proc:" ompi_output(0, "opal_hash_table_set_value_proc:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif
@ -107,8 +107,8 @@ int ompi_hash_table_set_proc(
} }
int ompi_hash_table_remove_proc( int opal_hash_table_remove_proc(
ompi_hash_table_t* ht, opal_hash_table_t* ht,
const orte_process_name_t* proc) const orte_process_name_t* proc)
{ {
uint32_t key = (proc->cellid << 24) + (proc->jobid << 16) + proc->vpid; uint32_t key = (proc->cellid << 24) + (proc->jobid << 16) + proc->vpid;
@ -117,8 +117,8 @@ int ompi_hash_table_remove_proc(
#if OMPI_ENABLE_DEBUG #if OMPI_ENABLE_DEBUG
if(ht->ht_table_size == 0) { if(ht->ht_table_size == 0) {
ompi_output(0, "ompi_hash_table_remove_value_proc:" ompi_output(0, "opal_hash_table_remove_value_proc:"
"ompi_hash_table_init() has not been called"); "opal_hash_table_init() has not been called");
return OMPI_ERR_BAD_PARAM; return OMPI_ERR_BAD_PARAM;
} }
#endif #endif

Просмотреть файл

@ -23,7 +23,7 @@
#ifndef OMPI_PROC_TABLE_H #ifndef OMPI_PROC_TABLE_H
#define OMPI_PROC_TABLE_H #define OMPI_PROC_TABLE_H
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "mca/ns/ns_types.h" #include "mca/ns/ns_types.h"
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
@ -40,8 +40,8 @@ extern "C" {
* *
*/ */
OMPI_DECLSPEC void *ompi_hash_table_get_proc( OMPI_DECLSPEC void *opal_hash_table_get_proc(
ompi_hash_table_t* table, opal_hash_table_t* table,
const orte_process_name_t* key); const orte_process_name_t* key);
/** /**
@ -54,8 +54,8 @@ OMPI_DECLSPEC void *ompi_hash_table_get_proc(
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_set_proc( OMPI_DECLSPEC int opal_hash_table_set_proc(
ompi_hash_table_t* table, opal_hash_table_t* table,
const orte_process_name_t*, const orte_process_name_t*,
void* value); void* value);
@ -68,8 +68,8 @@ OMPI_DECLSPEC int ompi_hash_table_set_proc(
* *
*/ */
OMPI_DECLSPEC int ompi_hash_table_remove_proc( OMPI_DECLSPEC int opal_hash_table_remove_proc(
ompi_hash_table_t* table, opal_hash_table_t* table,
const orte_process_name_t* key); const orte_process_name_t* key);

Просмотреть файл

@ -207,10 +207,10 @@ static void orte_iof_svc_proxy_ack(
if (orte_ns.compare(pub->pub_mask,&pub->pub_name,src) == 0 || if (orte_ns.compare(pub->pub_mask,&pub->pub_name,src) == 0 ||
orte_ns.compare(ORTE_NS_CMP_ALL,&pub->pub_proxy,src) == 0) { orte_ns.compare(ORTE_NS_CMP_ALL,&pub->pub_proxy,src) == 0) {
value.uval = hdr->msg_seq + hdr->msg_len; value.uval = hdr->msg_seq + hdr->msg_len;
ompi_hash_table_set_proc(&fwd->fwd_seq, opal_hash_table_set_proc(&fwd->fwd_seq,
&hdr->msg_src, &value.vval); &hdr->msg_src, &value.vval);
} else { } else {
value.vval = ompi_hash_table_get_proc(&fwd->fwd_seq, value.vval = opal_hash_table_get_proc(&fwd->fwd_seq,
&hdr->msg_src); &hdr->msg_src);
if(value.uval < seq_min) { if(value.uval < seq_min) {
seq_min = value.uval; seq_min = value.uval;

Просмотреть файл

@ -211,8 +211,8 @@ int orte_iof_svc_sub_forward(
static void orte_iof_svc_fwd_construct(orte_iof_svc_fwd_t* fwd) static void orte_iof_svc_fwd_construct(orte_iof_svc_fwd_t* fwd)
{ {
fwd->fwd_pub = NULL; fwd->fwd_pub = NULL;
OBJ_CONSTRUCT(&fwd->fwd_seq, ompi_hash_table_t); OBJ_CONSTRUCT(&fwd->fwd_seq, opal_hash_table_t);
ompi_hash_table_init(&fwd->fwd_seq, 256); opal_hash_table_init(&fwd->fwd_seq, 256);
} }
static void orte_iof_svc_fwd_destruct(orte_iof_svc_fwd_t* fwd) static void orte_iof_svc_fwd_destruct(orte_iof_svc_fwd_t* fwd)

Просмотреть файл

@ -14,7 +14,7 @@
struct orte_iof_svc_fwd_t { struct orte_iof_svc_fwd_t {
opal_list_item_t super; opal_list_item_t super;
orte_iof_svc_pub_t* fwd_pub; orte_iof_svc_pub_t* fwd_pub;
ompi_hash_table_t fwd_seq; opal_hash_table_t fwd_seq;
}; };
typedef struct orte_iof_svc_fwd_t orte_iof_svc_fwd_t; typedef struct orte_iof_svc_fwd_t orte_iof_svc_fwd_t;

Просмотреть файл

@ -177,8 +177,8 @@ int mca_oob_tcp_component_open(void)
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_subscriptions, opal_list_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_subscriptions, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_list, opal_list_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_list, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peers, ompi_hash_table_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peers, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_names, ompi_hash_table_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_names, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_free, opal_free_list_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_free, opal_free_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msgs, opal_free_list_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msgs, opal_free_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_lock, ompi_mutex_t); OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_lock, ompi_mutex_t);
@ -496,8 +496,8 @@ mca_oob_t* mca_oob_tcp_component_init(int* priority)
return NULL; return NULL;
/* initialize data structures */ /* initialize data structures */
ompi_hash_table_init(&mca_oob_tcp_component.tcp_peers, 128); opal_hash_table_init(&mca_oob_tcp_component.tcp_peers, 128);
ompi_hash_table_init(&mca_oob_tcp_component.tcp_peer_names, 128); opal_hash_table_init(&mca_oob_tcp_component.tcp_peer_names, 128);
opal_free_list_init(&mca_oob_tcp_component.tcp_peer_free, opal_free_list_init(&mca_oob_tcp_component.tcp_peer_free,
sizeof(mca_oob_tcp_peer_t), sizeof(mca_oob_tcp_peer_t),
@ -582,7 +582,7 @@ void mca_oob_tcp_registry_callback(
} }
/* check for existing cache entry */ /* check for existing cache entry */
existing = (mca_oob_tcp_addr_t *)ompi_hash_table_get_proc( existing = (mca_oob_tcp_addr_t *)opal_hash_table_get_proc(
&mca_oob_tcp_component.tcp_peer_names, &addr->addr_name); &mca_oob_tcp_component.tcp_peer_names, &addr->addr_name);
if(NULL != existing) { if(NULL != existing) {
/* TSW - need to update existing entry */ /* TSW - need to update existing entry */
@ -591,8 +591,8 @@ void mca_oob_tcp_registry_callback(
} }
/* insert into cache and notify peer */ /* insert into cache and notify peer */
ompi_hash_table_set_proc(&mca_oob_tcp_component.tcp_peer_names, &addr->addr_name, addr); opal_hash_table_set_proc(&mca_oob_tcp_component.tcp_peer_names, &addr->addr_name, addr);
peer = (mca_oob_tcp_peer_t *)ompi_hash_table_get_proc( peer = (mca_oob_tcp_peer_t *)opal_hash_table_get_proc(
&mca_oob_tcp_component.tcp_peers, &addr->addr_name); &mca_oob_tcp_component.tcp_peers, &addr->addr_name);
if(NULL != peer) if(NULL != peer)
mca_oob_tcp_peer_resolved(peer, addr); mca_oob_tcp_peer_resolved(peer, addr);
@ -616,7 +616,7 @@ int mca_oob_tcp_resolve(mca_oob_tcp_peer_t* peer)
/* if the address is already cached - simply return it */ /* if the address is already cached - simply return it */
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
addr = (mca_oob_tcp_addr_t *)ompi_hash_table_get_proc(&mca_oob_tcp_component.tcp_peer_names, addr = (mca_oob_tcp_addr_t *)opal_hash_table_get_proc(&mca_oob_tcp_component.tcp_peer_names,
&peer->peer_name); &peer->peer_name);
if(NULL != addr) { if(NULL != addr) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
@ -1125,14 +1125,14 @@ int mca_oob_tcp_set_addr(const orte_process_name_t* name, const char* uri)
return rc; return rc;
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
addr = (mca_oob_tcp_addr_t*)ompi_hash_table_get_proc(&mca_oob_tcp_component.tcp_peer_names, name); addr = (mca_oob_tcp_addr_t*)opal_hash_table_get_proc(&mca_oob_tcp_component.tcp_peer_names, name);
if(NULL == addr) { if(NULL == addr) {
addr = OBJ_NEW(mca_oob_tcp_addr_t); addr = OBJ_NEW(mca_oob_tcp_addr_t);
addr->addr_name = *name; addr->addr_name = *name;
ompi_hash_table_set_proc(&mca_oob_tcp_component.tcp_peer_names, &addr->addr_name, addr); opal_hash_table_set_proc(&mca_oob_tcp_component.tcp_peer_names, &addr->addr_name, addr);
} }
rc = mca_oob_tcp_addr_insert(addr, &inaddr); rc = mca_oob_tcp_addr_insert(addr, &inaddr);
peer = (mca_oob_tcp_peer_t *)ompi_hash_table_get_proc( peer = (mca_oob_tcp_peer_t *)opal_hash_table_get_proc(
&mca_oob_tcp_component.tcp_peers, &addr->addr_name); &mca_oob_tcp_component.tcp_peers, &addr->addr_name);
if(NULL != peer) { if(NULL != peer) {
mca_oob_tcp_peer_resolved(peer, addr); mca_oob_tcp_peer_resolved(peer, addr);

Просмотреть файл

@ -26,7 +26,7 @@
#include "mca/base/base.h" #include "mca/base/base.h"
#include "mca/ns/ns_types.h" #include "mca/ns/ns_types.h"
#include "opal/class/opal_free_list.h" #include "opal/class/opal_free_list.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
#include "event/event.h" #include "event/event.h"
#include "threads/mutex.h" #include "threads/mutex.h"
#include "threads/condition.h" #include "threads/condition.h"
@ -249,8 +249,8 @@ struct mca_oob_tcp_component_t {
unsigned short tcp_listen_port; /**< listen port */ unsigned short tcp_listen_port; /**< listen port */
opal_list_t tcp_subscriptions; /**< list of registry subscriptions */ opal_list_t tcp_subscriptions; /**< list of registry subscriptions */
opal_list_t tcp_peer_list; /**< list of peers sorted in mru order */ opal_list_t tcp_peer_list; /**< list of peers sorted in mru order */
ompi_hash_table_t tcp_peers; /**< peers sorted by name */ opal_hash_table_t tcp_peers; /**< peers sorted by name */
ompi_hash_table_t tcp_peer_names; /**< cache of peer contact info sorted by name */ opal_hash_table_t tcp_peer_names; /**< cache of peer contact info sorted by name */
opal_free_list_t tcp_peer_free; /**< free list of peers */ opal_free_list_t tcp_peer_free; /**< free list of peers */
int tcp_peer_limit; /**< max size of tcp peer cache */ int tcp_peer_limit; /**< max size of tcp peer cache */
int tcp_peer_retries; /**< max number of retries before declaring peer gone */ int tcp_peer_retries; /**< max number of retries before declaring peer gone */

Просмотреть файл

@ -351,9 +351,9 @@ static void mca_oob_tcp_msg_ident(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* pe
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
if (orte_ns.compare(ORTE_NS_CMP_ALL, &peer->peer_name, &src) != 0) { if (orte_ns.compare(ORTE_NS_CMP_ALL, &peer->peer_name, &src) != 0) {
ompi_hash_table_remove_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name); opal_hash_table_remove_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name);
peer->peer_name = src; peer->peer_name = src;
ompi_hash_table_set_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name, peer); opal_hash_table_set_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name, peer);
} }
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
} }

Просмотреть файл

@ -192,7 +192,7 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const orte_process_name_t* name)
} }
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
peer = (mca_oob_tcp_peer_t*)ompi_hash_table_get_proc( peer = (mca_oob_tcp_peer_t*)opal_hash_table_get_proc(
&mca_oob_tcp_component.tcp_peers, name); &mca_oob_tcp_component.tcp_peers, name);
if(NULL != peer && memcmp(&peer->peer_name,name,sizeof(peer->peer_name)) == 0) { if(NULL != peer && memcmp(&peer->peer_name,name,sizeof(peer->peer_name)) == 0) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
@ -227,7 +227,7 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const orte_process_name_t* name)
peer->peer_retries = 0; peer->peer_retries = 0;
/* add to lookup table */ /* add to lookup table */
if(OMPI_SUCCESS != ompi_hash_table_set_proc(&mca_oob_tcp_component.tcp_peers, if(OMPI_SUCCESS != opal_hash_table_set_proc(&mca_oob_tcp_component.tcp_peers,
&peer->peer_name, peer)) { &peer->peer_name, peer)) {
MCA_OOB_TCP_PEER_RETURN(peer); MCA_OOB_TCP_PEER_RETURN(peer);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock); OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);

Просмотреть файл

@ -91,7 +91,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_peer_t);
#define MCA_OOB_TCP_PEER_RETURN(peer) \ #define MCA_OOB_TCP_PEER_RETURN(peer) \
{ \ { \
mca_oob_tcp_peer_shutdown(peer); \ mca_oob_tcp_peer_shutdown(peer); \
ompi_hash_table_remove_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name); \ opal_hash_table_remove_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name); \
OPAL_FREE_LIST_RETURN(&mca_oob_tcp_component.tcp_peer_free, (opal_list_item_t*)peer); \ OPAL_FREE_LIST_RETURN(&mca_oob_tcp_component.tcp_peer_free, (opal_list_item_t*)peer); \
} }

Двоичные данные
test/Unit-Test-Status.xls

Двоичный файл не отображается.

Просмотреть файл

@ -22,7 +22,7 @@ check_PROGRAMS = \
ompi_bitmap \ ompi_bitmap \
ompi_circular_buffer_fifo \ ompi_circular_buffer_fifo \
ompi_fifo \ ompi_fifo \
ompi_hash_table \ opal_hash_table \
opal_list \ opal_list \
opal_value_array \ opal_value_array \
ompi_pointer_array \ ompi_pointer_array \
@ -56,11 +56,11 @@ opal_list_LDADD = \
$(top_builddir)/test/support/libsupport.a $(top_builddir)/test/support/libsupport.a
opal_list_DEPENDENCIES = $(opal_list_LDADD) opal_list_DEPENDENCIES = $(opal_list_LDADD)
ompi_hash_table_SOURCES = ompi_hash_table.c opal_hash_table_SOURCES = opal_hash_table.c
ompi_hash_table_LDADD = \ opal_hash_table_LDADD = \
$(top_builddir)/src/libmpi.la \ $(top_builddir)/src/libmpi.la \
$(top_builddir)/test/support/libsupport.a $(top_builddir)/test/support/libsupport.a
ompi_hash_table_DEPENDENCIES = $(ompi_hash_table_LDADD) opal_hash_table_DEPENDENCIES = $(opal_hash_table_LDADD)
ompi_pointer_array_SOURCES = ompi_pointer_array.c ompi_pointer_array_SOURCES = ompi_pointer_array.c
ompi_pointer_array_LDADD = \ ompi_pointer_array_LDADD = \

Просмотреть файл

@ -21,7 +21,7 @@
#include <string.h> #include <string.h>
#include "support.h" #include "support.h"
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "class/ompi_hash_table.h" #include "class/opal_hash_table.h"
static FILE *error_out=NULL; static FILE *error_out=NULL;
@ -62,63 +62,63 @@ typedef union {
void *vvalue; void *vvalue;
} value_t; } value_t;
static void validate_table(ompi_hash_table_t *table, char *keys[], int is_numeric_keys) static void validate_table(opal_hash_table_t *table, char *keys[], int is_numeric_keys)
{ {
int j, ret; int j, ret;
value_t value; value_t value;
for ( j = 0; keys[j]; j += 2) { for ( j = 0; keys[j]; j += 2) {
if ( 1 == is_numeric_keys ) { if ( 1 == is_numeric_keys ) {
ret = ompi_hash_table_get_value_uint32(table, atoi(keys[j]), ret = opal_hash_table_get_value_uint32(table, atoi(keys[j]),
(void**) &value.uvalue); (void**) &value.uvalue);
} else { } else {
ret = ompi_hash_table_get_value_ptr(table, keys[j], ret = opal_hash_table_get_value_ptr(table, keys[j],
strlen(keys[j]), strlen(keys[j]),
&value.vvalue); &value.vvalue);
} }
test_verify_str(keys[j+1], value.vvalue); test_verify_str(keys[j+1], value.vvalue);
} }
test_verify_int(j/2, ompi_hash_table_get_size(table)); test_verify_int(j/2, opal_hash_table_get_size(table));
} }
static void test_htable(ompi_hash_table_t *table) static void test_htable(opal_hash_table_t *table)
{ {
int j; int j;
fprintf(error_out, "\nTesting integer keys...\n"); fprintf(error_out, "\nTesting integer keys...\n");
for ( j = 0; num_keys[j]; j += 2) for ( j = 0; num_keys[j]; j += 2)
{ {
ompi_hash_table_set_value_uint32(table, atoi(num_keys[j]), num_keys[j+1]); opal_hash_table_set_value_uint32(table, atoi(num_keys[j]), num_keys[j+1]);
} }
validate_table(table, num_keys, 1); validate_table(table, num_keys, 1);
/* remove all values for next test */ /* remove all values for next test */
ompi_hash_table_remove_all(table); opal_hash_table_remove_all(table);
test_verify_int(0, ompi_hash_table_get_size(table)); test_verify_int(0, opal_hash_table_get_size(table));
fprintf(error_out, "\nTesting string keys...\n"); fprintf(error_out, "\nTesting string keys...\n");
for ( j = 0; str_keys[j]; j += 2) for ( j = 0; str_keys[j]; j += 2)
{ {
ompi_hash_table_set_value_ptr(table, str_keys[j], strlen(str_keys[j]), str_keys[j+1]); opal_hash_table_set_value_ptr(table, str_keys[j], strlen(str_keys[j]), str_keys[j+1]);
} }
validate_table(table, str_keys, 0); validate_table(table, str_keys, 0);
/* remove all values for next test */ /* remove all values for next test */
ompi_hash_table_remove_all(table); opal_hash_table_remove_all(table);
test_verify_int(0, ompi_hash_table_get_size(table)); test_verify_int(0, opal_hash_table_get_size(table));
fprintf(error_out, "\nTesting collision resolution...\n"); fprintf(error_out, "\nTesting collision resolution...\n");
/* All of the string keys in keys array should /* All of the string keys in keys array should
have the same hash value. */ have the same hash value. */
for ( j = 0; perm_keys[j]; j += 2) for ( j = 0; perm_keys[j]; j += 2)
{ {
ompi_hash_table_set_value_ptr(table, perm_keys[j], strlen(perm_keys[j]), perm_keys[j+1]); opal_hash_table_set_value_ptr(table, perm_keys[j], strlen(perm_keys[j]), perm_keys[j+1]);
} }
validate_table(table, perm_keys, 0); validate_table(table, perm_keys, 0);
/* remove all values for next test */ /* remove all values for next test */
ompi_hash_table_remove_all(table); opal_hash_table_remove_all(table);
test_verify_int(0, ompi_hash_table_get_size(table)); test_verify_int(0, opal_hash_table_get_size(table));
fprintf(error_out, "\n\n"); fprintf(error_out, "\n\n");
} }
@ -126,16 +126,16 @@ static void test_htable(ompi_hash_table_t *table)
static void test_dynamic(void) static void test_dynamic(void)
{ {
ompi_hash_table_t *table; opal_hash_table_t *table;
table = OBJ_NEW(ompi_hash_table_t); table = OBJ_NEW(opal_hash_table_t);
if ( NULL == table ) if ( NULL == table )
{ {
fprintf(error_out, "Error: Unable to create hash table.\n"); fprintf(error_out, "Error: Unable to create hash table.\n");
exit(-1); exit(-1);
} }
fprintf(error_out, "Testing with dynamically created table...\n"); fprintf(error_out, "Testing with dynamically created table...\n");
ompi_hash_table_init(table, 4); opal_hash_table_init(table, 4);
test_htable(table); test_htable(table);
OBJ_RELEASE(table); OBJ_RELEASE(table);
@ -144,10 +144,10 @@ static void test_dynamic(void)
static void test_static(void) static void test_static(void)
{ {
ompi_hash_table_t table; opal_hash_table_t table;
OBJ_CONSTRUCT(&table, ompi_hash_table_t); OBJ_CONSTRUCT(&table, opal_hash_table_t);
ompi_hash_table_init(&table, 128); opal_hash_table_init(&table, 128);
fprintf(error_out, "Testing with statically created table...\n"); fprintf(error_out, "Testing with statically created table...\n");
test_htable(&table); test_htable(&table);
@ -159,12 +159,12 @@ static void test_static(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* local variables */ /* local variables */
test_init("ompi_hash_table_t"); test_init("opal_hash_table_t");
#ifdef STANDALONE #ifdef STANDALONE
error_out = stderr; error_out = stderr;
#else #else
error_out = fopen( "./ompi_hash_table_test_out.txt", "w" ); error_out = fopen( "./opal_hash_table_test_out.txt", "w" );
if( error_out == NULL ) error_out = stderr; if( error_out == NULL ) error_out = stderr;
#endif #endif

Просмотреть файл

@ -167,10 +167,10 @@
RelativePath="..\..\src\class\ompi_free_list.h"> RelativePath="..\..\src\class\ompi_free_list.h">
</File> </File>
<File <File
RelativePath="..\..\src\class\ompi_hash_table.c"> RelativePath="..\..\src\class\opal_hash_table.c">
</File> </File>
<File <File
RelativePath="..\..\src\class\ompi_hash_table.h"> RelativePath="..\..\src\class\opal_hash_table.h">
</File> </File>
<File <File
RelativePath="..\..\src\class\opal_list.c"> RelativePath="..\..\src\class\opal_list.c">