1
1

A faster search without the bitmap. Remove all references to the orte_bitmap.

This commit was SVN r14926.
Этот коммит содержится в:
George Bosilca 2007-06-06 20:23:14 +00:00
родитель 24eae5c1ec
Коммит fbb46f0ee7
4 изменённых файлов: 51 добавлений и 97 удалений

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

@ -2,7 +2,7 @@
* 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -28,29 +28,26 @@
#include "orte_config.h"
#include "opal/util/trace.h"
#include "orte/class/orte_bitmap.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/functional_layer/gpr_replica_fn.h"
/*
*/
bool orte_gpr_replica_check_itag_list(orte_gpr_replica_addr_mode_t addr_mode,
orte_std_cntr_t num_itags_search,
orte_gpr_replica_itag_t *itags,
orte_std_cntr_t num_itags_entry,
orte_gpr_replica_itag_t *entry_itags)
bool orte_gpr_replica_check_itag_list( orte_gpr_replica_addr_mode_t addr_mode,
orte_std_cntr_t num_itags_search,
orte_gpr_replica_itag_t *itags,
orte_std_cntr_t num_itags_entry,
orte_gpr_replica_itag_t *entry_itags )
{
orte_std_cntr_t i, j;
bool exclusive, match, found_one, not_set;
int rc, bit_is_set;
bool exclusive, match, not_set;
int found_some;
OPAL_TRACE(3);
/* check for trivial case */
if (NULL == itags || 0 == num_itags_search) { /* wildcard case - automatically true */
return true;
return true;
}
if (ORTE_GPR_REPLICA_NOT & addr_mode) { /* NOT flag set */
@ -65,44 +62,26 @@ bool orte_gpr_replica_check_itag_list(orte_gpr_replica_addr_mode_t addr_mode,
exclusive = false;
}
if (ORTE_SUCCESS != (rc = orte_bitmap_clear_all_bits(&(orte_gpr_replica_globals.srch_itag)))) {
ORTE_ERROR_LOG(rc);
return false;
}
/* run the search - check the container's tags to see which search tags are found */
found_one = false;
found_some = 0;
for (i=0; i < num_itags_entry; i++) { /* for each container tag */
match = false;
for (j=0; j < num_itags_search; j++) { /* check each search tag and see if it is present */
/* need to explicitly extend the bit array here to ensure
* it covers the specified itags. Otherwise, when
* we check to see if the bit was set (in the logic down
* below), we could potentially go outside the range of
* the array
*/
if (ORTE_SUCCESS != (rc = orte_bitmap_resize(&(orte_gpr_replica_globals.srch_itag), itags[j]))) {
ORTE_ERROR_LOG(rc);
return false;
}
if (entry_itags[i] == itags[j]) { /* found a match */
if (ORTE_SUCCESS != (rc = orte_bitmap_set_bit(&(orte_gpr_replica_globals.srch_itag), itags[j]))) {
ORTE_ERROR_LOG(rc);
return false;
}
if (ORTE_GPR_REPLICA_OR & addr_mode) { /* only need one match */
return (!not_set);
}
match = true;
found_one = true;
found_some++;
break; /* we're done for this j */
}
}
if (!match && exclusive) {
/* if it was exclusive, then I'm not allowed to have any tags outside
* of those in the search list. Since I checked the search list and
* found at least one that didn't match, this violates the exclusive requirement.
*/
return (not_set);
/* if it was exclusive, then I'm not allowed to have any tags outside
* of those in the search list. Since I checked the search list and
* found at least one that didn't match, this violates the exclusive requirement.
*/
return (not_set);
}
}
@ -110,21 +89,17 @@ bool orte_gpr_replica_check_itag_list(orte_gpr_replica_addr_mode_t addr_mode,
* that we would have already returned in the OR case. So, first check the XOR
* case
*/
if ((ORTE_GPR_REPLICA_XOR & addr_mode) && found_one) {
if ((ORTE_GPR_REPLICA_XOR & addr_mode) && (0 < found_some) ) {
return (!not_set);
}
/* Only thing we have left to check is AND */
/* check if any search tag was not found */
for (i=0; i < num_itags_search; i++) {
if (0 > (bit_is_set = orte_bitmap_is_set_bit(&(orte_gpr_replica_globals.srch_itag), itags[i]))) {
ORTE_ERROR_LOG(bit_is_set);
return false;
} else if (1 != bit_is_set) {
/* this tag was NOT found - required to find them all */
return (not_set);
}
}
/* As we counted the number of matched itags we can simply compare this
* number with the total number of itags for the AND operation.
*/
if( found_some != num_itags_search ) {
return (not_set);
}
/* okay, all the tags are there, so we now passed the AND test */
return (!not_set);
}

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

@ -3,7 +3,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -23,20 +23,14 @@
#ifndef ORTE_GPR_REPLICA_H
#define ORTE_GPR_REPLICA_H
#include "orte_config.h"
#include <time.h>
#include "orte/class/orte_bitmap.h"
#include "orte/class/orte_pointer_array.h"
#include "orte/class/orte_value_array.h"
#include "opal/threads/mutex.h"
#include "opal/threads/condition.h"
#include "orte/class/orte_pointer_array.h"
#include "orte/class/orte_value_array.h"
#include "orte/mca/ns/ns_types.h"
#include "orte/mca/gpr/base/base.h"
#if defined(c_plusplus) || defined(__cplusplus)
@ -125,7 +119,6 @@ typedef struct {
orte_pointer_array_t *srch_ival;
orte_std_cntr_t num_acted_upon;
orte_pointer_array_t *acted_upon;
orte_bitmap_t srch_itag;
} orte_gpr_replica_globals_t;
@ -442,21 +435,6 @@ typedef struct orte_gpr_replica_write_invalidate_t orte_gpr_replica_write_invali
extern orte_gpr_replica_t orte_gpr_replica;
extern orte_gpr_replica_globals_t orte_gpr_replica_globals;
/*
* Module open / close
*/
int orte_gpr_replica_open(void);
int orte_gpr_replica_close(void);
/*
* Startup / Shutdown
*/
orte_gpr_base_module_t *orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority);
int orte_gpr_replica_finalize(void);
int orte_gpr_replica_module_init(void);
int orte_gpr_replica_ft_event(int state);
ORTE_MODULE_DECLSPEC extern mca_gpr_base_component_t mca_gpr_replica_component;

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

@ -3,7 +3,7 @@
* 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -25,9 +25,6 @@
#include "orte_config.h"
#include "orte/class/orte_bitmap.h"
#include "opal/class/opal_object.h"
#include "gpr_replica.h"
/*

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

@ -3,7 +3,7 @@
* Copyright (c) 2004-2007 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
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -27,20 +27,27 @@
*/
#include "orte_config.h"
#include "orte/class/orte_bitmap.h"
#include "opal/class/opal_object.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/util/proc_info.h"
#include "orte/mca/rml/rml.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/gpr/replica/gpr_replica.h"
#include "orte/mca/gpr/replica/api_layer/gpr_replica_api.h"
#include "orte/mca/gpr/replica/communications/gpr_replica_comm.h"
#include "orte/mca/errmgr/errmgr.h"
/*
* Static functions.
*/
static orte_gpr_base_module_t*
orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads,
int *priority);
static int orte_gpr_replica_finalize(void);
static int orte_gpr_replica_open(void);
static int orte_gpr_replica_close(void);
static int orte_gpr_replica_module_init(void);
/*
* Struct of function pointers that need to be initialized
@ -142,7 +149,7 @@ orte_gpr_replica_globals_t orte_gpr_replica_globals;
/* instantiate the classes */
#include "orte/mca/gpr/replica/gpr_replica_class_instances.h"
int orte_gpr_replica_open(void)
static int orte_gpr_replica_open(void)
{
int id, tmp;
@ -170,14 +177,16 @@ int orte_gpr_replica_open(void)
/*
* close function
*/
int orte_gpr_replica_close(void)
static int orte_gpr_replica_close(void)
{
OPAL_TRACE(5);
return ORTE_SUCCESS;
}
orte_gpr_base_module_t *orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority)
static orte_gpr_base_module_t*
orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads,
int *priority)
{
int rc;
@ -291,8 +300,6 @@ orte_gpr_base_module_t *orte_gpr_replica_init(bool *allow_multi_user_threads, bo
}
orte_gpr_replica_globals.num_acted_upon = 0;
OBJ_CONSTRUCT(&(orte_gpr_replica_globals.srch_itag), orte_bitmap_t);
if (orte_gpr_replica_globals.debug) {
opal_output(0, "nb receive setup");
}
@ -301,13 +308,11 @@ orte_gpr_base_module_t *orte_gpr_replica_init(bool *allow_multi_user_threads, bo
initialized = true;
return &orte_gpr_replica_module;
} else {
return NULL;
}
return NULL;
}
int orte_gpr_replica_module_init(void)
static int orte_gpr_replica_module_init(void)
{
OPAL_TRACE(5);
@ -327,7 +332,7 @@ int orte_gpr_replica_module_init(void)
/*
* finalize routine
*/
int orte_gpr_replica_finalize(void)
static int orte_gpr_replica_finalize(void)
{
orte_std_cntr_t i;
orte_gpr_subscription_id_t j;
@ -433,8 +438,6 @@ int orte_gpr_replica_finalize(void)
OBJ_RELEASE(orte_gpr_replica_globals.acted_upon);
}
OBJ_DESTRUCT(&(orte_gpr_replica_globals.srch_itag));
/* All done */
if (orte_gpr_replica_globals.isolate) {
return ORTE_SUCCESS;
@ -444,3 +447,4 @@ int orte_gpr_replica_finalize(void)
return ORTE_SUCCESS;
}