1
1

- As discussed on RFC, move the ompi_bitmap to the

opal layer.
   Add a check against a maximum (actually get rid of ifs internally to
   opal_bitmap.c) -- the functionality to set the current maximum size
   opal_bitmap_set_max_size() is currently only used in attribute.c
   to set the maximum OMPI_FORTRAN_HANDLE_MAX...

   Tested on linux/x86-64 with intel-tests with all_tests_no_perf_f
   run with 6 procs.
   Let's look into MTT as well...

This commit was SVN r20708.
Этот коммит содержится в:
Rainer Keller 2009-03-03 22:25:13 +00:00
родитель 5f6896ce5b
Коммит 811f2bd9b4
45 изменённых файлов: 249 добавлений и 174 удалений

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

@ -193,13 +193,13 @@
#include "ompi_config.h"
#include "ompi/attribute/attribute.h"
#include "opal/class/opal_bitmap.h"
#include "opal/threads/mutex.h"
#include "ompi/constants.h"
#include "ompi/datatype/datatype.h"
#include "ompi/communicator/communicator.h"
#include "ompi/win/win.h"
#include "ompi/mpi/f77/fint_2_int.h"
#include "ompi/class/ompi_bitmap.h"
/*
* Macros
@ -215,9 +215,9 @@
#define attr_datatype_f d_f_to_c_index
#define attr_win_f w_f_to_c_index
#define CREATE_KEY(key) ompi_bitmap_find_and_set_first_unset_bit(key_bitmap, (key))
#define CREATE_KEY(key) opal_bitmap_find_and_set_first_unset_bit(key_bitmap, (key))
#define FREE_KEY(key) ompi_bitmap_clear_bit(key_bitmap, (key))
#define FREE_KEY(key) opal_bitmap_clear_bit(key_bitmap, (key))
/* Not checking for NULL_DELETE_FN here, since according to the
@ -403,7 +403,7 @@ static OBJ_CLASS_INSTANCE(ompi_attribute_keyval_t,
*/
static opal_hash_table_t *keyval_hash;
static ompi_bitmap_t *key_bitmap;
static opal_bitmap_t *key_bitmap;
static unsigned int int_pos = 12345;
/*
@ -484,8 +484,12 @@ int ompi_attr_init(void)
if (NULL == keyval_hash) {
return MPI_ERR_SYSRESOURCE;
}
key_bitmap = OBJ_NEW(ompi_bitmap_t);
if (0 != ompi_bitmap_init(key_bitmap, 32)) {
key_bitmap = OBJ_NEW(opal_bitmap_t);
/*
* Set the max size to OMPI_FORTRAN_HANDLE_MAX to enforce bound
*/
opal_bitmap_set_max_size (key_bitmap, OMPI_FORTRAN_HANDLE_MAX);
if (0 != opal_bitmap_init(key_bitmap, 32)) {
return MPI_ERR_SYSRESOURCE;
}

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

@ -33,7 +33,6 @@ typedef char* ompi_job_handle_t;
struct ompi_communicator_t;
struct ompi_datatype_t;
struct ompi_convertor_t;
struct ompi_bitmap_t;
struct ompi_op_t;
#endif

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

