From adb44c44b1dc919c23bddd8ffc43785773a3797c Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 12 Apr 2007 13:13:28 +0000 Subject: [PATCH] Revert prior commits from last night that involved significant change to the GPR, along with cosmetic changes to the odls_default module pending review and test. Reverts r14328, r14329, r14331, r14333, r14335, r14338, and r14336. This commit was SVN r14351. The following SVN revision numbers were found above: r14328 --> open-mpi/ompi@d1ce4a44cab69be9fd27fd7feb0ed05f40c2d7ca r14329 --> open-mpi/ompi@604e79f2d2372c783798d316b57a8a2b23e3f6c3 r14331 --> open-mpi/ompi@b2b3417475e60641a5c95033b58ae585e831271f r14333 --> open-mpi/ompi@8882f355b497223a11b99a1cfadf8020fe6bafc7 r14335 --> open-mpi/ompi@10dfd534f6999bc2f423213989022fafc897ede8 r14336 --> open-mpi/ompi@5c65c55e593aa6a86aaa4c3fc91ae353cc056444 r14338 --> open-mpi/ompi@579184cd720351943ed371b0dc770cdc87a8b19e --- orte/class/Makefile.am | 4 +- orte/class/orte_bitmap.c | 250 ++++++++++++++++++ orte/class/orte_bitmap.h | 166 ++++++++++++ .../api_layer/gpr_replica_put_get_api.c | 23 +- .../functional_layer/gpr_replica_dict_fn.c | 83 ++++-- .../functional_layer/gpr_replica_put_get_fn.c | 1 - orte/mca/gpr/replica/gpr_replica.h | 28 +- .../gpr/replica/gpr_replica_class_instances.h | 5 +- orte/mca/gpr/replica/gpr_replica_component.c | 38 ++- orte/mca/odls/default/odls_default.h | 10 + orte/mca/odls/default/odls_default_module.c | 10 +- 11 files changed, 544 insertions(+), 74 deletions(-) create mode 100644 orte/class/orte_bitmap.c create mode 100644 orte/class/orte_bitmap.h diff --git a/orte/class/Makefile.am b/orte/class/Makefile.am index c8f53eb174..0efc43f8d9 100644 --- a/orte/class/Makefile.am +++ b/orte/class/Makefile.am @@ -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-2007 The University of Tennessee and The University +# 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, @@ -21,10 +21,12 @@ headers += \ class/orte_proc_table.h \ + class/orte_bitmap.h \ class/orte_pointer_array.h \ class/orte_value_array.h libopen_rte_la_SOURCES += \ class/orte_proc_table.c \ + class/orte_bitmap.c \ class/orte_pointer_array.c \ class/orte_value_array.c diff --git a/orte/class/orte_bitmap.c b/orte/class/orte_bitmap.c new file mode 100644 index 0000000000..39cecc73f4 --- /dev/null +++ b/orte/class/orte_bitmap.c @@ -0,0 +1,250 @@ +/* + * 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-2007 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 + +#include "orte/orte_constants.h" +#include "orte/mca/errmgr/errmgr.h" + +#include "orte/class/orte_bitmap.h" + + +#define SIZE_OF_CHAR (sizeof(char) * 8) +#define DEFAULT_BITMAP_SIZE 64 + +static void orte_bitmap_construct(orte_bitmap_t *bm); +static void orte_bitmap_destruct(orte_bitmap_t *bm); + +OBJ_CLASS_INSTANCE( + orte_bitmap_t, + opal_object_t, + orte_bitmap_construct, + orte_bitmap_destruct +); + + +static void +orte_bitmap_construct(orte_bitmap_t *bm) +{ + orte_std_cntr_t size; + + size = DEFAULT_BITMAP_SIZE / SIZE_OF_CHAR; + + bm->array_size = size + ((size % SIZE_OF_CHAR == 0) ? 0 : 1); + bm->bitmap = (unsigned char *) malloc(bm->array_size); + bm->legal_numbits = SIZE_OF_CHAR*bm->array_size; + memset(bm->bitmap, 0, bm->array_size); +} + + +static void +orte_bitmap_destruct(orte_bitmap_t *bm) +{ + if (NULL != bm->bitmap) { + free(bm->bitmap); + } +} + + +int +orte_bitmap_resize(orte_bitmap_t *bm, orte_std_cntr_t bit) +{ + orte_std_cntr_t index, new_size, i; + + index = bit / SIZE_OF_CHAR; + index += (bit % SIZE_OF_CHAR == 0) ? 0 : 1; + + if (index >= bm->array_size) { + + /* We need to allocate more space for the bitmap, since we are + out of range. We dont throw any error here, because this is + valid and we simply expand the bitmap */ + + new_size = (index / bm->array_size + 1 ) * bm->array_size; + + /* New size is just a multiple of the original size to fit in + the index. */ + + bm->bitmap = (unsigned char *) realloc(bm->bitmap, new_size); + if (NULL == bm->bitmap) { + ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE); + return ORTE_ERR_OUT_OF_RESOURCE; + } + + /* zero out the new elements */ + for (i = bm->array_size; i < new_size; ++i) { + bm->bitmap[i] = 0; + } + + /* Update the array_size */ + bm->array_size = new_size; + bm->legal_numbits = new_size*SIZE_OF_CHAR; + } + + return ORTE_SUCCESS; +} + +int +orte_bitmap_set_bit(orte_bitmap_t *bm, orte_std_cntr_t bit) +{ + orte_std_cntr_t index, offset; + int rc; + + if (NULL == bm) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + /* make sure the bitmap covers the requested bit */ + if (ORTE_SUCCESS != (rc = orte_bitmap_resize(bm, bit))) { + ORTE_ERROR_LOG(rc); + return rc; + } + + index = bit / SIZE_OF_CHAR; + offset = bit % SIZE_OF_CHAR; + + /* Now set the bit */ + bm->bitmap[index] |= (1 << offset); + + return ORTE_SUCCESS; +} + + +int +orte_bitmap_clear_bit(orte_bitmap_t *bm, orte_std_cntr_t bit) +{ + orte_std_cntr_t index, offset; + int rc; + + if (NULL == bm) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + /* make sure the bitmap covers the requested bit */ + if (ORTE_SUCCESS != (rc = orte_bitmap_resize(bm, bit))) { + ORTE_ERROR_LOG(rc); + return rc; + } + + index = bit / SIZE_OF_CHAR; + offset = bit % SIZE_OF_CHAR; + + /* now clear the bit */ + bm->bitmap[index] &= ~(1 << offset); + return ORTE_SUCCESS; +} + + +int +orte_bitmap_is_set_bit(orte_bitmap_t *bm, orte_std_cntr_t bit) +{ + orte_std_cntr_t index, offset; + + if ((bit > bm->legal_numbits - 1) || (NULL == bm)) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + index = bit / SIZE_OF_CHAR; + offset = bit % SIZE_OF_CHAR; + + if (index >= bm->array_size) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + if (0 != (bm->bitmap[index] & (1 << offset))) { + return (int) true; + } + + return (int) false; +} + + +int +orte_bitmap_clear_all_bits(orte_bitmap_t *bm) +{ + if (NULL == bm) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + memset(bm->bitmap, 0, bm->array_size); + return ORTE_SUCCESS; +} + + +int +orte_bitmap_set_all_bits(orte_bitmap_t *bm) +{ + orte_std_cntr_t i; + + if (NULL == bm) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + for (i = 0; i < bm->array_size; ++i) { + bm->bitmap[i] = ~((char) 0); + } + return ORTE_SUCCESS; +} + + +int +orte_bitmap_find_and_set_first_unset_bit(orte_bitmap_t *bm, orte_std_cntr_t *position) +{ + orte_std_cntr_t i = 0; + unsigned char temp; + unsigned char all_ones = 0xff; + + if (NULL == bm || NULL == position) { + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + return ORTE_ERR_BAD_PARAM; + } + + /* Neglect all which don't have an unset bit */ + *position = 0; + while((i < bm->array_size) && (bm->bitmap[i] == all_ones)) { + ++i; + } + + if (i == bm->array_size) { + /* increase the bitmap size then */ + *position = bm->array_size * SIZE_OF_CHAR; + return orte_bitmap_set_bit(bm, *position); + } + + /* This one has an unset bit, find its bit number */ + + temp = bm->bitmap[i]; + while (temp & 0x1) { + ++(*position); + temp >>= 1; + } + + /* Now set the bit number */ + bm->bitmap[i] |= (bm->bitmap[i] + 1); + + (*position) += i * SIZE_OF_CHAR; + return ORTE_SUCCESS; +} diff --git a/orte/class/orte_bitmap.h b/orte/class/orte_bitmap.h new file mode 100644 index 0000000000..bf6bca9818 --- /dev/null +++ b/orte/class/orte_bitmap.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2004-2005 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 + * 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 + * + * See ompi_bitmap.h for an explanation of why there is a split + * between OMPI and ORTE for this generic class. + * + * A bitmap implementation. The bits start off with 0, so this bitmap + * has bits numbered as bit 0, bit 1, bit 2 and so on. This bitmap + * has auto-expansion capabilities, that is once the size is set + * during init, it can be automatically expanded by setting the bit + * beyond the current size. But note, this is allowed just when the + * bit is set -- so the valid functions are set_bit and + * find_and_set_bit. Other functions like clear, if passed a bit + * outside the initialized range will result in an error. + * + */ + +#ifndef ORTE_BITMAP_H +#define ORTE_BITMAP_H + +#include "orte_config.h" +#include "orte/orte_types.h" + +#include + +#include "opal/types.h" +#include "opal/class/opal_object.h" + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + +struct orte_bitmap_t { + opal_object_t super; /**< Subclass of opal_object_t */ + unsigned char *bitmap; /**< The actual bitmap array of characters */ + orte_std_cntr_t array_size; /**< The actual array size that maintains the bitmap */ + orte_std_cntr_t legal_numbits; /**< The number of bits which are legal (the + actual bitmap may contain more bits, since + it needs to be rounded to the nearest + char */ +}; + +typedef struct orte_bitmap_t orte_bitmap_t; + +ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_bitmap_t); + + +/** + * Sizes the bitmap to ensure it has at least the specified number of + * bits in it. If it already does, then nothing happens. However, if the + * bitmap is too small, then it is resized to accommodate the bit, with + * all bits in the new space "cleared" + * + * @param bitmap The input bitmap (IN) + * @param bit The bit that must be "covered" by the bitmap (IN) + * @return ORTE error code or success + * + */ +ORTE_DECLSPEC int orte_bitmap_resize(orte_bitmap_t *bm, orte_std_cntr_t bit); + + +/** + * Set a bit of the bitmap. If the bit asked for is beyond the current + * size of the bitmap, then the bitmap is extended to accomodate the + * bit + * + * @param bitmap The input bitmap (IN) + * @param bit The bit which is to be set (IN) + * @return OMPI error code or success + * + */ +ORTE_DECLSPEC int orte_bitmap_set_bit(orte_bitmap_t *bm, orte_std_cntr_t bit); + + +/** + * Clear/unset a bit of the bitmap. If the bit is beyond the current + * size of the bitmap, an error is returned + * + * @param bitmap The input bitmap (IN) + * @param bit The bit which is to be cleared (IN) + * @return ORTE error code if the bit is out of range, else success + * + */ +ORTE_DECLSPEC int orte_bitmap_clear_bit(orte_bitmap_t *bm, orte_std_cntr_t bit); + + +/** + * Find out if a bit is set in the bitmap + * + * @param bitmap The input bitmap (IN) + * @param bit The bit which is to be checked (IN) + * @return ORTE error code if the bit is out of range + * 1 if the bit is set + * 0 if the bit is not set + * + */ +ORTE_DECLSPEC int orte_bitmap_is_set_bit(orte_bitmap_t *bm, orte_std_cntr_t bit); + + +/** + * Find the first clear bit in the bitmap and set it + * + * @param bitmap The input bitmap (IN) + * @param position Position of the first clear bit (OUT) + + * @return err ORTE_SUCCESS on success + */ +ORTE_DECLSPEC int orte_bitmap_find_and_set_first_unset_bit(orte_bitmap_t *bm, + orte_std_cntr_t *position); + + +/** + * Clear all bits in the bitmap + * + * @param bitmap The input bitmap (IN) + * @return ORTE error code if bm is NULL + * + */ +ORTE_DECLSPEC int orte_bitmap_clear_all_bits(orte_bitmap_t *bm); + + +/** + * Set all bits in the bitmap + * @param bitmap The input bitmap (IN) + * @return ORTE error code if bm is NULL + * + */ +ORTE_DECLSPEC int orte_bitmap_set_all_bits(orte_bitmap_t *bm); + + +/** + * Gives the current size (number of bits) in the bitmap. This is the + * legal (accessible) number of bits + * + * @param bitmap The input bitmap (IN) + * @return ORTE error code if bm is NULL + * + */ +static inline int orte_bitmap_size(orte_bitmap_t *bm) +{ + return (NULL == bm) ? 0 : (int)bm->legal_numbits; +} + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif diff --git a/orte/mca/gpr/replica/api_layer/gpr_replica_put_get_api.c b/orte/mca/gpr/replica/api_layer/gpr_replica_put_get_api.c index 863b50b124..348d8b6394 100644 --- a/orte/mca/gpr/replica/api_layer/gpr_replica_put_get_api.c +++ b/orte/mca/gpr/replica/api_layer/gpr_replica_put_get_api.c @@ -60,20 +60,25 @@ int orte_gpr_replica_put(orte_std_cntr_t cnt, orte_gpr_value_t **values) /* first check for error - all keyvals must have a non-NULL string key */ for (j=0; j < val->cnt; j++) { if (NULL == (val->keyvals[j])->key) { - rc = ORTE_ERR_BAD_PARAM; - goto CLEANUP; + ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); + OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex); + return ORTE_ERR_BAD_PARAM; } } /* find the segment */ if (ORTE_SUCCESS != (rc = orte_gpr_replica_find_seg(&seg, true, val->segment))) { - goto CLEANUP; + ORTE_ERROR_LOG(rc); + OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex); + return rc; } /* convert tokens to array of itags */ if (ORTE_SUCCESS != (rc = orte_gpr_replica_get_itag_list(&itags, seg, - val->tokens, &(val->num_tokens)))) { - goto CLEANUP; + val->tokens, &(val->num_tokens)))) { + ORTE_ERROR_LOG(rc); + OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex); + return rc; } if (ORTE_SUCCESS != (rc = orte_gpr_replica_put_fn(val->addr_mode, seg, itags, val->num_tokens, @@ -82,16 +87,17 @@ int orte_gpr_replica_put(orte_std_cntr_t cnt, orte_gpr_value_t **values) } if (ORTE_SUCCESS != (rc = orte_gpr_replica_check_events())) { + ORTE_ERROR_LOG(rc); goto CLEANUP; } if (NULL != itags) { free(itags); - itags = NULL; } + itags = NULL; } - CLEANUP: /* or not ... */ +CLEANUP: /* release list of itags */ if (NULL != itags) { free(itags); @@ -99,13 +105,12 @@ int orte_gpr_replica_put(orte_std_cntr_t cnt, orte_gpr_value_t **values) if (ORTE_SUCCESS == rc) { rc = orte_gpr_replica_process_callbacks(); - } else { - ORTE_ERROR_LOG(rc); } OPAL_THREAD_UNLOCK(&orte_gpr_replica_globals.mutex); return rc; + } diff --git a/orte/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c b/orte/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c index e37fd0d412..133773580a 100644 --- a/orte/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c +++ b/orte/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c @@ -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-2007 The University of Tennessee and The University + * 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, @@ -28,26 +28,29 @@ #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, not_set; - int found_some; + bool exclusive, match, found_one, not_set; + int rc, bit_is_set; 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 */ @@ -62,26 +65,44 @@ 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_some = 0; + found_one = false; 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 */ - if (entry_itags[i] == itags[j]) { /* found a match */ - if (ORTE_GPR_REPLICA_OR & addr_mode) { /* only need one match */ - return (!not_set); + /* 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_some++; - break; /* we're done for this i */ + found_one = true; } } 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); } } @@ -89,17 +110,21 @@ 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) && (0 < found_some) ) { + if ((ORTE_GPR_REPLICA_XOR & addr_mode) && found_one) { 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); } diff --git a/orte/mca/gpr/replica/functional_layer/gpr_replica_put_get_fn.c b/orte/mca/gpr/replica/functional_layer/gpr_replica_put_get_fn.c index a6d77541d7..883075e1e6 100644 --- a/orte/mca/gpr/replica/functional_layer/gpr_replica_put_get_fn.c +++ b/orte/mca/gpr/replica/functional_layer/gpr_replica_put_get_fn.c @@ -139,7 +139,6 @@ int orte_gpr_replica_put_fn(orte_gpr_addr_mode_t addr_mode, for (i=0; i < num_tokens; i++) { orte_gpr_replica_dict_reverse_lookup(&tmp, seg, token_itags[i]); opal_output(0, "\t%s", tmp); - free(tmp); /* We all enjoy allocating and releasing memory all over the code isn't it ? */ } } diff --git a/orte/mca/gpr/replica/gpr_replica.h b/orte/mca/gpr/replica/gpr_replica.h index 138c1fa4bf..20cccfbf10 100644 --- a/orte/mca/gpr/replica/gpr_replica.h +++ b/orte/mca/gpr/replica/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-2007 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -23,14 +23,20 @@ #ifndef ORTE_GPR_REPLICA_H #define ORTE_GPR_REPLICA_H + #include "orte_config.h" +#include + +#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) @@ -119,6 +125,7 @@ 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; @@ -423,6 +430,21 @@ 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; diff --git a/orte/mca/gpr/replica/gpr_replica_class_instances.h b/orte/mca/gpr/replica/gpr_replica_class_instances.h index b8fa67d435..5512ba4365 100644 --- a/orte/mca/gpr/replica/gpr_replica_class_instances.h +++ b/orte/mca/gpr/replica/gpr_replica_class_instances.h @@ -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-2007 The University of Tennessee and The University + * 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, @@ -25,6 +25,9 @@ #include "orte_config.h" +#include "orte/class/orte_bitmap.h" +#include "opal/class/opal_object.h" + #include "gpr_replica.h" /* diff --git a/orte/mca/gpr/replica/gpr_replica_component.c b/orte/mca/gpr/replica/gpr_replica_component.c index 8fa76fa6f9..dc3a10cbe7 100644 --- a/orte/mca/gpr/replica/gpr_replica_component.c +++ b/orte/mca/gpr/replica/gpr_replica_component.c @@ -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-2007 The University of Tennessee and The University + * 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, @@ -27,27 +27,20 @@ */ #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 @@ -148,7 +141,7 @@ orte_gpr_replica_globals_t orte_gpr_replica_globals; /* instantiate the classes */ #include "orte/mca/gpr/replica/gpr_replica_class_instances.h" -static int orte_gpr_replica_open(void) +int orte_gpr_replica_open(void) { int id, tmp; @@ -176,16 +169,14 @@ static int orte_gpr_replica_open(void) /* * close function */ -static int orte_gpr_replica_close(void) +int orte_gpr_replica_close(void) { OPAL_TRACE(5); return ORTE_SUCCESS; } -static orte_gpr_base_module_t* -orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, - int *priority) +orte_gpr_base_module_t *orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority) { int rc; @@ -299,6 +290,8 @@ orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, } 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"); } @@ -307,11 +300,13 @@ orte_gpr_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, initialized = true; return &orte_gpr_replica_module; + } else { + return NULL; } - return NULL; } -static int orte_gpr_replica_module_init(void) + +int orte_gpr_replica_module_init(void) { OPAL_TRACE(5); @@ -331,7 +326,7 @@ static int orte_gpr_replica_module_init(void) /* * finalize routine */ -static int orte_gpr_replica_finalize(void) +int orte_gpr_replica_finalize(void) { orte_std_cntr_t i; orte_gpr_subscription_id_t j; @@ -437,6 +432,8 @@ static 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; @@ -446,4 +443,3 @@ static int orte_gpr_replica_finalize(void) return ORTE_SUCCESS; } - diff --git a/orte/mca/odls/default/odls_default.h b/orte/mca/odls/default/odls_default.h index 05b1c15bb0..4e11d002bf 100644 --- a/orte/mca/odls/default/odls_default.h +++ b/orte/mca/odls/default/odls_default.h @@ -50,6 +50,16 @@ orte_odls_base_module_t* orte_odls_default_component_init(int *priority); */ int orte_odls_default_finalize(void); +/* + * Interface + */ +int orte_odls_default_subscribe_launch_data(orte_jobid_t job, orte_gpr_notify_cb_fn_t cbfunc); +int orte_odls_default_get_add_procs_data(orte_gpr_notify_data_t **data, orte_job_map_t *map); +int orte_odls_default_launch_local_procs(orte_gpr_notify_data_t *data, char **base_environ); +int orte_odls_default_kill_local_procs(orte_jobid_t job, bool set_state); +int orte_odls_default_signal_local_procs(const orte_process_name_t *proc, + int32_t signal); + /** * ODLS Default globals */ diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index bc025700cb..05621142aa 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -104,15 +104,7 @@ static int orte_pls_fork_preload_append_binary(orte_app_context_t* context, static int orte_pls_fork_preload_append_files(orte_app_context_t* context, orte_filem_base_request_t *filem_request); static bool is_preload_local_dup(char *local_ref, orte_filem_base_request_t *filem_request); -/* - * External Interface - */ -static int orte_odls_default_subscribe_launch_data(orte_jobid_t job, orte_gpr_notify_cb_fn_t cbfunc); -static int orte_odls_default_get_add_procs_data(orte_gpr_notify_data_t **data, orte_job_map_t *map); -static int orte_odls_default_launch_local_procs(orte_gpr_notify_data_t *data, char **base_environ); -static int orte_odls_default_kill_local_procs(orte_jobid_t job, bool set_state); -static int orte_odls_default_signal_local_procs(const orte_process_name_t *proc, - int32_t signal); + static void set_handler_default(int sig);