Remove the orte_proc_table. Migrate all users of it to the opal_hash_table and a new name hash function in orte.
Everything should work, however I am unable to compile and test the sctp BTL. This commit was SVN r17751.
Этот коммит содержится в:
родитель
f9916811ae
Коммит
5de3e1965e
@ -28,7 +28,6 @@
|
||||
#include "ompi/mca/btl/base/base.h"
|
||||
#include "ompi/class/ompi_bitmap.h"
|
||||
#include "ompi/class/ompi_free_list.h"
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
|
||||
#include "btl_portals_endpoint.h"
|
||||
#include "btl_portals_frag.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "ompi/mca/btl/base/btl_base_error.h"
|
||||
#include "ompi/runtime/ompi_module_exchange.h"
|
||||
#include "ompi/datatype/dt_arch.h"
|
||||
@ -63,7 +63,8 @@ void mca_btl_sctp_proc_destruct(mca_btl_sctp_proc_t* proc)
|
||||
{
|
||||
/* remove from list of all proc instances */
|
||||
OPAL_THREAD_LOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
orte_hash_table_remove_proc(&mca_btl_sctp_component.sctp_procs, &proc->proc_name);
|
||||
opal_hash_table_remove_value_uint64(&mca_btl_sctp_component.sctp_procs,
|
||||
orte_util_hash_name(&proc->proc_name));
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
|
||||
/* release resources */
|
||||
@ -109,11 +110,12 @@ mca_btl_sctp_proc_t* mca_btl_sctp_proc_create(ompi_proc_t* ompi_proc)
|
||||
int rc;
|
||||
size_t size;
|
||||
mca_btl_sctp_proc_t* btl_proc;
|
||||
uint64_t hash = orte_util_hash_name(&ompi_proc->proc_name);
|
||||
|
||||
OPAL_THREAD_LOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
btl_proc = (mca_btl_sctp_proc_t*)orte_hash_table_get_proc(
|
||||
&mca_btl_sctp_component.sctp_procs, &ompi_proc->proc_name);
|
||||
if(NULL != btl_proc) {
|
||||
rc = opal_hash_table_get_value_uint64(&mca_btl_sctp_component.sctp_procs,
|
||||
hash, (void**)&btl_proc);
|
||||
if(OMPI_SUCCESS == rc) {
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
return btl_proc;
|
||||
}
|
||||
@ -126,10 +128,8 @@ mca_btl_sctp_proc_t* mca_btl_sctp_proc_create(ompi_proc_t* ompi_proc)
|
||||
btl_proc->proc_name = ompi_proc->proc_name;
|
||||
|
||||
/* add to hash table of all proc instance */
|
||||
orte_hash_table_set_proc(
|
||||
&mca_btl_sctp_component.sctp_procs,
|
||||
&btl_proc->proc_name,
|
||||
btl_proc);
|
||||
opal_hash_table_set_value_uint64(&mca_btl_sctp_component.sctp_procs,
|
||||
hash, btl_proc);
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
|
||||
/* lookup sctp parameters exported by this proc */
|
||||
@ -325,10 +325,10 @@ int mca_btl_sctp_proc_remove(mca_btl_sctp_proc_t* btl_proc, mca_btl_base_endpoin
|
||||
*/
|
||||
mca_btl_sctp_proc_t* mca_btl_sctp_proc_lookup(const orte_process_name_t *name)
|
||||
{
|
||||
mca_btl_sctp_proc_t* proc;
|
||||
mca_btl_sctp_proc_t* proc = NULL;
|
||||
OPAL_THREAD_LOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
proc = (mca_btl_sctp_proc_t*)orte_hash_table_get_proc(
|
||||
&mca_btl_sctp_component.sctp_procs, name);
|
||||
opal_hash_table_get_value_uint64(&mca_btl_sctp_component.sctp_procs,
|
||||
orte_util_hash_name(name), (void**)&proc);
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
|
||||
return proc;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "ompi/mca/btl/base/btl_base_error.h"
|
||||
#include "ompi/runtime/ompi_module_exchange.h"
|
||||
#include "ompi/datatype/dt_arch.h"
|
||||
@ -74,7 +74,8 @@ void mca_btl_tcp_proc_destruct(mca_btl_tcp_proc_t* proc)
|
||||
{
|
||||
/* remove from list of all proc instances */
|
||||
OPAL_THREAD_LOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
orte_hash_table_remove_proc(&mca_btl_tcp_component.tcp_procs, &proc->proc_name);
|
||||
opal_hash_table_remove_value_uint64(&mca_btl_tcp_component.tcp_procs,
|
||||
orte_util_hash_name(&proc->proc_name));
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
|
||||
/* release resources */
|
||||
@ -97,11 +98,12 @@ mca_btl_tcp_proc_t* mca_btl_tcp_proc_create(ompi_proc_t* ompi_proc)
|
||||
int rc;
|
||||
size_t size;
|
||||
mca_btl_tcp_proc_t* btl_proc;
|
||||
uint64_t hash = orte_util_hash_name(&ompi_proc->proc_name);
|
||||
|
||||
OPAL_THREAD_LOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
btl_proc = (mca_btl_tcp_proc_t*)orte_hash_table_get_proc(
|
||||
&mca_btl_tcp_component.tcp_procs, &ompi_proc->proc_name);
|
||||
if(NULL != btl_proc) {
|
||||
rc = opal_hash_table_get_value_uint64(&mca_btl_tcp_component.tcp_procs,
|
||||
hash, (void**)&btl_proc);
|
||||
if(OMPI_SUCCESS == rc) {
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
return btl_proc;
|
||||
}
|
||||
@ -113,9 +115,8 @@ mca_btl_tcp_proc_t* mca_btl_tcp_proc_create(ompi_proc_t* ompi_proc)
|
||||
btl_proc->proc_name = ompi_proc->proc_name;
|
||||
|
||||
/* add to hash table of all proc instance */
|
||||
orte_hash_table_set_proc( &mca_btl_tcp_component.tcp_procs,
|
||||
&btl_proc->proc_name,
|
||||
btl_proc );
|
||||
opal_hash_table_set_value_uint64(&mca_btl_tcp_component.tcp_procs,
|
||||
hash, btl_proc);
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
|
||||
/* lookup tcp parameters exported by this proc */
|
||||
@ -554,10 +555,10 @@ int mca_btl_tcp_proc_remove(mca_btl_tcp_proc_t* btl_proc, mca_btl_base_endpoint_
|
||||
*/
|
||||
mca_btl_tcp_proc_t* mca_btl_tcp_proc_lookup(const orte_process_name_t *name)
|
||||
{
|
||||
mca_btl_tcp_proc_t* proc;
|
||||
mca_btl_tcp_proc_t* proc = NULL;
|
||||
OPAL_THREAD_LOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
proc = (mca_btl_tcp_proc_t*)orte_hash_table_get_proc(
|
||||
&mca_btl_tcp_component.tcp_procs, name);
|
||||
opal_hash_table_get_value_uint64(&mca_btl_tcp_component.tcp_procs,
|
||||
orte_util_hash_name(name), (void**)&proc);
|
||||
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
|
||||
return proc;
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ else
|
||||
ortedir = $(includedir)
|
||||
endif
|
||||
|
||||
include class/Makefile.am
|
||||
include runtime/Makefile.am
|
||||
include util/Makefile.am
|
||||
include tools/Makefile.am
|
||||
|
@ -1,26 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
# University Research and Technology
|
||||
# Corporation. All rights reserved.
|
||||
# Copyright (c) 2004-2008 The University of Tennessee and The University
|
||||
# of Tennessee Research Foundation. All rights
|
||||
# reserved.
|
||||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# This makefile.am does not stand on its own - it is included from orte/Makefile.am
|
||||
|
||||
headers += \
|
||||
class/orte_proc_table.h
|
||||
|
||||
libopen_rte_la_SOURCES += \
|
||||
class/orte_proc_table.c
|
@ -1,251 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/constants.h"
|
||||
#include "orte/types.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
|
||||
/*
|
||||
* orte_process_name_hash_node_t
|
||||
*/
|
||||
|
||||
struct orte_proc_hash_node_t
|
||||
{
|
||||
opal_list_item_t super;
|
||||
orte_process_name_t hn_key;
|
||||
void *hn_value;
|
||||
};
|
||||
typedef struct orte_proc_hash_node_t orte_proc_hash_node_t;
|
||||
|
||||
static OBJ_CLASS_INSTANCE(
|
||||
orte_proc_hash_node_t,
|
||||
opal_list_item_t,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
opal_list_item_t super;
|
||||
orte_process_name_t hn_key;
|
||||
orte_process_name_t hn_value;
|
||||
} orte_proc_hash_node_name_t;
|
||||
|
||||
static OBJ_CLASS_INSTANCE(
|
||||
orte_proc_hash_node_name_t,
|
||||
opal_list_item_t,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
#define GET_KEY(proc) \
|
||||
( (((uint32_t) proc->jobid) << 24) + ((uint32_t) proc->vpid) )
|
||||
|
||||
void* orte_hash_table_get_proc(opal_hash_table_t* ht,
|
||||
const orte_process_name_t* proc)
|
||||
{
|
||||
uint32_t key = GET_KEY(proc);
|
||||
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
|
||||
orte_proc_hash_node_t *node;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(ht->ht_table_size == 0) {
|
||||
opal_output(0, "opal_hash_table_get_proc:"
|
||||
"opal_hash_table_init() has not been called");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
for(node = (orte_proc_hash_node_t*)opal_list_get_first(list);
|
||||
node != (orte_proc_hash_node_t*)opal_list_get_end(list);
|
||||
node = (orte_proc_hash_node_t*)opal_list_get_next(node)) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &node->hn_key, proc)) {
|
||||
return node->hn_value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int orte_hash_table_set_proc(
|
||||
opal_hash_table_t* ht,
|
||||
const orte_process_name_t* proc,
|
||||
void* value)
|
||||
{
|
||||
uint32_t key = GET_KEY(proc);
|
||||
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
|
||||
orte_proc_hash_node_t *node;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(ht->ht_table_size == 0) {
|
||||
opal_output(0, "opal_hash_table_set_value_proc:"
|
||||
"opal_hash_table_init() has not been called");
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
#endif
|
||||
for(node = (orte_proc_hash_node_t*)opal_list_get_first(list);
|
||||
node != (orte_proc_hash_node_t*)opal_list_get_end(list);
|
||||
node = (orte_proc_hash_node_t*)opal_list_get_next(node)) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &node->hn_key, proc)) {
|
||||
node->hn_value = value;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
node = (orte_proc_hash_node_t*)opal_list_remove_first(&ht->ht_nodes);
|
||||
if(NULL == node) {
|
||||
node = OBJ_NEW(orte_proc_hash_node_t);
|
||||
if(NULL == node)
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
node->hn_key = *proc;
|
||||
node->hn_value = value;
|
||||
opal_list_append(list, (opal_list_item_t*)node);
|
||||
ht->ht_size++;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int orte_hash_table_remove_proc(
|
||||
opal_hash_table_t* ht,
|
||||
const orte_process_name_t* proc)
|
||||
{
|
||||
uint32_t key = GET_KEY(proc);
|
||||
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
|
||||
orte_proc_hash_node_t *node;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(ht->ht_table_size == 0) {
|
||||
opal_output(0, "opal_hash_table_remove_value_proc:"
|
||||
"opal_hash_table_init() has not been called");
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
#endif
|
||||
for(node = (orte_proc_hash_node_t*)opal_list_get_first(list);
|
||||
node != (orte_proc_hash_node_t*)opal_list_get_end(list);
|
||||
node = (orte_proc_hash_node_t*)opal_list_get_next(node)) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &node->hn_key, proc)) {
|
||||
opal_list_remove_item(list, (opal_list_item_t*)node);
|
||||
opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node);
|
||||
ht->ht_size--;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
}
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
orte_process_name_t orte_hash_table_get_proc_name(opal_hash_table_t* ht,
|
||||
const orte_process_name_t* proc,
|
||||
orte_ns_cmp_bitmask_t mask)
|
||||
{
|
||||
uint32_t key = GET_KEY(proc);
|
||||
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
|
||||
orte_proc_hash_node_name_t *node;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(ht->ht_table_size == 0) {
|
||||
opal_output(0, "opal_hash_table_get_proc_name:"
|
||||
"opal_hash_table_init() has not been called");
|
||||
return *ORTE_NAME_INVALID;
|
||||
}
|
||||
#endif
|
||||
for(node = (orte_proc_hash_node_name_t*)opal_list_get_first(list);
|
||||
node != (orte_proc_hash_node_name_t*)opal_list_get_end(list);
|
||||
node = (orte_proc_hash_node_name_t*)opal_list_get_next(node)) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &node->hn_key, proc)) {
|
||||
return node->hn_value;
|
||||
}
|
||||
}
|
||||
return *ORTE_NAME_INVALID;
|
||||
}
|
||||
|
||||
|
||||
int orte_hash_table_set_proc_name(opal_hash_table_t* ht,
|
||||
const orte_process_name_t* proc,
|
||||
const orte_process_name_t *value,
|
||||
orte_ns_cmp_bitmask_t mask)
|
||||
{
|
||||
uint32_t key = GET_KEY(proc);
|
||||
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
|
||||
orte_proc_hash_node_name_t *node;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(ht->ht_table_size == 0) {
|
||||
opal_output(0, "opal_hash_table_set_proc_name:"
|
||||
"opal_hash_table_init() has not been called");
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
#endif
|
||||
for(node = (orte_proc_hash_node_name_t*)opal_list_get_first(list);
|
||||
node != (orte_proc_hash_node_name_t*)opal_list_get_end(list);
|
||||
node = (orte_proc_hash_node_name_t*)opal_list_get_next(node)) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &node->hn_key, proc)) {
|
||||
node->hn_value = *value;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
node = (orte_proc_hash_node_name_t*)opal_list_remove_first(&ht->ht_nodes);
|
||||
if(NULL == node) {
|
||||
node = OBJ_NEW(orte_proc_hash_node_name_t);
|
||||
if(NULL == node)
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
node->hn_key = *proc;
|
||||
node->hn_value = *value;
|
||||
opal_list_append(list, (opal_list_item_t*)node);
|
||||
ht->ht_size++;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int orte_hash_table_remove_proc_name(opal_hash_table_t* ht,
|
||||
const orte_process_name_t* proc,
|
||||
orte_ns_cmp_bitmask_t mask)
|
||||
{
|
||||
uint32_t key = GET_KEY(proc);
|
||||
opal_list_t* list = ht->ht_table + (key & ht->ht_mask);
|
||||
orte_proc_hash_node_name_t *node;
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(ht->ht_table_size == 0) {
|
||||
opal_output(0, "opal_hash_table_remove_proc_name:"
|
||||
"opal_hash_table_init() has not been called");
|
||||
return ORTE_ERR_BAD_PARAM;
|
||||
}
|
||||
#endif
|
||||
for(node = (orte_proc_hash_node_name_t*)opal_list_get_first(list);
|
||||
node != (orte_proc_hash_node_name_t*)opal_list_get_end(list);
|
||||
node = (orte_proc_hash_node_name_t*)opal_list_get_next(node)) {
|
||||
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &node->hn_key, proc)) {
|
||||
opal_list_remove_item(list, (opal_list_item_t*)node);
|
||||
opal_list_append(&ht->ht_nodes, (opal_list_item_t*)node);
|
||||
ht->ht_size--;
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
}
|
||||
return ORTE_ERR_NOT_FOUND;
|
||||
}
|
||||
|
@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*
|
||||
* A hash table indexed by orte_process_name_t.
|
||||
*/
|
||||
|
||||
#ifndef ORTE_PROC_TABLE_H
|
||||
#define ORTE_PROC_TABLE_H
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "orte/types.h"
|
||||
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
|
||||
#include "orte/util/name_fns.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* Retrieve value via orte_process_name_t key.
|
||||
*
|
||||
* @param table The input hash table (IN).
|
||||
* @param key The input key (IN).
|
||||
* @return The value associated with the key or NULL if the item is not found.
|
||||
*
|
||||
*/
|
||||
|
||||
ORTE_DECLSPEC void *orte_hash_table_get_proc(
|
||||
opal_hash_table_t* table,
|
||||
const orte_process_name_t* key);
|
||||
|
||||
/**
|
||||
* Set value based on uint32_t key.
|
||||
*
|
||||
* @param table The input hash table (IN).
|
||||
* @param key The input key (IN).
|
||||
* @param value The value to be associated with the key (IN).
|
||||
* @return ORTE return code.
|
||||
*
|
||||
*/
|
||||
|
||||
ORTE_DECLSPEC int orte_hash_table_set_proc(
|
||||
opal_hash_table_t* table,
|
||||
const orte_process_name_t*,
|
||||
void* value);
|
||||
|
||||
/**
|
||||
* Remove value based on uint32_t key.
|
||||
*
|
||||
* @param table The input hash table (IN).
|
||||
* @param key The input key (IN).
|
||||
* @return ORTE return code.
|
||||
*
|
||||
*/
|
||||
|
||||
ORTE_DECLSPEC int orte_hash_table_remove_proc(
|
||||
opal_hash_table_t* table,
|
||||
const orte_process_name_t* key);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve process name via orte_process_name_t key.
|
||||
*
|
||||
* @param table The input hash table (IN).
|
||||
* @param key The input key (IN).
|
||||
* @return The process name associated with the key or
|
||||
* ORTE_NAME_INVALID if the item is not found.
|
||||
*
|
||||
*/
|
||||
|
||||
ORTE_DECLSPEC orte_process_name_t orte_hash_table_get_proc_name(
|
||||
opal_hash_table_t* table,
|
||||
const orte_process_name_t* key,
|
||||
orte_ns_cmp_bitmask_t mask);
|
||||
|
||||
/**
|
||||
* Set process name based on uint32_t key.
|
||||
*
|
||||
* @param table The input hash table (IN).
|
||||
* @param key The input key (IN).
|
||||
* @param value The process name to be associated with the key (IN).
|
||||
* @return ORTE return code.
|
||||
*
|
||||
*/
|
||||
|
||||
ORTE_DECLSPEC int orte_hash_table_set_proc_name(
|
||||
opal_hash_table_t* table,
|
||||
const orte_process_name_t*,
|
||||
const orte_process_name_t*,
|
||||
orte_ns_cmp_bitmask_t mask);
|
||||
|
||||
/**
|
||||
* Remove process name based on uint32_t key.
|
||||
*
|
||||
* @param table The input hash table (IN).
|
||||
* @param key The input key (IN).
|
||||
* @return ORTE return code.
|
||||
*
|
||||
*/
|
||||
|
||||
ORTE_DECLSPEC int orte_hash_table_remove_proc_name(
|
||||
opal_hash_table_t* table,
|
||||
const orte_process_name_t* key,
|
||||
orte_ns_cmp_bitmask_t mask);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
|
||||
#endif /* OMPI_HASH_TABLE_H */
|
@ -30,7 +30,7 @@
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/bit_ops.h"
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "opal/dss/dss.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
@ -905,7 +905,7 @@ static int next_recips(opal_list_t *names, orte_grpcomm_mode_t mode)
|
||||
* information must be kept for later use, because if accept/connect
|
||||
* causes the proc to be added to the ompi_proc_all() list, it could
|
||||
* cause a connection storm. Therefore, we use an
|
||||
* orte_proc_table backing store to contain all modex information.
|
||||
* opal_hast_table_t backing store to contain all modex information.
|
||||
*
|
||||
* While we could add the now discovered proc into the ompi_proc_all()
|
||||
* list, this has some problems, in that we don't have the
|
||||
@ -1077,11 +1077,11 @@ modex_lookup_attr_data(modex_proc_data_t *proc_data,
|
||||
static modex_proc_data_t*
|
||||
modex_lookup_orte_proc(const orte_process_name_t *orte_proc)
|
||||
{
|
||||
modex_proc_data_t *proc_data;
|
||||
modex_proc_data_t *proc_data = NULL;
|
||||
|
||||
OPAL_THREAD_LOCK(&orte_grpcomm_basic.mutex);
|
||||
proc_data = (modex_proc_data_t*)
|
||||
orte_hash_table_get_proc(&orte_grpcomm_basic.modex_data, orte_proc);
|
||||
opal_hash_table_get_value_uint64(&orte_grpcomm_basic.modex_data,
|
||||
orte_util_hash_name(orte_proc), (void**)&proc_data);
|
||||
if (NULL == proc_data) {
|
||||
/* The proc clearly exists, so create a modex structure
|
||||
for it */
|
||||
@ -1091,7 +1091,8 @@ modex_lookup_orte_proc(const orte_process_name_t *orte_proc)
|
||||
OPAL_THREAD_UNLOCK(&orte_grpcomm_basic.mutex);
|
||||
return NULL;
|
||||
}
|
||||
orte_hash_table_set_proc(&orte_grpcomm_basic.modex_data, orte_proc, proc_data);
|
||||
opal_hash_table_set_value_uint64(&orte_grpcomm_basic.modex_data,
|
||||
orte_util_hash_name(orte_proc), proc_data);
|
||||
}
|
||||
OPAL_THREAD_UNLOCK(&orte_grpcomm_basic.mutex);
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "opal/util/output.h"
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
@ -269,13 +269,13 @@ void orte_iof_svc_sub_ack(
|
||||
calculate seq_min anymore. Otherwise, put its
|
||||
updated value in the table. */
|
||||
if (do_close) {
|
||||
orte_hash_table_remove_proc(&fwd->fwd_seq_hash,
|
||||
&hdr->msg_origin);
|
||||
opal_hash_table_remove_value_uint64(&fwd->fwd_seq_hash,
|
||||
orte_util_hash_name(&hdr->msg_origin));
|
||||
value_set = false;
|
||||
} else {
|
||||
value.uval = hdr->msg_seq + hdr->msg_len;
|
||||
orte_hash_table_set_proc(&fwd->fwd_seq_hash,
|
||||
&hdr->msg_origin, &value.vval);
|
||||
opal_hash_table_set_value_uint64(&fwd->fwd_seq_hash,
|
||||
orte_util_hash_name(&hdr->msg_origin), &value.vval);
|
||||
}
|
||||
}
|
||||
/* Otherwise, if the publication origin and publication
|
||||
@ -289,8 +289,8 @@ void orte_iof_svc_sub_ack(
|
||||
bytes ACK'ed across all the forwards on this
|
||||
subscription. */
|
||||
else {
|
||||
value.vval = orte_hash_table_get_proc(&fwd->fwd_seq_hash,
|
||||
&hdr->msg_origin);
|
||||
opal_hash_table_get_value_uint64(&fwd->fwd_seq_hash,
|
||||
orte_util_hash_name(&hdr->msg_origin), (void**)&value.vval);
|
||||
}
|
||||
|
||||
/* If we got a valid value, update the seq_min calculation */
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "opal/util/net.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
@ -1125,12 +1124,12 @@ mca_oob_t* mca_oob_tcp_component_init(int* priority)
|
||||
|
||||
int mca_oob_tcp_resolve(mca_oob_tcp_peer_t* peer)
|
||||
{
|
||||
mca_oob_tcp_addr_t* addr;
|
||||
mca_oob_tcp_addr_t* addr = NULL;
|
||||
|
||||
/* if the address is already cached - simply return it */
|
||||
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
addr = (mca_oob_tcp_addr_t *)orte_hash_table_get_proc(&mca_oob_tcp_component.tcp_peer_names,
|
||||
&peer->peer_name);
|
||||
opal_hash_table_get_value_uint64(&mca_oob_tcp_component.tcp_peer_names,
|
||||
orte_util_hash_name(&peer->peer_name), (void**)&addr);
|
||||
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
if(NULL != addr) {
|
||||
mca_oob_tcp_peer_resolved(peer, addr);
|
||||
@ -1459,23 +1458,26 @@ mca_oob_tcp_parse_uri(const char* uri, struct sockaddr* inaddr)
|
||||
int mca_oob_tcp_set_addr(const orte_process_name_t* name, const char* uri)
|
||||
{
|
||||
struct sockaddr_storage inaddr;
|
||||
mca_oob_tcp_addr_t* addr;
|
||||
mca_oob_tcp_peer_t* peer;
|
||||
mca_oob_tcp_addr_t* addr = NULL;
|
||||
mca_oob_tcp_peer_t* peer = NULL;
|
||||
int rc;
|
||||
if((rc = mca_oob_tcp_parse_uri(uri, (struct sockaddr*) &inaddr)) != ORTE_SUCCESS) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
addr = (mca_oob_tcp_addr_t*)orte_hash_table_get_proc(&mca_oob_tcp_component.tcp_peer_names, name);
|
||||
opal_hash_table_get_value_uint64(&mca_oob_tcp_component.tcp_peer_names,
|
||||
orte_util_hash_name(name), (void**)&addr);
|
||||
if(NULL == addr) {
|
||||
addr = OBJ_NEW(mca_oob_tcp_addr_t);
|
||||
addr->addr_name = *name;
|
||||
orte_hash_table_set_proc(&mca_oob_tcp_component.tcp_peer_names, &addr->addr_name, addr);
|
||||
opal_hash_table_set_value_uint64(&mca_oob_tcp_component.tcp_peer_names,
|
||||
orte_util_hash_name(&addr->addr_name), addr);
|
||||
}
|
||||
rc = mca_oob_tcp_addr_insert(addr, (struct sockaddr*) &inaddr);
|
||||
peer = (mca_oob_tcp_peer_t *)orte_hash_table_get_proc(
|
||||
&mca_oob_tcp_component.tcp_peers, &addr->addr_name);
|
||||
opal_hash_table_get_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
||||
orte_util_hash_name(&addr->addr_name),
|
||||
(void**)&peer);
|
||||
if(NULL != peer) {
|
||||
mca_oob_tcp_peer_resolved(peer, addr);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "opal/opal_socket_errno.h"
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/routed/routed.h"
|
||||
@ -458,9 +458,11 @@ static void mca_oob_tcp_msg_ident(mca_oob_tcp_msg_t* msg, mca_oob_tcp_peer_t* pe
|
||||
|
||||
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
if (orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &peer->peer_name, &src) != OPAL_EQUAL) {
|
||||
orte_hash_table_remove_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name);
|
||||
opal_hash_table_remove_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
||||
orte_util_hash_name(&peer->peer_name));
|
||||
peer->peer_name = src;
|
||||
orte_hash_table_set_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name, peer);
|
||||
opal_hash_table_set_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
||||
orte_util_hash_name(&peer->peer_name), peer);
|
||||
}
|
||||
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "opal/util/net.h"
|
||||
#include "opal/util/error.h"
|
||||
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
@ -216,14 +216,14 @@ int mca_oob_tcp_peer_send(mca_oob_tcp_peer_t* peer, mca_oob_tcp_msg_t* msg)
|
||||
mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const orte_process_name_t* name)
|
||||
{
|
||||
int rc;
|
||||
mca_oob_tcp_peer_t * peer, *old;
|
||||
mca_oob_tcp_peer_t * peer = NULL, *old;
|
||||
if (NULL == name) { /* can't look this one up */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
peer = (mca_oob_tcp_peer_t*)orte_hash_table_get_proc(
|
||||
&mca_oob_tcp_component.tcp_peers, name);
|
||||
opal_hash_table_get_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
||||
orte_util_hash_name(name), (void**)&peer);
|
||||
if (NULL != peer && 0 == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &peer->peer_name, name)) {
|
||||
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
return peer;
|
||||
@ -247,8 +247,8 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const orte_process_name_t* name)
|
||||
peer->peer_retries = 0;
|
||||
|
||||
/* add to lookup table */
|
||||
if(ORTE_SUCCESS != orte_hash_table_set_proc(&mca_oob_tcp_component.tcp_peers,
|
||||
&peer->peer_name, peer)) {
|
||||
if(OPAL_SUCCESS != opal_hash_table_set_value_uint64(&mca_oob_tcp_component.tcp_peers,
|
||||
orte_util_hash_name(&peer->peer_name), peer)) {
|
||||
MCA_OOB_TCP_PEER_RETURN(peer);
|
||||
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
return NULL;
|
||||
|
@ -93,7 +93,7 @@ typedef struct mca_oob_tcp_peer_t mca_oob_tcp_peer_t;
|
||||
#define MCA_OOB_TCP_PEER_RETURN(peer) \
|
||||
{ \
|
||||
mca_oob_tcp_peer_shutdown(peer); \
|
||||
orte_hash_table_remove_proc(&mca_oob_tcp_component.tcp_peers, &peer->peer_name); \
|
||||
opal_hash_table_remove_value_uint64(&mca_oob_tcp_component.tcp_peers, orte_util_hash_name(&peer->peer_name)); \
|
||||
OPAL_FREE_LIST_RETURN(&mca_oob_tcp_component.tcp_peer_free, \
|
||||
&peer->super); \
|
||||
}
|
||||
|
@ -14,9 +14,9 @@
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/threads/condition.h"
|
||||
#include "opal/runtime/opal_progress.h"
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/grpcomm/grpcomm.h"
|
||||
#include "orte/mca/rml/rml.h"
|
||||
@ -35,6 +35,7 @@ orte_routed_tree_update_route(orte_process_name_t *target,
|
||||
orte_process_name_t *route)
|
||||
{
|
||||
int rc;
|
||||
orte_process_name_t * route_copy;
|
||||
|
||||
if (target->jobid == ORTE_JOBID_INVALID ||
|
||||
target->vpid == ORTE_VPID_INVALID) {
|
||||
@ -70,12 +71,14 @@ orte_routed_tree_update_route(orte_process_name_t *target,
|
||||
}
|
||||
}
|
||||
|
||||
route_copy = malloc(sizeof(orte_process_name_t));
|
||||
*route_copy = *route;
|
||||
/* exact match */
|
||||
if (target->jobid != ORTE_JOBID_WILDCARD &&
|
||||
target->vpid != ORTE_VPID_WILDCARD) {
|
||||
if (ORTE_SUCCESS != (rc = orte_hash_table_set_proc_name(&orte_routed_tree_module.peer_list,
|
||||
target, route,
|
||||
ORTE_NS_CMP_ALL))) {
|
||||
rc = opal_hash_table_set_value_uint64(&orte_routed_tree_module.peer_list,
|
||||
orte_util_hash_name(target), route_copy);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
return rc;
|
||||
@ -84,13 +87,14 @@ orte_routed_tree_update_route(orte_process_name_t *target,
|
||||
/* vpid wildcard */
|
||||
if (target->jobid != ORTE_JOBID_WILDCARD &&
|
||||
target->vpid == ORTE_VPID_WILDCARD) {
|
||||
if (ORTE_SUCCESS != (rc = orte_hash_table_set_proc_name(&orte_routed_tree_module.vpid_wildcard_list,
|
||||
target, route,
|
||||
ORTE_NS_CMP_JOBID))) {
|
||||
opal_hash_table_set_value_uint32(&orte_routed_tree_module.vpid_wildcard_list,
|
||||
target->jobid, route_copy);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
free(route_copy);
|
||||
|
||||
return ORTE_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
@ -99,32 +103,35 @@ orte_routed_tree_update_route(orte_process_name_t *target,
|
||||
orte_process_name_t
|
||||
orte_routed_tree_get_route(orte_process_name_t *target)
|
||||
{
|
||||
orte_process_name_t ret;
|
||||
orte_process_name_t *ret;
|
||||
int rc;
|
||||
|
||||
/* if it is me, then the route is just direct */
|
||||
if (OPAL_EQUAL == opal_dss.compare(ORTE_PROC_MY_NAME, target, ORTE_NAME)) {
|
||||
ret = *target;
|
||||
ret = target;
|
||||
goto found;
|
||||
}
|
||||
|
||||
/* check exact matches */
|
||||
ret = orte_hash_table_get_proc_name(&orte_routed_tree_module.peer_list,
|
||||
target, ORTE_NS_CMP_ALL);
|
||||
if (OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &ret, ORTE_NAME_INVALID)) {
|
||||
rc = opal_hash_table_get_value_uint64(&orte_routed_tree_module.peer_list,
|
||||
orte_util_hash_name(target), (void**)&ret);
|
||||
if (ORTE_SUCCESS == rc &&
|
||||
OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ret, ORTE_NAME_INVALID)) {
|
||||
/* got a good result - return it */
|
||||
goto found;
|
||||
}
|
||||
|
||||
/* didn't find an exact match - check to see if a route for this job was defined */
|
||||
ret = orte_hash_table_get_proc_name(&orte_routed_tree_module.vpid_wildcard_list,
|
||||
target, ORTE_NS_CMP_JOBID);
|
||||
if (OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &ret, ORTE_NAME_INVALID)) {
|
||||
rc = opal_hash_table_get_value_uint32(&orte_routed_tree_module.vpid_wildcard_list,
|
||||
target->jobid, (void**)&ret);
|
||||
if (ORTE_SUCCESS == rc &&
|
||||
OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ret, ORTE_NAME_INVALID)) {
|
||||
/* got a good result - return it */
|
||||
goto found;
|
||||
}
|
||||
|
||||
/* default to wildcard route */
|
||||
ret = orte_routed_tree_module.wildcard_route;
|
||||
ret = &orte_routed_tree_module.wildcard_route;
|
||||
|
||||
found:
|
||||
|
||||
@ -132,9 +139,9 @@ orte_routed_tree_get_route(orte_process_name_t *target)
|
||||
"%s routed_tree_get(%s) --> %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(target),
|
||||
ORTE_NAME_PRINT(&ret)));
|
||||
ORTE_NAME_PRINT(ret)));
|
||||
|
||||
return ret;
|
||||
return *ret;
|
||||
}
|
||||
|
||||
static int process_callback(orte_jobid_t job, opal_buffer_t *buffer)
|
||||
|
@ -97,6 +97,8 @@ int
|
||||
orte_routed_tree_finalize(void)
|
||||
{
|
||||
int rc;
|
||||
uint64_t key;
|
||||
void * value, *node, *next_node;
|
||||
|
||||
if (selected) {
|
||||
/* if I am an application process, indicate that I am
|
||||
@ -114,6 +116,16 @@ orte_routed_tree_finalize(void)
|
||||
* sync as the oob will be asking us how to route
|
||||
* the message!
|
||||
*/
|
||||
rc = opal_hash_table_get_first_key_uint64(&orte_routed_tree_module.peer_list,
|
||||
&key, &value, &node);
|
||||
while(OPAL_SUCCESS == rc) {
|
||||
if(NULL != value) {
|
||||
free(value);
|
||||
}
|
||||
rc = opal_hash_table_get_next_key_uint64(&orte_routed_tree_module.peer_list,
|
||||
&key, &value, node, &next_node);
|
||||
node = next_node;
|
||||
}
|
||||
OBJ_DESTRUCT(&orte_routed_tree_module.peer_list);
|
||||
OBJ_DESTRUCT(&orte_routed_tree_module.vpid_wildcard_list);
|
||||
/* destruct the global condition and lock */
|
||||
|
@ -16,9 +16,8 @@
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "opal/threads/condition.h"
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
#include "orte/class/orte_proc_table.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "orte/mca/grpcomm/grpcomm.h"
|
||||
#include "orte/mca/odls/odls_types.h"
|
||||
@ -123,6 +122,8 @@ int
|
||||
orte_routed_unity_finalize(void)
|
||||
{
|
||||
int rc;
|
||||
uint64_t key;
|
||||
void * value, *node, *next_node;
|
||||
|
||||
if (recv_issued) {
|
||||
if (ORTE_SUCCESS != (rc = orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_UPDATE_ROUTES))) {
|
||||
@ -146,6 +147,14 @@ orte_routed_unity_finalize(void)
|
||||
* sync as the oob will be asking us how to route
|
||||
* the message!
|
||||
*/
|
||||
rc = opal_hash_table_get_first_key_uint64(&peer_list, &key, &value, &node);
|
||||
while(OPAL_SUCCESS == rc) {
|
||||
if(NULL != value) {
|
||||
free(value);
|
||||
}
|
||||
rc = opal_hash_table_get_next_key_uint64(&peer_list, &key, &value, node, &next_node);
|
||||
node = next_node;
|
||||
}
|
||||
OBJ_DESTRUCT(&peer_list);
|
||||
/* cleanup the global condition */
|
||||
OBJ_DESTRUCT(&cond);
|
||||
@ -160,8 +169,8 @@ int
|
||||
orte_routed_unity_update_route(orte_process_name_t *target,
|
||||
orte_process_name_t *route)
|
||||
{
|
||||
orte_ns_cmp_bitmask_t mask;
|
||||
int rc;
|
||||
orte_process_name_t * route_copy;
|
||||
|
||||
if (ORTE_JOB_FAMILY(target->jobid) != ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid)) {
|
||||
/* this message came from a different job family, so we will update
|
||||
@ -180,17 +189,15 @@ orte_routed_unity_update_route(orte_process_name_t *target,
|
||||
ORTE_NAME_PRINT(target),
|
||||
ORTE_NAME_PRINT(route)));
|
||||
|
||||
/* if we are routing everything for this target through one place, set
|
||||
* the mask to only compare jobids
|
||||
route_copy = malloc(sizeof(orte_process_name_t));
|
||||
*route_copy = *route;
|
||||
/* if we are routing everything for this target through one place,
|
||||
* then the target vpid is ORTE_NS_VPID_WILDCARD. So no need for
|
||||
* special cases, just add it
|
||||
*/
|
||||
if (ORTE_VPID_WILDCARD == target->vpid) {
|
||||
mask = ORTE_NS_CMP_JOBID;
|
||||
} else {
|
||||
mask = ORTE_NS_CMP_ALL;
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_hash_table_set_proc_name(&peer_list,
|
||||
target, route,
|
||||
mask))) {
|
||||
rc = opal_hash_table_set_value_uint64(&peer_list, orte_util_hash_name(target),
|
||||
route_copy);
|
||||
if (ORTE_SUCCESS != rc) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
}
|
||||
return rc;
|
||||
@ -211,32 +218,39 @@ direct:
|
||||
orte_process_name_t
|
||||
orte_routed_unity_get_route(orte_process_name_t *target)
|
||||
{
|
||||
orte_process_name_t ret;
|
||||
orte_process_name_t *ret, lookup;
|
||||
int rc;
|
||||
|
||||
if (ORTE_JOB_FAMILY(target->jobid) != ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid)) {
|
||||
ret = orte_hash_table_get_proc_name(&peer_list, target, ORTE_NS_CMP_ALL);
|
||||
if (OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &ret, ORTE_NAME_INVALID)) {
|
||||
rc = opal_hash_table_get_value_uint64(&peer_list, orte_util_hash_name(target),
|
||||
(void**)&ret);
|
||||
if (ORTE_SUCCESS != rc &&
|
||||
OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ret, ORTE_NAME_INVALID)) {
|
||||
/* got a good result - return it */
|
||||
goto found;
|
||||
}
|
||||
/* check to see if we specified the route to be for all vpids in the job */
|
||||
ret = orte_hash_table_get_proc_name(&peer_list, target, ORTE_NS_CMP_JOBID);
|
||||
if (OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, &ret, ORTE_NAME_INVALID)) {
|
||||
lookup = *target;
|
||||
lookup.vpid = ORTE_VPID_WILDCARD;
|
||||
rc = opal_hash_table_get_value_uint64(&peer_list, orte_util_hash_name(&lookup),
|
||||
(void**)&ret);
|
||||
if (ORTE_SUCCESS == rc &&
|
||||
OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ret, ORTE_NAME_INVALID)) {
|
||||
/* got a good result - return it */
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
/* if it is our own job family, or we didn't find it on the list, just go direct */
|
||||
ret = *target;
|
||||
ret = target;
|
||||
|
||||
found:
|
||||
OPAL_OUTPUT_VERBOSE((5, orte_routed_base_output,
|
||||
"%s routed_unity_get(%s) --> %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(target),
|
||||
ORTE_NAME_PRINT(&ret)));
|
||||
return ret;
|
||||
ORTE_NAME_PRINT(ret)));
|
||||
return *ret;
|
||||
}
|
||||
|
||||
static int process_callback(orte_jobid_t job, opal_buffer_t *buffer)
|
||||
|
@ -529,3 +529,14 @@ int orte_util_compare_name_fields(orte_ns_cmp_bitmask_t fields,
|
||||
*/
|
||||
return OPAL_EQUAL;
|
||||
}
|
||||
|
||||
|
||||
uint64_t orte_util_hash_name(const orte_process_name_t * name) {
|
||||
uint64_t hash;
|
||||
|
||||
hash = name->jobid;
|
||||
hash <<= sizeof(name->jobid) * 8;
|
||||
hash += name->vpid;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
@ -86,7 +86,8 @@ ORTE_DECLSPEC int orte_util_create_process_name(orte_process_name_t **name,
|
||||
ORTE_DECLSPEC int orte_util_compare_name_fields(orte_ns_cmp_bitmask_t fields,
|
||||
const orte_process_name_t* name1,
|
||||
const orte_process_name_t* name2);
|
||||
|
||||
/** This funtion returns a guaranteed unique hash value for the passed process name */
|
||||
ORTE_DECLSPEC uint64_t orte_util_hash_name(const orte_process_name_t * name);
|
||||
|
||||
END_C_DECLS
|
||||
#endif
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user