@ -27,6 +27,8 @@
#define MCA_BML_H
#include "opal/mca/mca.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/bml/base/bml_base_btl.h"
@ -457,7 +459,7 @@ typedef int (*mca_bml_base_module_finalize_fn_t)( void );
typedef int (*mca_bml_base_module_add_procs_fn_t)(
size_t nprocs,
struct ompi_proc_t** procs,
struct ompi_bitmap_t* reachable
struct opal_bitmap_t* reachable
);
/**

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

@ -25,10 +25,10 @@
#include <stdlib.h>
#include <string.h>
#include "opal/class/opal_bitmap.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "orte/util/show_help.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/mca/bml/bml.h"
#include "ompi/mca/bml/base/base.h"
#include "ompi/mca/btl/btl.h"
@ -141,7 +141,7 @@ static int btl_bandwidth_compare(const void *v1, const void *v2)
static int mca_bml_r2_add_procs( size_t nprocs,
struct ompi_proc_t** procs,
struct ompi_bitmap_t* reachable )
struct opal_bitmap_t* reachable )
{
size_t p, p_index, n_new_procs = 0;
struct mca_btl_base_endpoint_t ** btl_endpoints = NULL;
@ -202,7 +202,7 @@ static int mca_bml_r2_add_procs( size_t nprocs,
* and can return addressing information for each proc
* that is passed back to the r2 on data transfer calls
*/
ompi_bitmap_clear_all_bits(reachable);
opal_bitmap_clear_all_bits(reachable);
memset(btl_endpoints, 0, nprocs *sizeof(struct mca_btl_base_endpoint_t*));
rc = btl->btl_add_procs(btl, n_new_procs, new_procs, btl_endpoints, reachable);
@ -215,7 +215,7 @@ static int mca_bml_r2_add_procs( size_t nprocs,
/* for each proc that is reachable */
for( p = 0; p < n_new_procs; p++ ) {
if(ompi_bitmap_is_set_bit(reachable, p)) {
if(opal_bitmap_is_set_bit(reachable, p)) {
ompi_proc_t *proc = new_procs[p];
mca_bml_base_endpoint_t * bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_bml;
mca_bml_base_btl_t* bml_btl;

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

@ -26,7 +26,6 @@
#include <string.h>
#include "ompi/runtime/ompi_cr.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/mca/bml/bml.h"
#include "ompi/mca/bml/base/base.h"
#include "ompi/mca/btl/btl.h"

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

@ -112,6 +112,7 @@
#define MCA_BTL_H
#include "ompi/types.h"
#include "opal/class/opal_bitmap.h"
#include "opal/prefetch.h" /* For OPAL_LIKELY */
#include "ompi/mca/mpool/mpool.h"
@ -451,7 +452,7 @@ typedef int (*mca_btl_base_module_add_procs_fn_t)(
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable
struct opal_bitmap_t* reachable
);
/**

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

@ -10,6 +10,7 @@
*/
#include "ompi_config.h"
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "ompi/mca/pml/pml.h"
@ -64,7 +65,7 @@ static int mca_btl_elan_add_procs( struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable )
opal_bitmap_t* reachable )
{
mca_btl_elan_module_t* elan_btl = (mca_btl_elan_module_t*)btl;
int i, j, rc;
@ -107,7 +108,7 @@ static int mca_btl_elan_add_procs( struct mca_btl_base_module_t* btl,
fprintf( file, "%s %d\n", ompi_proc->proc_hostname,
elan_proc->position_id_array[j] );
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
peers[i] = elan_endpoint;
}
fclose(file);

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

@ -18,9 +18,8 @@
#include "ompi_config.h"
/* Open MPI includes */
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/btl_base_error.h"

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

@ -19,6 +19,7 @@
#include "ompi_config.h"
#include <string.h>
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "ompi/mca/pml/pml.h"
@ -104,7 +105,7 @@ int mca_btl_gm_add_procs(
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
mca_btl_gm_module_t* gm_btl = (mca_btl_gm_module_t*)btl;
int i, rc;
@ -147,7 +148,7 @@ int mca_btl_gm_add_procs(
OPAL_THREAD_UNLOCK(&gm_proc->proc_lock);
continue;
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&gm_proc->proc_lock);
peers[i] = gm_endpoint;
}

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

@ -28,9 +28,9 @@
#include <gm.h>
/* Open MPI includes */
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "opal/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -171,7 +171,7 @@ extern int mca_btl_gm_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -17,6 +17,7 @@
*/
#include "ompi_config.h"
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#if OPAL_ENABLE_FT == 1
@ -37,7 +38,7 @@ int mca_btl_mx_add_procs( struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t** ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable )
opal_bitmap_t* reachable )
{
mca_btl_mx_module_t* mx_btl = (mca_btl_mx_module_t*)btl;
int i, rc;
@ -86,7 +87,7 @@ int mca_btl_mx_add_procs( struct mca_btl_base_module_t* btl,
OPAL_THREAD_UNLOCK(&mx_proc->proc_lock);
continue;
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&mx_proc->proc_lock);
peers[i] = mx_endpoint;
}

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

@ -26,8 +26,8 @@
#include <string.h>
/* Open MPI includes */
#include "opal/class/opal_bitmap.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/event/event.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -189,7 +189,7 @@ extern int mca_btl_mx_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -22,6 +22,7 @@
#include <string.h>
#include "ompi_config.h"
#include "opal/class/opal_bitmap.h"
#include "opal/prefetch.h"
#include "opal/util/output.h"
#include "ompi/datatype/convertor.h"
@ -80,7 +81,7 @@ int mca_btl_ud_add_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
mca_btl_ud_module_t* ud_btl = (mca_btl_ud_module_t*)btl;
struct ibv_ah_attr ah_attr;
@ -149,7 +150,7 @@ int mca_btl_ud_add_procs(struct mca_btl_base_module_t* btl,
ib_peer);
#endif
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
peers[i] = ib_peer;
}

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

@ -34,9 +34,9 @@
/* Open MPI includes */
#include "opal/class/opal_hash_table.h"
#include "opal/class/opal_bitmap.h"
#include "opal/sys/timer.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "ompi/mca/btl/base/base.h"
@ -232,7 +232,7 @@ extern int mca_btl_ud_add_procs(struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable);
opal_bitmap_t* reachable);
/**

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

@ -28,6 +28,7 @@
#include <inttypes.h>
#include "orte/util/show_help.h"
#include "orte/runtime/orte_globals.h"
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "opal/util/arch.h"
@ -297,7 +298,7 @@ int mca_btl_openib_add_procs(
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*)btl;
int i,j, rc;
@ -490,7 +491,7 @@ int mca_btl_openib_add_procs(
}
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
peers[i] = endpoint;

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

@ -34,7 +34,7 @@
/* Open MPI includes */
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/util/output.h"
#include "opal/event/event.h"
@ -452,7 +452,7 @@ extern int mca_btl_openib_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -25,6 +25,7 @@
#include <errno.h>
#include <inttypes.h>
#include "opal/class/opal_bitmap.h"
#include "ompi/constants.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -80,7 +81,7 @@ int
mca_btl_portals_add_procs(struct mca_btl_base_module_t* btl_base,
size_t nprocs, struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
int ret;
struct ompi_proc_t *curr_proc = NULL;
@ -138,7 +139,7 @@ mca_btl_portals_add_procs(struct mca_btl_base_module_t* btl_base,
OPAL_THREAD_ADD32(&mca_btl_portals_module.portals_num_procs, 1);
/* and here we can reach */
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
}
if (NULL != portals_procs) free(portals_procs);

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

@ -24,10 +24,10 @@
#include "ompi/mca/common/portals/common_portals.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/class/ompi_free_list.h"
#include "btl_portals_endpoint.h"
@ -162,7 +162,7 @@ int mca_btl_portals_add_procs(struct mca_btl_base_module_t* btl_base,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable);
opal_bitmap_t* reachable);
int mca_btl_portals_del_procs(struct mca_btl_base_module_t* btl_base,
size_t nprocs,

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

@ -18,6 +18,7 @@
#include "ompi_config.h"
#include <string.h>
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -72,7 +73,7 @@ int mca_btl_sctp_add_procs(
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
mca_btl_sctp_module_t* sctp_btl = (mca_btl_sctp_module_t*)btl;
ompi_proc_t* my_proc; /* pointer to caller's proc structure */
@ -125,7 +126,7 @@ int mca_btl_sctp_add_procs(
continue;
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&sctp_proc->proc_lock);
peers[i] = sctp_endpoint;
opal_list_append(&sctp_btl->sctp_endpoints, (opal_list_item_t*)sctp_endpoint);

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

@ -35,7 +35,7 @@
/* Open MPI includes */
#include "opal/event/event.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -196,7 +196,7 @@ extern int mca_btl_sctp_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -25,6 +25,7 @@
#include <fcntl.h>
#include <errno.h>
#include "opal/class/opal_bitmap.h"
#include "opal/threads/mutex.h"
#include "ompi/datatype/convertor.h"
#include "ompi/datatype/datatype.h"
@ -74,13 +75,13 @@ int mca_btl_self_add_procs( struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t **peers,
ompi_bitmap_t* reachability )
opal_bitmap_t* reachability )
{
int i;
for( i = 0; i < (int)nprocs; i++ ) {
if( procs[i] == ompi_proc_local_proc ) {
ompi_bitmap_set_bit( reachability, i );
opal_bitmap_set_bit( reachability, i );
break; /* there will always be only one ... */
}
}

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

@ -27,9 +27,9 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "opal/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -112,7 +112,7 @@ int mca_btl_self_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
struct ompi_bitmap_t* reachability
struct opal_bitmap_t* reachability
);

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

@ -27,16 +27,17 @@
#include <errno.h>
#include "opal/threads/mutex.h"
#include "ompi/datatype/convertor.h"
#include "opal/sys/atomic.h"
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/mca/carto/carto.h"
#include "opal/mca/carto/base/base.h"
#include "opal/mca/paffinity/base/base.h"
#include "opal/mca/maffinity/base/base.h"
#include "orte/util/proc_info.h"
#include "opal/util/printf.h"
#include "ompi/datatype/convertor.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -405,7 +406,7 @@ int mca_btl_sm_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t **peers,
ompi_bitmap_t* reachability)
opal_bitmap_t* reachability)
{
int return_code = OMPI_SUCCESS;
int32_t n_local_procs = 0, proc, j,
@ -451,7 +452,7 @@ int mca_btl_sm_add_procs(
n_local_procs++;
/* add this proc to shared memory accessibility list */
return_code = ompi_bitmap_set_bit(reachability, proc);
return_code = opal_bitmap_set_bit(reachability, proc);
if(OMPI_SUCCESS != return_code)
goto CLEANUP;
}

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

@ -37,8 +37,8 @@
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include "opal/class/opal_free_list.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/event/event.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -348,7 +348,7 @@ extern int mca_btl_sm_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
struct ompi_bitmap_t* reachability
struct opal_bitmap_t* reachability
);

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

