1
1

Replace all occurences of orte_pointer_array by opal_pointer_array. Remove the

implementation of orte_pointer_array.

This commit was SVN r17636.
This commit is contained in:
George Bosilca 2008-02-28 05:32:23 +00:00
parent 678e6c7f0d
commit 9d421bea2a
23 changed files with 87 additions and 731 deletions

View File

@ -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-2006 The University of Tennessee and The University
* 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,
@ -478,7 +478,6 @@ static int spawn(int count, char **array_of_commands,
char *base_prefix=NULL;
orte_job_t *jdata;
orte_std_cntr_t dummy;
orte_app_context_t *app;
bool timing = false;
@ -522,7 +521,7 @@ static int spawn(int count, char **array_of_commands,
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* add the app to the job data */
orte_pointer_array_add(&dummy, jdata->apps, app);
opal_pointer_array_add(jdata->apps, app);
jdata->num_apps++;
/* copy over the name of the executable */

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -127,9 +127,9 @@ static inline void *opal_pointer_array_get_item(opal_pointer_array_t *table,
{
void *p;
if( table->size <= element_index ) {
return NULL;
}
if( table->size <= element_index ) {
return NULL;
}
OPAL_THREAD_LOCK(&(table->lock));
p = table->addr[element_index];
OPAL_THREAD_UNLOCK(&(table->lock));

View File

@ -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-2008 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,8 @@
headers += \
class/orte_proc_table.h \
class/orte_pointer_array.h \
class/orte_value_array.h
libopen_rte_la_SOURCES += \
class/orte_proc_table.c \
class/orte_pointer_array.c \
class/orte_value_array.c

View File

@ -1,410 +0,0 @@
/*
* 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-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 "orte/constants.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "orte/class/orte_pointer_array.h"
#include "opal/util/output.h"
static void orte_pointer_array_construct(orte_pointer_array_t *);
static void orte_pointer_array_destruct(orte_pointer_array_t *);
static bool grow_table(orte_pointer_array_t *table, orte_std_cntr_t num_needed);
OBJ_CLASS_INSTANCE(
orte_pointer_array_t,
opal_object_t,
orte_pointer_array_construct,
orte_pointer_array_destruct
);
/*
* orte_pointer_array constructor
*/
void orte_pointer_array_construct(orte_pointer_array_t *array)
{
OBJ_CONSTRUCT(&array->lock, opal_mutex_t);
array->lowest_free = 0;
array->number_free = 0;
array->size = 0;
array->max_size = 0;
array->block_size = 0;
array->addr = 0;
}
/*
* orte_pointer_array destructor
*/
void orte_pointer_array_destruct(orte_pointer_array_t *array)
{
/* free table */
if( NULL != array->addr) {
free(array->addr);
}
OBJ_DESTRUCT(&array->lock);
}
/**
* initialize an array object
*/
int orte_pointer_array_init(orte_pointer_array_t **array,
orte_std_cntr_t initial_allocation,
orte_std_cntr_t max_size, orte_std_cntr_t block_size)
{
orte_std_cntr_t num_bytes;
/* check for errors */
if (NULL == array || max_size < block_size) {
return ORTE_ERR_BAD_PARAM;
}
*array = OBJ_NEW(orte_pointer_array_t);
if (NULL == *array) {
return ORTE_ERR_OUT_OF_RESOURCE;
}
(*array)->max_size = max_size;
(*array)->block_size = block_size;
if (0 < initial_allocation) {
num_bytes = initial_allocation * sizeof(void*);
(*array)->number_free = initial_allocation;
(*array)->size = initial_allocation;
} else {
num_bytes = block_size * sizeof(void*);
(*array)->number_free = block_size;
(*array)->size = block_size;
}
(*array)->addr = (void **)malloc(num_bytes);
if (NULL == (*array)->addr) { /* out of memory */
OBJ_RELEASE(*array);
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* init the array elements to NULL */
memset((*array)->addr, 0, num_bytes);
return ORTE_SUCCESS;
}
/**
* add a pointer to dynamic pointer table
*
* @param table Pointer to orte_pointer_array_t object (IN)
* @param ptr Pointer to be added to table (IN)
*
* @param (OUT) Array index where ptr is inserted
* @return ORTE_ERROR_code if it fails
*/
int orte_pointer_array_add(orte_std_cntr_t *location, orte_pointer_array_t *table, void *ptr)
{
orte_std_cntr_t i, element_index;
if (0) {
opal_output(0,"orte_pointer_array_add: IN: "
" table %p (size %d, lowest free %d, number free %d)"
" ptr = %p\n",
(void*)table, table->size, table->lowest_free, table->number_free,
ptr);
}
assert(table != NULL);
OPAL_THREAD_LOCK(&(table->lock));
if (table->number_free == 0) {
/* need to grow table */
if (!grow_table(table, 1)) {
OPAL_THREAD_UNLOCK(&(table->lock));
return ORTE_ERR_OUT_OF_RESOURCE;
}
}
assert(table->addr != NULL);
assert(table->size > 0);
assert(table->lowest_free < table->size);
assert(table->number_free > 0);
assert(table->number_free <= table->size);
/*
* add pointer to table, and return the index
*/
element_index = table->lowest_free;
assert(table->addr[element_index] == NULL);
table->addr[element_index] = ptr;
table->number_free--;
if (table->number_free > 0) {
for (i = table->lowest_free + 1; i < table->size; i++) {
if (table->addr[i] == NULL) {
table->lowest_free = i;
break;
}
}
}
else {
table->lowest_free = table->size;
}
if (0) {
opal_output(0,"orte_pointer_array_add: OUT: "
" table %p (size %d, lowest free %d, number free %d)"
" addr[%d] = %p\n",
(void*)table, table->size, table->lowest_free, table->number_free,
element_index, ptr);
}
OPAL_THREAD_UNLOCK(&(table->lock));
*location = element_index;
return ORTE_SUCCESS;
}
/**
* free a slot in dynamic pointer table for reuse
*
*
* @param table Pointer to orte_pointer_array_t object (IN)
* @param ptr Pointer to be added to table (IN)
*
* @return Error code
*
* Assumption: NULL element is free element.
*/
int orte_pointer_array_set_item(orte_pointer_array_t *table, orte_std_cntr_t element_index,
void * value)
{
assert(table != NULL);
#if 0
opal_output(0,"orte_pointer_array_set_item: IN: "
" table %p (size %ld, lowest free %ld, number free %ld)"
" addr[%d] = %p\n",
table, table->size, table->lowest_free, table->number_free,
element_index, table->addr[element_index]);
#endif
/* expand table if required to set a specific index */
OPAL_THREAD_LOCK(&(table->lock));
if (table->size <= element_index) {
if (!grow_table(table, 1)) {
OPAL_THREAD_UNLOCK(&(table->lock));
return ORTE_ERROR;
}
}
/*
* allow a specific index to be changed.
*/
if ( NULL == table->addr[element_index] ) {
table->addr[element_index] = value;
/* mark element as free, if NULL element */
if( NULL == value ) {
if (element_index < table->lowest_free) {
table->lowest_free = element_index;
}
}
else {
table->number_free--;
/* Reset lowest_free if required */
if ( element_index == table->lowest_free ) {
orte_std_cntr_t i;
table->lowest_free=table->size;
for ( i=element_index; i<table->size; i++) {
if ( NULL == table->addr[i] ){
table->lowest_free = i;
break;
}
}
}
}
}
else {
table->addr[element_index] = value;
/* mark element as free, if NULL element */
if( NULL == value ) {
if (element_index < table->lowest_free) {
table->lowest_free = element_index;
}
table->number_free++;
}
else {
/* Reset lowest_free if required */
if ( element_index == table->lowest_free ) {
orte_std_cntr_t i;
table->lowest_free=table->size;
for ( i=element_index; i<table->size; i++) {
if ( NULL == table->addr[i] ){
table->lowest_free = i;
break;
}
}
}
}
}
#if 0
opal_output(0,"orte_pointer_array_set_item: OUT: "
" table %p (size %ld, lowest free %ld, number free %ld)"
" addr[%d] = %p\n",
table, table->size, table->lowest_free, table->number_free,
element_index, table->addr[element_index]);
#endif
OPAL_THREAD_UNLOCK(&(table->lock));
return ORTE_SUCCESS;
}
/**
* Test whether a certain element is already in use. If not yet
* in use, reserve it.
*
* @param array Pointer to array (IN)
* @param element_index Index of element to be tested (IN)
* @param value New value to be set at element index (IN)
*
* @return true/false True if element could be reserved
* False if element could not be reserved (e.g.in use).
*
* In contrary to array_set, this function does not allow to overwrite
* a value, unless the previous value is NULL ( equiv. to free ).
*/
bool orte_pointer_array_test_and_set_item (orte_pointer_array_t *table,
orte_std_cntr_t element_index, void *value)
{
assert(table != NULL);
#if 0
opal_output(0,"orte_pointer_array_test_and_set_item: IN: "
" table %p (size %ld, lowest free %ld, number free %ld)"
" addr[%d] = %p\n",
table, table->size, table->lowest_free, table->number_free,
element_index, table->addr[element_index]);
#endif
/* expand table if required to set a specific index */
OPAL_THREAD_LOCK(&(table->lock));
if ( element_index < table->size && table->addr[element_index] != NULL ) {
/* This element is already in use */
OPAL_THREAD_UNLOCK(&(table->lock));
return false;
}
/* Do we need to grow the table? */
if (table->size <= element_index) {
if (!grow_table(table, element_index + 1 - table->size)) {
OPAL_THREAD_UNLOCK(&(table->lock));
return false;
}
}
/*
* allow a specific index to be changed.
*/
table->addr[element_index] = value;
table->number_free--;
/* Reset lowest_free if required */
if ( element_index == table->lowest_free ) {
orte_std_cntr_t i;
table->lowest_free = table->size;
for ( i=element_index; i<table->size; i++) {
if ( NULL == table->addr[i] ){
table->lowest_free = i;
break;
}
}
}
#if 0
opal_output(0,"orte_pointer_array_test_and_set_item: OUT: "
" table %p (size %ld, lowest free %ld, number free %ld)"
" addr[%d] = %p\n",
table, table->size, table->lowest_free, table->number_free,
element_index, table->addr[element_index]);
#endif
OPAL_THREAD_UNLOCK(&(table->lock));
return true;
}
int orte_pointer_array_set_size(orte_pointer_array_t *array, orte_std_cntr_t new_size)
{
OPAL_THREAD_LOCK(&(array->lock));
if(new_size > array->size) {
if (!grow_table(array, new_size - array->size)) {
OPAL_THREAD_UNLOCK(&(array->lock));
return ORTE_ERROR;
}
}
OPAL_THREAD_UNLOCK(&(array->lock));
return ORTE_SUCCESS;
}
static bool grow_table(orte_pointer_array_t *table, orte_std_cntr_t num_needed)
{
orte_std_cntr_t new_size, i;
void *p;
/* Ensure that we have room to grow -- stay less than
* specified maximum
*/
if (table->size + num_needed > table->max_size) {
return false;
}
new_size = ((table->size + num_needed + table->block_size - 1) /
table->block_size) * table->block_size;
if (new_size > table->max_size) {
new_size = table->max_size;
}
p = (void **) realloc(table->addr, new_size * sizeof(void *));
if (p == NULL) {
return false;
}
/* Adjust structure counters and pointers */
table->number_free += new_size - table->size;
table->addr = (void**)p;
for (i = table->size; i < new_size; ++i) {
table->addr[i] = NULL;
}
table->size = new_size;
return true;
}

View File

@ -1,228 +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
*
* See ompi_bitmap.h for an explanation of why there is a split
* between OMPI and ORTE for this generic class.
*/
#ifndef ORTE_POINTER_ARRAY_H
#define ORTE_POINTER_ARRAY_H
#include "orte_config.h"
#include "orte/types.h"
#if HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
#include "opal/threads/mutex.h"
#include "opal/class/opal_object.h"
BEGIN_C_DECLS
/**
* dynamic pointer array
*/
struct orte_pointer_array_t {
/** base class */
opal_object_t super;
/** synchronization object */
opal_mutex_t lock;
/** Index of lowest free element. NOTE: This is only an
optimization to know where to search for the first free slot.
It does \em not necessarily imply indices all above this index
are not taken! */
orte_std_cntr_t lowest_free;
/** number of free elements in the list */
orte_std_cntr_t number_free;
/** size of list, i.e. number of elements in addr */
orte_std_cntr_t size;
/** maximum size list is allowed to reach */
orte_std_cntr_t max_size;
/** growth steps for list */
orte_std_cntr_t block_size;
/** pointer to array of pointers */
void **addr;
};
/**
* Convenience typedef
*/
typedef struct orte_pointer_array_t orte_pointer_array_t;
/**
* Class declaration
*/
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_pointer_array_t);
/**
* Initialize the pointer array
*
* @param array Address of the pointer array object to be initialized
* @param initial_alloc The initial number of elements to be allocated
* @param max_size Maximum size the array is allowed to reach
* @param block_size Number of array elements to be added when increase required
*
* @retval ORTE_SUCCESS Initialization successful
* @retval ORTE_ERROR(s) Appropriate error code
*
*/
ORTE_DECLSPEC int orte_pointer_array_init(orte_pointer_array_t **array,
orte_std_cntr_t initial_allocation,
orte_std_cntr_t max_size, orte_std_cntr_t block_size);
/**
* Add a pointer to the array (Grow the array, if need be)
*
* @param array Pointer to array (IN)
* @param ptr Pointer value (IN)
*
* @param (OUT) Index of inserted array element.
* @return Return value less than zero indicates an error.
*/
ORTE_DECLSPEC int orte_pointer_array_add(orte_std_cntr_t *element_index, orte_pointer_array_t *array, void *ptr);
/**
* Set the value of an element in array
* Automatically extend array if required.
*
* @param array Pointer to array (IN)
* @param element_index Index of element to be reset (IN)
* @param value New value to be set at element index (IN)
*
* @return Error code. (-1) indicates an error.
*/
ORTE_DECLSPEC int orte_pointer_array_set_item(orte_pointer_array_t *array,
orte_std_cntr_t element_index, void *value);
/**
* Get the value of an element in array
*
* @param array Pointer to array (IN)
* @param element_index Index of element to be returned (IN)
*
* @return Error code. NULL indicates an error.
*/
static inline void *orte_pointer_array_get_item(orte_pointer_array_t *table,
orte_std_cntr_t element_index)
{
void *p;
OPAL_THREAD_LOCK(&(table->lock));
p = table->addr[element_index];
OPAL_THREAD_UNLOCK(&(table->lock));
return p;
}
/**
* Get the size of the pointer array
*
* @param array Pointer to array (IN)
*
* @returns size Size of the array
*
* Simple inline function to return the size of the array in order to
* hide the member field from external users.
*/
static inline orte_std_cntr_t orte_pointer_array_get_size(orte_pointer_array_t *array)
{
return array->size;
}
/**
* Set the size of the pointer array
*
* @param array Pointer to array (IN)
*
* @param size Desired size of the array
*
* Simple function to set the size of the array in order to
* hide the member field from external users.
*/
ORTE_DECLSPEC int orte_pointer_array_set_size(orte_pointer_array_t *array, orte_std_cntr_t size);
/**
* Clear the pointer array
*
* @param array Pointer to array (IN)
*
* @returns void
*
* Simple inline function to clear the pointer array and reset all
* counters.
*/
static inline void orte_pointer_array_clear(orte_pointer_array_t *array)
{
if( array->number_free == array->size )
return; /* nothing to do here this time (the array is already empty) */
OPAL_THREAD_LOCK(&(array->lock));
/* set the array elements to NULL */
memset(array->addr, 0, array->size * sizeof(void*));
array->lowest_free = 0;
array->number_free = array->size;
OPAL_THREAD_UNLOCK(&(array->lock));
}
/**
* Clear the pointer array, freeing any storage
*
* @param array Pointer to array (IN)
*
* @returns void
*
* Simple inline function to clear the pointer array and reset all
* counters.
*/
static inline void orte_pointer_array_free_clear(orte_pointer_array_t *array)
{
orte_std_cntr_t i;
OPAL_THREAD_LOCK(&(array->lock));
for (i=0; i < array->size; i++) {
if (NULL != array->addr[i]) free(array->addr[i]);
array->addr[i] = NULL;
}
array->lowest_free = 0;
array->number_free = array->size;
OPAL_THREAD_UNLOCK(&(array->lock));
}
/**
* Test whether a certain element is already in use. If not yet
* in use, reserve it.
*
* @param array Pointer to array (IN)
* @param element_index Index of element to be tested (IN)
* @param value New value to be set at element index (IN)
*
* @return true/false True if element could be reserved
* False if element could not be reserved (e.g., in use).
*
* In contrary to array_set, this function does not allow to overwrite
* a value, unless the previous value is NULL ( equiv. to free ).
*/
ORTE_DECLSPEC bool orte_pointer_array_test_and_set_item (orte_pointer_array_t *table,
orte_std_cntr_t element_index,
void *value);
END_C_DECLS
#endif /* OMPI_POINTER_ARRAY_H */

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -89,7 +89,6 @@ static int rte_init(char flags)
orte_job_t *jdata;
orte_node_t *node;
orte_proc_t *proc;
orte_std_cntr_t index;
/* Since we are the HNP, then responsibility for
* defining the name falls to the PLM component for our
@ -292,12 +291,12 @@ static int rte_init(char flags)
/* create and store the job data object */
jdata = OBJ_NEW(orte_job_t);
jdata->jobid = ORTE_PROC_MY_NAME->jobid;
orte_pointer_array_add(&index, orte_job_data, jdata);
opal_pointer_array_add(orte_job_data, jdata);
/* create and store a node object where we are */
node = OBJ_NEW(orte_node_t);
node->name = strdup(orte_system_info.nodename);
orte_pointer_array_add(&node->index, orte_node_pool, node);
node->index = opal_pointer_array_add(orte_node_pool, node);
/* create and store a proc object for us */
proc = OBJ_NEW(orte_proc_t);
@ -308,7 +307,7 @@ static int rte_init(char flags)
proc->state = ORTE_PROC_STATE_RUNNING;
OBJ_RETAIN(node); /* keep accounting straight */
proc->node = node;
orte_pointer_array_add(&index, jdata->procs, proc);
opal_pointer_array_add(jdata->procs, proc);
/* record that the daemon (i.e., us) is on this node
* NOTE: we do not add the proc object to the node's

View File

@ -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,
@ -333,7 +333,7 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *data,
/* pack the number of nodes participating in this launch */
if (ORTE_SUCCESS != (rc = opal_dss.pack(data, &map->num_nodes, 1, ORTE_STD_CNTR))) {
ORTE_ERROR_LOG(rc);
return rc;
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* cycle through the participating nodes */
@ -406,7 +406,7 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *data,
/* pack an INVALID vpid as a flag that we are done with procs for this node */
if (ORTE_SUCCESS != (rc = opal_dss.pack(data, &invalid_vpid, 1, ORTE_VPID))) {
ORTE_ERROR_LOG(rc);
return rc;
return ORTE_ERR_OUT_OF_RESOURCE;
}
}

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -57,7 +57,6 @@ static int orte_plm_base_report_launched(orte_jobid_t job);
int orte_plm_base_setup_job(orte_job_t *jdata)
{
int rc;
orte_std_cntr_t index;
orte_process_name_t name = {ORTE_JOBID_INVALID, 0};
OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output,
@ -66,7 +65,7 @@ int orte_plm_base_setup_job(orte_job_t *jdata)
ORTE_JOBID_PRINT(jdata->jobid)));
/* insert the job object into the global pool */
orte_pointer_array_add(&index, orte_job_data, jdata);
opal_pointer_array_add(orte_job_data, jdata);
if (ORTE_SUCCESS != (rc = orte_ras.allocate(jdata))) {
ORTE_ERROR_LOG(rc);

View File

@ -2,7 +2,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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -24,8 +24,8 @@
#include "opal/class/opal_object.h"
#include "opal/class/opal_list.h"
#include "opal/class/opal_pointer_array.h"
#include "orte/class/orte_pointer_array.h"
#include "orte/util/proc_info.h"
BEGIN_C_DECLS

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -24,7 +24,6 @@
#include "opal/util/output.h"
#include "opal/util/argv.h"
#include "orte/class/orte_pointer_array.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/util/name_fns.h"
#include "orte/runtime/orte_globals.h"
@ -81,7 +80,7 @@ int orte_ras_base_node_insert(opal_list_t* nodes, orte_job_t *jdata)
/* set the size of the global array - this helps minimize time
* spent doing realloc's
*/
if (ORTE_SUCCESS != (rc = orte_pointer_array_set_size(orte_node_pool, num_nodes))) {
if (ORTE_SUCCESS != (rc = opal_pointer_array_set_size(orte_node_pool, num_nodes))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -124,7 +123,8 @@ int orte_ras_base_node_insert(opal_list_t* nodes, orte_job_t *jdata)
(NULL == node->name) ? "NULL" : node->name));
/* set node to available for use */
node->allocate = true;
if (ORTE_SUCCESS != (rc = orte_pointer_array_add(&node->index, orte_node_pool, (void*)node))) {
node->index = opal_pointer_array_add(orte_node_pool, (void*)node);
if (ORTE_SUCCESS > (rc = node->index)) {
ORTE_ERROR_LOG(rc);
return rc;
}

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -30,8 +30,8 @@
#include "orte/types.h"
#include "opal/class/opal_list.h"
#include "opal/class/opal_pointer_array.h"
#include "orte/class/orte_pointer_array.h"
#include "opal/dss/dss_types.h"
#include "orte/mca/rml/rml_types.h"
#include "orte/mca/ras/ras_types.h"

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -203,7 +203,7 @@ int orte_rmaps_base_get_target_procs(opal_list_t *procs)
int orte_rmaps_base_add_proc_to_map(orte_job_map_t *map, orte_node_t *node,
bool oversubscribed, orte_proc_t *proc)
{
orte_std_cntr_t index, i;
orte_std_cntr_t i;
orte_node_t **nodes;
int rc;
@ -223,7 +223,7 @@ int orte_rmaps_base_add_proc_to_map(orte_job_map_t *map, orte_node_t *node,
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
(NULL == node->name) ? "NULL" : node->name));
if (ORTE_SUCCESS != (rc = orte_pointer_array_add(&index, map->nodes, (void*)node))) {
if (ORTE_SUCCESS > (rc = opal_pointer_array_add(map->nodes, (void*)node))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -241,7 +241,7 @@ PROCESS:
ORTE_NAME_PRINT(&proc->name),
(NULL == node->name) ? "NULL" : node->name));
if (ORTE_SUCCESS != (rc = orte_pointer_array_add(&index, node->procs, (void*)proc))) {
if (0 > (rc = opal_pointer_array_add(node->procs, (void*)proc))) {
ORTE_ERROR_LOG(rc);
return rc;
}
@ -292,8 +292,8 @@ int orte_rmaps_base_claim_slot(orte_job_t *jdata,
"%s rmaps:base:claim_slot mapping rank %d to job %s",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
vpid, ORTE_JOBID_PRINT(jdata->jobid)));
if (ORTE_SUCCESS != (rc = orte_pointer_array_set_item(jdata->procs,
(orte_std_cntr_t)vpid,
if (ORTE_SUCCESS != (rc = opal_pointer_array_set_item(jdata->procs,
(int)vpid,
(void*)proc))) {
ORTE_ERROR_LOG(rc);
OBJ_RELEASE(proc);
@ -490,7 +490,7 @@ int orte_rmaps_base_define_daemons(orte_job_map_t *map)
orte_node_t *node, **nodes;
orte_proc_t *proc;
orte_job_t *daemons;
orte_std_cntr_t i, index;
orte_std_cntr_t i;
int rc;
OPAL_OUTPUT_VERBOSE((5, orte_rmaps_base.rmaps_output,
@ -532,7 +532,7 @@ int orte_rmaps_base_define_daemons(orte_job_map_t *map)
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(&proc->name)));
/* add the daemon to the daemon job object */
if (ORTE_SUCCESS != (rc = orte_pointer_array_add(&index, daemons->procs, (void*)proc))) {
if (0 > (rc = opal_pointer_array_add(daemons->procs, (void*)proc))) {
ORTE_ERROR_LOG(rc);
return rc;
}

View File

@ -1,7 +1,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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -23,7 +23,7 @@
#include "orte_config.h"
#include "orte/constants.h"
#include "orte/class/orte_pointer_array.h"
#include "opal/class/opal_pointer_array.h"
/*
* General MAP types - instanced in runtime/orte_globals_class_instances.h
@ -61,7 +61,7 @@ struct orte_job_map_t {
/* number of nodes participating in this job */
orte_std_cntr_t num_nodes;
/* array of pointers to nodes in this map for this job */
orte_pointer_array_t *nodes;
opal_pointer_array_t *nodes;
};
typedef struct orte_job_map_t orte_job_map_t;
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_job_map_t);

View File

@ -2,7 +2,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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -448,20 +448,19 @@ int orte_daemon(int argc, char *argv[])
orte_proc_t *proc;
orte_node_t **nodes;
orte_app_context_t *app;
orte_std_cntr_t index;
char *tmp, *nptr;
int rc;
/* setup the singleton's job */
jdata = OBJ_NEW(orte_job_t);
orte_plm_base_create_jobid(&jdata->jobid);
orte_pointer_array_add(&index, orte_job_data, jdata);
opal_pointer_array_add(orte_job_data, jdata);
/* setup an app_context for the singleton */
app = OBJ_NEW(orte_app_context_t);
app->app = strdup("singleton");
app->num_procs = 1;
orte_pointer_array_add(&index, jdata->apps, app);
opal_pointer_array_add(jdata->apps, app);
/* run our local allocator to read the available
* allocation in case this singleton decides to
@ -488,7 +487,7 @@ int orte_daemon(int argc, char *argv[])
proc->app_idx = 0;
proc->node = nodes[0]; /* hnp node must be there */
OBJ_RETAIN(nodes[0]); /* keep accounting straight */
orte_pointer_array_add(&index, jdata->procs, proc);
opal_pointer_array_add(jdata->procs, proc);
jdata->num_procs = 1;
/* create a string that contains our uri + the singleton's name */

View File

@ -2,7 +2,7 @@
* Copyright (c) 2004-2006 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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -188,7 +188,7 @@ int orte_dt_unpack_job(opal_buffer_t *buffer, void *dest,
ORTE_ERROR_LOG(rc);
return rc;
}
orte_pointer_array_add(&n, jobs[i]->apps, app);
opal_pointer_array_add(jobs[i]->apps, app);
}
}

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -28,8 +28,8 @@
#include "opal/mca/base/mca_base_param.h"
#include "opal/threads/mutex.h"
#include "opal/threads/condition.h"
#include "opal/class/opal_pointer_array.h"
#include "orte/class/orte_pointer_array.h"
#include "opal/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/rml/rml.h"
@ -72,14 +72,15 @@ OBJ_CLASS_INSTANCE(orte_data_object_t,
construct, destruct);
/* local globals */
static orte_pointer_array_t *orte_data_server_store=NULL;
static opal_pointer_array_t *orte_data_server_store=NULL;
static bool recv_issued=false;
int orte_data_server_init(void)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_pointer_array_init(&orte_data_server_store,
orte_data_server_store = OBJ_NEW(opal_pointer_array_t);
if (ORTE_SUCCESS != (rc = opal_pointer_array_init(orte_data_server_store,
1,
INT_MAX,
1))) {
@ -220,7 +221,7 @@ void orte_data_server(int status, orte_process_name_t* sender,
data->owner.vpid = sender->vpid;
/* store the data */
orte_pointer_array_add(&data->index, orte_data_server_store, data);
data->index = opal_pointer_array_add(orte_data_server_store, data);
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,
"%s data server: successfully published service %s port %s",
@ -350,7 +351,7 @@ void orte_data_server(int status, orte_process_name_t* sender,
}
/* delete the object from the data store */
orte_pointer_array_set_item(orte_data_server_store, data->index, NULL);
opal_pointer_array_set_item(orte_data_server_store, data->index, NULL);
OBJ_RELEASE(data);
OPAL_OUTPUT_VERBOSE((1, orte_debug_output,

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -28,8 +28,8 @@
#include "opal/mca/base/mca_base_param.h"
#include "opal/threads/mutex.h"
#include "opal/threads/condition.h"
#include "opal/class/opal_pointer_array.h"
#include "orte/class/orte_pointer_array.h"
#include "opal/dss/dss.h"
#include "orte/mca/errmgr/errmgr.h"
@ -62,8 +62,8 @@ orte_process_name_t orte_globals_name_wildcard = {ORTE_JOBID_WILDCARD, ORTE_VPID
orte_process_name_t orte_globals_name_invalid = {ORTE_JOBID_INVALID, ORTE_VPID_INVALID};
/* global arrays for data storage */
orte_pointer_array_t *orte_job_data;
orte_pointer_array_t *orte_node_pool;
opal_pointer_array_t *orte_job_data;
opal_pointer_array_t *orte_node_pool;
/*
* Whether we have completed orte_init or we are in orte_finalize
@ -404,7 +404,8 @@ int orte_hnp_globals_init(void)
{
int rc;
if (ORTE_SUCCESS != (rc = orte_pointer_array_init(&orte_job_data,
orte_job_data = OBJ_NEW(opal_pointer_array_t);
if (ORTE_SUCCESS != (rc = opal_pointer_array_init(orte_job_data,
1,
ORTE_GLOBAL_ARRAY_MAX_SIZE,
1))) {
@ -412,7 +413,8 @@ int orte_hnp_globals_init(void)
return rc;
}
if (ORTE_SUCCESS != (rc = orte_pointer_array_init(&orte_node_pool,
orte_node_pool = OBJ_NEW(opal_pointer_array_t);
if (ORTE_SUCCESS != (rc = opal_pointer_array_init(orte_node_pool,
ORTE_GLOBAL_ARRAY_BLOCK_SIZE,
ORTE_GLOBAL_ARRAY_MAX_SIZE,
ORTE_GLOBAL_ARRAY_BLOCK_SIZE))) {

View File

@ -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-2006 The University of Tennessee and The University
* 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,
@ -36,8 +36,7 @@
#include "opal/threads/mutex.h"
#include "opal/threads/condition.h"
#include "orte/class/orte_pointer_array.h"
#include "opal/class/opal_pointer_array.h"
#include "orte/mca/plm/plm_types.h"
#include "orte/mca/rmaps/rmaps_types.h"
@ -153,7 +152,7 @@ typedef struct {
/** number of procs on this node */
orte_vpid_t num_procs;
/* array of pointers to procs on this node */
orte_pointer_array_t *procs;
opal_pointer_array_t *procs;
/* whether or not we are oversubscribed */
bool oversubscribed;
/** The node architecture, as reported by the remote node. This
@ -198,7 +197,7 @@ typedef struct {
/* jobid for this job */
orte_jobid_t jobid;
/* app_context array for this job */
orte_pointer_array_t *apps;
opal_pointer_array_t *apps;
/* number of app_contexts in the array */
orte_std_cntr_t num_apps;
/* whether or not this job is locally spawned */
@ -208,7 +207,7 @@ typedef struct {
/* number of procs in this job */
orte_vpid_t num_procs;
/* array of pointers to procs in this job */
orte_pointer_array_t *procs;
opal_pointer_array_t *procs;
/* map of the job */
orte_job_map_t *map;
/* bookmark for where we are in mapping - this
@ -329,8 +328,8 @@ ORTE_DECLSPEC extern int orte_timeout_usec_per_proc;
ORTE_DECLSPEC extern float orte_max_timeout;
/* global arrays for data storage */
ORTE_DECLSPEC extern orte_pointer_array_t *orte_job_data;
ORTE_DECLSPEC extern orte_pointer_array_t *orte_node_pool;
ORTE_DECLSPEC extern opal_pointer_array_t *orte_job_data;
ORTE_DECLSPEC extern opal_pointer_array_t *orte_node_pool;
/**
* Whether ORTE is initialized or we are in orte_finalize

View File

@ -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-2008 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -140,7 +140,8 @@ OBJ_CLASS_INSTANCE(orte_app_context_map_t,
static void orte_job_construct(orte_job_t* job)
{
job->jobid = ORTE_JOBID_INVALID;
orte_pointer_array_init(&job->apps,
job->apps = OBJ_NEW(opal_pointer_array_t);
opal_pointer_array_init(job->apps,
1,
ORTE_GLOBAL_ARRAY_MAX_SIZE,
2);
@ -148,7 +149,8 @@ static void orte_job_construct(orte_job_t* job)
job->local_spawn = false;
job->total_slots_alloc = 0;
job->num_procs = 0;
orte_pointer_array_init(&job->procs,
job->procs = OBJ_NEW(opal_pointer_array_t);
opal_pointer_array_init(job->procs,
ORTE_GLOBAL_ARRAY_BLOCK_SIZE,
ORTE_GLOBAL_ARRAY_MAX_SIZE,
ORTE_GLOBAL_ARRAY_BLOCK_SIZE);