@ -21,6 +21,7 @@
#include "ompi_config.h"
#include <string.h>
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -75,7 +76,7 @@ int mca_btl_tcp_add_procs( struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable )
opal_bitmap_t* reachable )
{
mca_btl_tcp_module_t* tcp_btl = (mca_btl_tcp_module_t*)btl;
ompi_proc_t* my_proc; /* pointer to caller's proc structure */
@ -127,7 +128,7 @@ int mca_btl_tcp_add_procs( struct mca_btl_base_module_t* btl,
continue;
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&tcp_proc->proc_lock);
peers[i] = tcp_endpoint;
opal_list_append(&tcp_btl->tcp_endpoints, (opal_list_item_t*)tcp_endpoint);

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

@ -36,7 +36,7 @@
/* Open MPI includes */
#include "opal/event/event.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -198,7 +198,7 @@ extern int mca_btl_tcp_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -18,6 +18,7 @@
#include "ompi_config.h"
#include <string.h>
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -72,7 +73,7 @@ int mca_btl_template_add_procs(
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
mca_btl_template_module_t* template_btl = (mca_btl_template_module_t*)btl;
int i, rc;
@ -121,7 +122,7 @@ int mca_btl_template_add_procs(
continue;
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&template_proc->proc_lock);
peers[i] = template_endpoint;
}

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

@ -26,9 +26,9 @@
#include <string.h>
/* Open MPI includes */
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "opal/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -161,7 +161,7 @@ extern int mca_btl_template_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -24,6 +24,7 @@
#include "ompi_config.h"
#include <errno.h>
#include <string.h>
#include "opal/class/opal_bitmap.h"
#include "opal/util/if.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
@ -849,7 +850,7 @@ int mca_btl_udapl_add_procs(
size_t nprocs,
struct ompi_proc_t **ompi_procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable)
opal_bitmap_t* reachable)
{
mca_btl_udapl_module_t* udapl_btl = (mca_btl_udapl_module_t*)btl;
int i, rc;
@ -887,7 +888,7 @@ int mca_btl_udapl_add_procs(
continue;
}
ompi_bitmap_set_bit(reachable, i);
opal_bitmap_set_bit(reachable, i);
OPAL_THREAD_UNLOCK(&udapl_proc->proc_lock);
peers[i] = udapl_endpoint;
}

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

@ -32,9 +32,9 @@
/* Open MPI includes */
#include "opal/class/opal_pointer_array.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "opal/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -329,7 +329,7 @@ extern int mca_btl_udapl_add_procs(
size_t nprocs,
struct ompi_proc_t **procs,
struct mca_btl_base_endpoint_t** peers,
ompi_bitmap_t* reachable
opal_bitmap_t* reachable
);
/**

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

@ -34,7 +34,7 @@
#include "ompi/mca/coll/base/base.h"
#include "ompi/mca/coll/base/coll_tags.h"
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/mca/bml/bml.h"
#include "ompi/mca/bml/base/base.h"
#include "ompi/mca/pml/pml.h"
@ -568,7 +568,7 @@ mca_coll_hierarch_checkfor_component ( struct ompi_communicator_t *comm,
int *key,
int *ncount )
{
ompi_bitmap_t reachable;
opal_bitmap_t reachable;
ompi_proc_t **procs=NULL;
struct mca_bml_base_btl_array_t *bml_btl_array=NULL;
mca_bml_base_btl_t *bml_btl=NULL;
@ -591,8 +591,8 @@ mca_coll_hierarch_checkfor_component ( struct ompi_communicator_t *comm,
size = ompi_comm_size ( comm );
rank = ompi_comm_rank ( comm );
OBJ_CONSTRUCT(&reachable, ompi_bitmap_t);
rc = ompi_bitmap_init(&reachable, size);
OBJ_CONSTRUCT(&reachable, opal_bitmap_t);
rc = opal_bitmap_init(&reachable, size);
if(OMPI_SUCCESS != rc) {
return;
}

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

@ -32,7 +32,6 @@
#include "ompi/mca/coll/base/base.h"
#include "ompi/mca/coll/base/coll_tags.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/mca/bml/bml.h"
#include "ompi/mca/bml/base/base.h"
#include "ompi/mca/pml/pml.h"

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

@ -33,7 +33,6 @@
#include "ompi/mca/coll/base/base.h"
#include "ompi/mca/coll/base/coll_tags.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/mca/bml/bml.h"
#include "ompi/mca/bml/base/base.h"
#include "ompi/mca/pml/pml.h"

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

@ -21,6 +21,7 @@
#include "ompi_config.h"
#include "ompi/constants.h"
#include "opal/class/opal_bitmap.h"
#include "opal/dss/dss.h"
#include "ompi/mca/crcp/crcp.h"
@ -123,7 +124,7 @@ extern "C" {
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable,
struct opal_bitmap_t* reachable,
ompi_crcp_base_btl_state_t* );
ompi_crcp_base_btl_state_t*

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

@ -25,16 +25,17 @@
#include <time.h>
#include <ctype.h>
#include "opal/class/opal_bitmap.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/crs/crs.h"
#include "opal/mca/crs/base/base.h"
#include "opal/util/os_dirpath.h"
#include "ompi/communicator/communicator.h"
#include "ompi/proc/proc.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/crs/crs.h"
#include "opal/mca/crs/base/base.h"
#include "ompi/mca/crcp/crcp.h"
#include "ompi/mca/crcp/base/base.h"
#include "ompi/mca/bml/bml.h"
@ -263,7 +264,7 @@ ompi_crcp_base_none_btl_add_procs( struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable,
struct opal_bitmap_t* reachable,
ompi_crcp_base_btl_state_t* btl_state)
{
btl_state->error_code = OMPI_SUCCESS;

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

@ -21,15 +21,17 @@
#include <unistd.h>
#endif /* HAVE_UNIST_H */
#include "opal/class/opal_bitmap.h"
#include "opal/runtime/opal_cr.h"
#include "opal/event/event.h"
#include "orte/util/output.h"
#include "opal/util/argv.h"
#include "opal/util/opal_environ.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "orte/util/output.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
#include "ompi/mca/crcp/crcp.h"
@ -51,7 +53,7 @@ ompi_crcp_base_coord_btl_add_procs( struct mca_btl_base_module_t* btl,
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable,
struct opal_bitmap_t* reachable,
ompi_crcp_base_btl_state_t* btl_state)
{
btl_state->error_code = OMPI_SUCCESS;

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

@ -27,12 +27,13 @@
#include "ompi_config.h"
#include "opal/mca/mca.h"
#include "ompi/mca/crcp/crcp.h"
#include "ompi/communicator/communicator.h"
#include "opal/class/opal_bitmap.h"
#include "opal/runtime/opal_cr.h"
#include "opal/threads/mutex.h"
#include "opal/threads/condition.h"
#include "ompi/communicator/communicator.h"
#include "ompi/mca/crcp/crcp.h"
#include "ompi/mca/crcp/bkmrk/crcp_bkmrk.h"
#if defined(c_plusplus) || defined(__cplusplus)
@ -47,7 +48,7 @@ extern "C" {
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable,
struct opal_bitmap_t* reachable,
ompi_crcp_base_btl_state_t* );
ompi_crcp_base_btl_state_t* ompi_crcp_base_coord_btl_del_procs

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

@ -33,6 +33,7 @@
#include "opal/mca/crs/base/base.h"
#include "opal/class/opal_object.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/datatype/datatype.h"
#include "ompi/request/request.h"
@ -186,7 +187,7 @@ typedef ompi_crcp_base_btl_state_t* (*mca_crcp_base_btl_module_add_procs_fn_t)
size_t nprocs,
struct ompi_proc_t** procs,
struct mca_btl_base_endpoint_t** endpoints,
struct ompi_bitmap_t* reachable,
struct opal_bitmap_t* reachable,
ompi_crcp_base_btl_state_t* );
typedef ompi_crcp_base_btl_state_t* (*mca_crcp_base_btl_module_del_procs_fn_t)

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

@ -21,7 +21,6 @@
#include <stdlib.h>
#include <string.h>
#include "ompi/class/ompi_bitmap.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"

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

@ -22,7 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -158,7 +158,7 @@ int mca_pml_dr_del_comm(ompi_communicator_t* comm)
int mca_pml_dr_add_procs(ompi_proc_t** procs, size_t nprocs)
{
ompi_bitmap_t reachable;
opal_bitmap_t reachable;
int rc;
size_t i;
@ -180,8 +180,8 @@ int mca_pml_dr_add_procs(ompi_proc_t** procs, size_t nprocs)
return rc;
}
OBJ_CONSTRUCT(&reachable, ompi_bitmap_t);
rc = ompi_bitmap_init(&reachable, (int)nprocs);
OBJ_CONSTRUCT(&reachable, opal_bitmap_t);
rc = opal_bitmap_init(&reachable, (int)nprocs);
if(OMPI_SUCCESS != rc)
return rc;

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

@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include "ompi/class/ompi_bitmap.h"
#include "opal/class/opal_bitmap.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/pml/base/base.h"
#include "ompi/mca/btl/btl.h"
@ -274,7 +274,7 @@ int mca_pml_ob1_del_comm(ompi_communicator_t* comm)
int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
{
ompi_bitmap_t reachable;
opal_bitmap_t reachable;
int rc;
size_t i;
@ -287,8 +287,8 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs)
procs[i]->proc_pml = NULL;
}
OBJ_CONSTRUCT(&reachable, ompi_bitmap_t);
rc = ompi_bitmap_init(&reachable, (int)nprocs);
OBJ_CONSTRUCT(&reachable, opal_bitmap_t);
rc = opal_bitmap_init(&reachable, (int)nprocs);
if(OMPI_SUCCESS != rc)
return rc;

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

@ -18,8 +18,10 @@
*/
#include "opal_config.h"
#include "opal/constants.h"
#include <limits.h>
#include "opal/constants.h"
#include "opal/class/opal_bitmap.h"
@ -35,8 +37,9 @@ OBJ_CLASS_INSTANCE(opal_bitmap_t, opal_object_t,
static void
opal_bitmap_construct(opal_bitmap_t *bm)
{
bm->array_size = 0;
bm->bitmap = NULL;
bm->array_size = 0;
bm->max_size = INT_MAX;
}
@ -49,13 +52,40 @@ opal_bitmap_destruct(opal_bitmap_t *bm)
}
int opal_bitmap_set_max_size (opal_bitmap_t *bm, int max_size)
{
int actual_size;
if (NULL == bm) {
return OPAL_ERR_BAD_PARAM;
}
/*
* Only if the caller wants to set the maximum size,
* we set it (in numbers of bits!), otherwise it is
* set to INT_MAX in the constructor.
*/
actual_size = max_size / SIZE_OF_CHAR;
actual_size += (max_size % SIZE_OF_CHAR == 0) ? 0 : 1;
bm->max_size = actual_size;
return OPAL_SUCCESS;
}
int
opal_bitmap_init(opal_bitmap_t *bm, int size)
{
int actual_size;
if ((size <= 0) || (NULL == bm)) {
return OPAL_ERR_BAD_PARAM;
/*
* Only if the caller set the maximum size before initializing,
* we test here (in numbers of bits!)
* By default, the max size is INT_MAX, set in the constructor.
*/
if ((size <= 0) || (NULL == bm) || (size > bm->max_size)) {
return OPAL_ERR_BAD_PARAM;
}
actual_size = size / SIZE_OF_CHAR;
@ -65,7 +95,11 @@ opal_bitmap_init(opal_bitmap_t *bm, int size)
if (NULL == bm->bitmap) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
/*
* Leave bm->max_size untouched: it is initialized to INT_MAX in the constructor
*/
opal_bitmap_clear_all_bits(bm);
return OPAL_SUCCESS;
}
@ -77,7 +111,7 @@ opal_bitmap_set_bit(opal_bitmap_t *bm, int bit)
int index, offset, new_size;
size_t new_size_large;
if ((bit < 0) || (NULL == bm)) {
if ((bit < 0) || (NULL == bm) || (bit > bm->max_size)) {
return OPAL_ERR_BAD_PARAM;
}
@ -97,6 +131,11 @@ opal_bitmap_set_bit(opal_bitmap_t *bm, int bit)
[signed] int. */
new_size = (int) new_size_large;
/*
* No further tests against max_size (or OMPI_FORTRAN_HANDLE_MAX) are
* necessary, since we validated above, that the bit already is contained!
*/
/* New size is just a multiple of the original size to fit in
the index. */

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

@ -30,6 +30,12 @@
* find_and_set_bit. Other functions like clear, if passed a bit
* outside the initialized range will result in an error.
*
* To allow these bitmaps to track fortran handles (which MPI defines
* to be Fortran INTEGER), we offer a opal_bitmap_set_max_size, so that
* the upper layer can ask to never have more than
* OMPI_FORTRAN_HANDLE_MAX, which is min(INT_MAX, fortran INTEGER max).
* Currently the only user of this is ompi/attribute/attribute.c
*
*/
#ifndef OPAL_BITMAP_H
@ -44,15 +50,28 @@
BEGIN_C_DECLS
struct opal_bitmap_t {
opal_object_t super; /**< Subclass of opal_object_t */
opal_object_t super; /**< Subclass of opal_object_t */
unsigned char *bitmap; /**< The actual bitmap array of characters */
int array_size; /**< The actual array size that maintains the bitmap */
int array_size; /**< The actual array size that maintains the bitmap */
int max_size; /**< The maximum size that this bitmap may grow (optional) */
};
typedef struct opal_bitmap_t opal_bitmap_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_bitmap_t);
/**
* Set the maximum size of the bitmap.
* May be reset any time, but HAS TO BE SET BEFORE opal_bitmap_init!
*
* @param bitmap The input bitmap (IN)
* @param max_size The maximum size of the bitmap in terms of bits (IN)
* @return OPAL error code or success
*
*/
OPAL_DECLSPEC int opal_bitmap_set_max_size (opal_bitmap_t *bm, int max_size);
/**
* Initializes the bitmap and sets its size. This must be called
* before the bitmap can be actually used

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

@ -20,7 +20,7 @@
AM_CPPFLAGS="-I$(top_srcdir)/test/support"
check_PROGRAMS = \
ompi_bitmap \
opal_bitmap \
opal_hash_table \
opal_list \
opal_value_array \
@ -31,13 +31,11 @@ check_PROGRAMS = \
# are not run during "make check".
TESTS =
ompi_bitmap_SOURCES = ompi_bitmap.c
ompi_bitmap_LDADD = \
$(top_builddir)/ompi/libmpi.la \
$(top_builddir)/orte/libopen-rte.la \
opal_bitmap_SOURCES = opal_bitmap.c
opal_bitmap_LDADD = \
$(top_builddir)/opal/libopen-pal.la \
$(top_builddir)/test/support/libsupport.a
ompi_bitmap_DEPENDENCIES = $(ompi_bitmap_LDADD)
opal_bitmap_DEPENDENCIES = $(opal_bitmap_LDADD)
opal_list_SOURCES = opal_list.c
opal_list_LDADD = \
@ -74,4 +72,4 @@ ompi_rb_tree_LDADD = \
ompi_rb_tree_DEPENDENCIES = $(ompi_rb_tree_LDADD)
clean-local:
rm -f ompi_bitmap_test_out.txt opal_hash_table_test_out.txt
rm -f opal_bitmap_test_out.txt opal_hash_table_test_out.txt

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

@ -2,13 +2,13 @@
* Testcase for bitmap
*/
#include "ompi_config.h"
#include "opal_config.h"
#include <stdio.h>
#include "support.h"
#include "ompi/class/ompi_bitmap.h"
#include "ompi/constants.h"
#include "opal/class/opal_bitmap.h"
#include "opal/constants.h"
#define BSIZE 26
#define SIZE_OF_CHAR (sizeof(char) * 8)
@ -20,24 +20,24 @@
fprintf(error_out, "This is suppossed to throw error \n"); \
fprintf(error_out, "================================ \n")
static void test_bitmap_set(ompi_bitmap_t *bm);
static void test_bitmap_clear(ompi_bitmap_t *bm);
static void test_bitmap_is_set(ompi_bitmap_t *bm);
static void test_bitmap_clear_all(ompi_bitmap_t *bm);
static void test_bitmap_set_all(ompi_bitmap_t *bm);
static void test_bitmap_find_and_set(ompi_bitmap_t *bm);
static void test_bitmap_set(opal_bitmap_t *bm);
static void test_bitmap_clear(opal_bitmap_t *bm);
static void test_bitmap_is_set(opal_bitmap_t *bm);
static void test_bitmap_clear_all(opal_bitmap_t *bm);
static void test_bitmap_set_all(opal_bitmap_t *bm);
static void test_bitmap_find_and_set(opal_bitmap_t *bm);
static int set_bit(ompi_bitmap_t *bm, int bit);
static int clear_bit(ompi_bitmap_t *bm, int bit);
static int is_set_bit(ompi_bitmap_t *bm, int bit);
static int clear_all(ompi_bitmap_t *bm);
static int set_all(ompi_bitmap_t *bm);
static int find_and_set(ompi_bitmap_t *bm, int bit);
static int set_bit(opal_bitmap_t *bm, int bit);
static int clear_bit(opal_bitmap_t *bm, int bit);
static int is_set_bit(opal_bitmap_t *bm, int bit);
static int clear_all(opal_bitmap_t *bm);
static int set_all(opal_bitmap_t *bm);
static int find_and_set(opal_bitmap_t *bm, int bit);
#define WANT_PRINT_BITMAP 0
#if WANT_PRINT_BITMAP
static void print_bitmap(ompi_bitmap_t *bm);
static void print_bitmap(opal_bitmap_t *bm);
#endif
static FILE *error_out=NULL;
@ -45,31 +45,31 @@ static FILE *error_out=NULL;
int main(int argc, char *argv[])
{
/* Local variables */
ompi_bitmap_t bm;
opal_bitmap_t bm;
int err;
/* Perform overall test initialization */
test_init("ompi_bitmap_t");
test_init("opal_bitmap_t");
#ifdef STANDALONE
error_out = stderr;
#else
error_out = fopen( "./ompi_bitmap_test_out.txt", "w" );
error_out = fopen( "./opal_bitmap_test_out.txt", "w" );
if( error_out == NULL ) error_out = stderr;
#endif
/* Initialize bitmap */
PRINT_VALID_ERR;
err = ompi_bitmap_init(NULL, 2);
err = opal_bitmap_init(NULL, 2);
if (err == OMPI_ERR_BAD_PARAM)
fprintf(error_out, "ERROR: Initialization of bitmap failed\n\n");
PRINT_VALID_ERR;
err = ompi_bitmap_init(&bm, -1);
err = opal_bitmap_init(&bm, -1);
if (err == OMPI_ERR_BAD_PARAM)
fprintf(error_out, "ERROR: Initialization of bitmap failed \n\n");
err = ompi_bitmap_init(&bm, BSIZE);
err = opal_bitmap_init(&bm, BSIZE);
if (0 > err) {
fprintf(error_out, "Error in bitmap create -- aborting \n");
exit(-1);
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
void test_bitmap_set(ompi_bitmap_t *bm) {
void test_bitmap_set(opal_bitmap_t *bm) {
int result=0;
/* start of bitmap and boundaries */
@ -127,11 +127,11 @@ void test_bitmap_set(ompi_bitmap_t *bm) {
/* invalid bit */
PRINT_VALID_ERR;
result = set_bit(bm, -1);
TEST_AND_REPORT(result, ERR_CODE,"ompi_bitmap_set_bit");
TEST_AND_REPORT(result, ERR_CODE,"opal_bitmap_set_bit");
}
void test_bitmap_clear(ompi_bitmap_t *bm) {
void test_bitmap_clear(opal_bitmap_t *bm) {
int result=0;
/* Valid set bits */
@ -144,14 +144,14 @@ void test_bitmap_clear(ompi_bitmap_t *bm) {
/* invalid bit */
PRINT_VALID_ERR;
result = clear_bit(bm, -1);
TEST_AND_REPORT(result, ERR_CODE,"ompi_bitmap_clear_bit");
TEST_AND_REPORT(result, ERR_CODE,"opal_bitmap_clear_bit");
PRINT_VALID_ERR;
result = clear_bit(bm, 142);
TEST_AND_REPORT(result, ERR_CODE,"ompi_bitmap_clear_bit");
TEST_AND_REPORT(result, ERR_CODE,"opal_bitmap_clear_bit");
}
void test_bitmap_is_set(ompi_bitmap_t *bm)
void test_bitmap_is_set(opal_bitmap_t *bm)
{
int result=0;
@ -164,68 +164,68 @@ void test_bitmap_is_set(ompi_bitmap_t *bm)
PRINT_VALID_ERR;
result = is_set_bit(bm, 1122);
TEST_AND_REPORT(result,ERR_CODE,"ompi_bitmap_is_set_bit");
TEST_AND_REPORT(result,ERR_CODE,"opal_bitmap_is_set_bit");
PRINT_VALID_ERR;
is_set_bit(bm, -33);
TEST_AND_REPORT(result,ERR_CODE,"ompi_bitmap_is_set_bit");
TEST_AND_REPORT(result,ERR_CODE,"opal_bitmap_is_set_bit");
PRINT_VALID_ERR;
is_set_bit(bm, -1);
TEST_AND_REPORT(result,ERR_CODE,"ompi_bitmap_is_set_bit");
TEST_AND_REPORT(result,ERR_CODE,"opal_bitmap_is_set_bit");
}
void test_bitmap_find_and_set(ompi_bitmap_t *bm)
void test_bitmap_find_and_set(opal_bitmap_t *bm)
{
int bsize;
int result=0;
ompi_bitmap_clear_all_bits(bm);
opal_bitmap_clear_all_bits(bm);
result = find_and_set(bm, 0);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
result = find_and_set(bm, 1);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
result = find_and_set(bm, 2);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
result = find_and_set(bm, 3);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
result = ompi_bitmap_set_bit(bm, 5);
result = opal_bitmap_set_bit(bm, 5);
result = find_and_set(bm, 4);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
result = ompi_bitmap_set_bit(bm, 6);
result = ompi_bitmap_set_bit(bm, 7);
result = opal_bitmap_set_bit(bm, 6);
result = opal_bitmap_set_bit(bm, 7);
/* Setting beyond a char boundary */
result = find_and_set(bm, 8);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
ompi_bitmap_set_bit(bm, 9);
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
opal_bitmap_set_bit(bm, 9);
result = find_and_set(bm, 10);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
/* Setting beyond the current size of bitmap */
ompi_bitmap_set_all_bits(bm);
opal_bitmap_set_all_bits(bm);
bsize = bm->array_size * SIZE_OF_CHAR;
result = find_and_set(bm, bsize);
TEST_AND_REPORT(result, 0, "ompi_bitmap_find_and_set_first_unset_bit");
TEST_AND_REPORT(result, 0, "opal_bitmap_find_and_set_first_unset_bit");
}
void test_bitmap_clear_all(ompi_bitmap_t *bm)
void test_bitmap_clear_all(opal_bitmap_t *bm)
{
int result = clear_all(bm);
TEST_AND_REPORT(result, 0, " error in ompi_bitmap_clear_all_bits");
TEST_AND_REPORT(result, 0, " error in opal_bitmap_clear_all_bits");
}
void test_bitmap_set_all(ompi_bitmap_t *bm)
void test_bitmap_set_all(opal_bitmap_t *bm)
{
int result = set_all(bm);
TEST_AND_REPORT(result, 0, " error in ompi_bitmap_set_ala_bitsl");
TEST_AND_REPORT(result, 0, " error in opal_bitmap_set_ala_bitsl");
}
int set_bit(ompi_bitmap_t *bm, int bit)
int set_bit(opal_bitmap_t *bm, int bit)
{
int err = ompi_bitmap_set_bit(bm, bit);
int err = opal_bitmap_set_bit(bm, bit);
if (err != 0
|| !(bm->bitmap[bit/SIZE_OF_CHAR] & (1 << bit % SIZE_OF_CHAR))) {
fprintf(error_out, "ERROR: set_bit for bit = %d\n\n", bit);
@ -235,9 +235,9 @@ int set_bit(ompi_bitmap_t *bm, int bit)
}
int clear_bit(ompi_bitmap_t *bm, int bit)
int clear_bit(opal_bitmap_t *bm, int bit)
{
int err = ompi_bitmap_clear_bit(bm, bit);
int err = opal_bitmap_clear_bit(bm, bit);
if ((err != 0)
|| (bm->bitmap[bit/SIZE_OF_CHAR] & (1 << bit % SIZE_OF_CHAR))) {
fprintf(error_out, "ERROR: clear_bit for bit = %d \n\n", bit);
@ -248,9 +248,9 @@ int clear_bit(ompi_bitmap_t *bm, int bit)
}
int is_set_bit(ompi_bitmap_t *bm, int bit)
int is_set_bit(opal_bitmap_t *bm, int bit)
{
int result = ompi_bitmap_is_set_bit(bm, bit);
int result = opal_bitmap_is_set_bit(bm, bit);
if (((1 == result)
&& !(bm->bitmap[bit/SIZE_OF_CHAR] & (1 << bit % SIZE_OF_CHAR)))
|| (result < 0)
@ -264,13 +264,13 @@ int is_set_bit(ompi_bitmap_t *bm, int bit)
}
int find_and_set(ompi_bitmap_t *bm, int bit)
int find_and_set(opal_bitmap_t *bm, int bit)
{
int ret, pos;
/* bit here is the bit that should be found and set, in the top
level stub, this function will be called in sequence to test */
ret = ompi_bitmap_find_and_set_first_unset_bit(bm, &pos);
ret = opal_bitmap_find_and_set_first_unset_bit(bm, &pos);
if (ret != OMPI_SUCCESS) return ret;
if (pos != bit) {
@ -283,10 +283,10 @@ int find_and_set(ompi_bitmap_t *bm, int bit)
}
int clear_all(ompi_bitmap_t *bm)
int clear_all(opal_bitmap_t *bm)
{
int i, err;
err = ompi_bitmap_clear_all_bits(bm);
err = opal_bitmap_clear_all_bits(bm);
for (i = 0; i < bm->array_size; ++i)
if (bm->bitmap[i] != 0) {
fprintf(error_out, "ERROR: clear_all for bitmap arry entry %d\n\n",
@ -297,10 +297,10 @@ int clear_all(ompi_bitmap_t *bm)
}
int set_all(ompi_bitmap_t *bm)
int set_all(opal_bitmap_t *bm)
{
int i, err;
err = ompi_bitmap_set_all_bits(bm);
err = opal_bitmap_set_all_bits(bm);
for (i = 0; i < bm->array_size; ++i)
if (bm->bitmap[i] != 0xff) {
fprintf(error_out, "ERROR: set_all for bitmap arry entry %d\n\n", i);
@ -311,7 +311,7 @@ int set_all(ompi_bitmap_t *bm)
#if WANT_PRINT_BITMAP
void print_bitmap(ompi_bitmap_t *bm)
void print_bitmap(opal_bitmap_t *bm)
{
/* Accessing the fields within the structure, since its not an
opaque structure */