1
1

Remove some of the problems identified by Coverty.

This commit was SVN r16112.
Этот коммит содержится в:
George Bosilca 2007-09-12 20:13:26 +00:00
родитель a289ac114a
Коммит 1e7a791349
6 изменённых файлов: 39 добавлений и 39 удалений

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

@ -751,14 +751,14 @@ ompi_coll_tuned_allgather_intra_basic_linear(void *sbuf, int scount,
int int
ompi_coll_tuned_allgather_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices) ompi_coll_tuned_allgather_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
{ {
int rc, max_alg = 6, requested_alg; int max_alg = 6, requested_alg;
ompi_coll_tuned_forced_max_algorithms[ALLGATHER] = max_alg; ompi_coll_tuned_forced_max_algorithms[ALLGATHER] = max_alg;
rc = mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version, mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version,
"allgather_algorithm_count", "allgather_algorithm_count",
"Number of allgather algorithms available", "Number of allgather algorithms available",
false, true, max_alg, NULL); false, true, max_alg, NULL);
mca_param_indices->algorithm_param_index mca_param_indices->algorithm_param_index
= mca_base_param_reg_int(&mca_coll_tuned_component.super.collm_version, = mca_base_param_reg_int(&mca_coll_tuned_component.super.collm_version,

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

@ -96,7 +96,8 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount,
int line = -1, err = 0; int line = -1, err = 0;
int rank, size; int rank, size;
int sendto, recvfrom, distance, blockcount, i; int sendto, recvfrom, distance, blockcount, i;
int *new_rcounts, *new_rdispls, *new_scounts, *new_sdispls; int *new_rcounts = NULL, *new_rdispls = NULL;
int *new_scounts = NULL, *new_sdispls = NULL;
ptrdiff_t slb, rlb, sext, rext; ptrdiff_t slb, rlb, sext, rext;
char *tmpsend = NULL, *tmprecv = NULL; char *tmpsend = NULL, *tmprecv = NULL;
struct ompi_datatype_t *new_rdtype, *new_sdtype; struct ompi_datatype_t *new_rdtype, *new_sdtype;
@ -199,6 +200,11 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount,
return OMPI_SUCCESS; return OMPI_SUCCESS;
err_hndl: err_hndl:
if( NULL != new_rcounts ) free(new_rcounts);
if( NULL != new_rdispls ) free(new_rdispls);
if( NULL != new_scounts ) free(new_scounts);
if( NULL != new_sdispls ) free(new_sdispls);
OPAL_OUTPUT((ompi_coll_tuned_stream, "%s:%4d\tError occurred %d, rank %2d", OPAL_OUTPUT((ompi_coll_tuned_stream, "%s:%4d\tError occurred %d, rank %2d",
__FILE__, line, err, rank)); __FILE__, line, err, rank));
return err; return err;
@ -681,14 +687,14 @@ ompi_coll_tuned_allgatherv_intra_basic_default(void *sbuf, int scount,
int int
ompi_coll_tuned_allgatherv_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices) ompi_coll_tuned_allgatherv_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
{ {
int rc, max_alg = 5, requested_alg; int max_alg = 5, requested_alg;
ompi_coll_tuned_forced_max_algorithms[ALLGATHERV] = max_alg; ompi_coll_tuned_forced_max_algorithms[ALLGATHERV] = max_alg;
rc = mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version, mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version,
"allgatherv_algorithm_count", "allgatherv_algorithm_count",
"Number of allgather algorithms available", "Number of allgather algorithms available",
false, true, max_alg, NULL); false, true, max_alg, NULL);
mca_param_indices->algorithm_param_index mca_param_indices->algorithm_param_index
= mca_base_param_reg_int(&mca_coll_tuned_component.super.collm_version, = mca_base_param_reg_int(&mca_coll_tuned_component.super.collm_version,

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

@ -926,14 +926,14 @@ ompi_coll_tuned_allreduce_intra_basic_linear(void *sbuf, void *rbuf, int count,
int ompi_coll_tuned_allreduce_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices) int ompi_coll_tuned_allreduce_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
{ {
int rc, max_alg = 5, requested_alg; int max_alg = 5, requested_alg;
ompi_coll_tuned_forced_max_algorithms[ALLREDUCE] = max_alg; ompi_coll_tuned_forced_max_algorithms[ALLREDUCE] = max_alg;
rc = mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version, mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version,
"allreduce_algorithm_count", "allreduce_algorithm_count",
"Number of allreduce algorithms available", "Number of allreduce algorithms available",
false, true, max_alg, NULL); false, true, max_alg, NULL);
mca_param_indices->algorithm_param_index mca_param_indices->algorithm_param_index
= mca_base_param_reg_int( &mca_coll_tuned_component.super.collm_version, = mca_base_param_reg_int( &mca_coll_tuned_component.super.collm_version,

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

@ -606,14 +606,14 @@ int ompi_coll_tuned_alltoall_intra_basic_linear(void *sbuf, int scount,
int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices) int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
{ {
int rc, max_alg = 5, requested_alg, max_requests; int max_alg = 5, requested_alg, max_requests;
ompi_coll_tuned_forced_max_algorithms[ALLTOALL] = max_alg; ompi_coll_tuned_forced_max_algorithms[ALLTOALL] = max_alg;
rc = mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version, mca_base_param_reg_int (&mca_coll_tuned_component.super.collm_version,
"alltoall_algorithm_count", "alltoall_algorithm_count",
"Number of alltoall algorithms available", "Number of alltoall algorithms available",
false, true, max_alg, NULL); false, true, max_alg, NULL);
mca_param_indices->algorithm_param_index mca_param_indices->algorithm_param_index
= mca_base_param_reg_int(&mca_coll_tuned_component.super.collm_version, = mca_base_param_reg_int(&mca_coll_tuned_component.super.collm_version,

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

@ -96,14 +96,13 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(void *sbuf, int scount,
struct ompi_communicator_t *comm, struct ompi_communicator_t *comm,
struct mca_coll_base_module_1_1_0_t *module) struct mca_coll_base_module_1_1_0_t *module)
{ {
int communicator_size, rank; int communicator_size;
size_t dsize, block_dsize; size_t dsize, block_dsize;
#if 0 #if 0
size_t total_dsize; size_t total_dsize;
#endif #endif
communicator_size = ompi_comm_size(comm); communicator_size = ompi_comm_size(comm);
rank = ompi_comm_rank(comm);
/* special case */ /* special case */
if (communicator_size==2) { if (communicator_size==2) {
@ -142,7 +141,7 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(void *sbuf, int scount,
total_dsize = dsize * scount * communicator_size; /* needed for decision */ total_dsize = dsize * scount * communicator_size; /* needed for decision */
OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_alltoall_intra_dec_fixed rank %d com_size %d msg_length %ld", OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_alltoall_intra_dec_fixed rank %d com_size %d msg_length %ld",
rank, communicator_size, total_dsize)); ompi_comm_rank(comm), communicator_size, total_dsize));
if (communicator_size >= 12 && total_dsize <= 768) { if (communicator_size >= 12 && total_dsize <= 768) {
return ompi_coll_tuned_alltoall_intra_bruck (sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module); return ompi_coll_tuned_alltoall_intra_bruck (sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module);
@ -216,12 +215,11 @@ int ompi_coll_tuned_bcast_intra_dec_fixed(void *buff, int count,
const double a_p128 = 1.6134e-6; /* [1 / byte] */ const double a_p128 = 1.6134e-6; /* [1 / byte] */
const double b_p128 = 2.1102; const double b_p128 = 2.1102;
int communicator_size, rank; int communicator_size;
int segsize = 0; int segsize = 0;
size_t message_size, dsize; size_t message_size, dsize;
communicator_size = ompi_comm_size(comm); communicator_size = ompi_comm_size(comm);
rank = ompi_comm_rank(comm);
/* else we need data size for decision function */ /* else we need data size for decision function */
ompi_ddt_type_size(datatype, &dsize); ompi_ddt_type_size(datatype, &dsize);
@ -229,7 +227,7 @@ int ompi_coll_tuned_bcast_intra_dec_fixed(void *buff, int count,
OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_bcast_intra_dec_fixed" OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_bcast_intra_dec_fixed"
" root %d rank %d com_size %d msg_length %lu", " root %d rank %d com_size %d msg_length %lu",
root, rank, communicator_size, (unsigned long)message_size)); root, ompi_comm_rank(comm), communicator_size, (unsigned long)message_size));
/* Handle messages of small and intermediate size, and /* Handle messages of small and intermediate size, and
single-element broadcasts */ single-element broadcasts */
@ -327,7 +325,7 @@ int ompi_coll_tuned_reduce_intra_dec_fixed( void *sendbuf, void *recvbuf,
struct ompi_communicator_t* comm, struct ompi_communicator_t* comm,
struct mca_coll_base_module_1_1_0_t *module) struct mca_coll_base_module_1_1_0_t *module)
{ {
int communicator_size, rank, segsize = 0; int communicator_size, segsize = 0;
size_t message_size, dsize; size_t message_size, dsize;
const double a1 = 0.6016 / 1024.0; /* [1/B] */ const double a1 = 0.6016 / 1024.0; /* [1/B] */
const double b1 = 1.3496; const double b1 = 1.3496;
@ -341,7 +339,6 @@ int ompi_coll_tuned_reduce_intra_dec_fixed( void *sendbuf, void *recvbuf,
const int max_requests = 0; /* no limit on # of outstanding requests */ const int max_requests = 0; /* no limit on # of outstanding requests */
communicator_size = ompi_comm_size(comm); communicator_size = ompi_comm_size(comm);
rank = ompi_comm_rank(comm);
/* need data size for decision function */ /* need data size for decision function */
ompi_ddt_type_size(datatype, &dsize); ompi_ddt_type_size(datatype, &dsize);
@ -361,7 +358,7 @@ int ompi_coll_tuned_reduce_intra_dec_fixed( void *sendbuf, void *recvbuf,
OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_reduce_intra_dec_fixed" OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_reduce_intra_dec_fixed"
"root %d rank %d com_size %d msg_length %lu", "root %d rank %d com_size %d msg_length %lu",
root, rank, communicator_size, (unsigned long)message_size)); root, ompi_comm_rank(comm), communicator_size, (unsigned long)message_size));
if ((communicator_size < 8) && (message_size < 512)){ if ((communicator_size < 8) && (message_size < 512)){
/* Linear_0K */ /* Linear_0K */
@ -495,13 +492,12 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(void *sbuf, int scount,
void* rbuf, int rcount, void* rbuf, int rcount,
struct ompi_datatype_t *rdtype, struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm, struct ompi_communicator_t *comm,
struct mca_coll_base_module_1_1_0_t *module) struct mca_coll_base_module_1_1_0_t *module)
{ {
int communicator_size, rank, pow2_size; int communicator_size, pow2_size;
size_t dsize, total_dsize; size_t dsize, total_dsize;
communicator_size = ompi_comm_size(comm); communicator_size = ompi_comm_size(comm);
rank = ompi_comm_rank(comm);
/* Special case for 2 processes */ /* Special case for 2 processes */
if (communicator_size == 2) { if (communicator_size == 2) {
@ -516,7 +512,7 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(void *sbuf, int scount,
OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed" OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed"
" rank %d com_size %d msg_length %lu", " rank %d com_size %d msg_length %lu",
rank, communicator_size, (unsigned long)total_dsize)); ompi_comm_rank(comm), communicator_size, (unsigned long)total_dsize));
for (pow2_size = 1; pow2_size <= communicator_size; pow2_size <<=1); for (pow2_size = 1; pow2_size <= communicator_size; pow2_size <<=1);
pow2_size >>=1; pow2_size >>=1;
@ -594,11 +590,10 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(void *sbuf, int scount,
struct mca_coll_base_module_1_1_0_t *module) struct mca_coll_base_module_1_1_0_t *module)
{ {
int i; int i;
int communicator_size, rank, pow2_size; int communicator_size, pow2_size;
size_t dsize, total_dsize; size_t dsize, total_dsize;
communicator_size = ompi_comm_size(comm); communicator_size = ompi_comm_size(comm);
rank = ompi_comm_rank(comm);
/* Special case for 2 processes */ /* Special case for 2 processes */
if (communicator_size == 2) { if (communicator_size == 2) {
@ -617,7 +612,7 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(void *sbuf, int scount,
OPAL_OUTPUT((ompi_coll_tuned_stream, OPAL_OUTPUT((ompi_coll_tuned_stream,
"ompi_coll_tuned_allgatherv_intra_dec_fixed" "ompi_coll_tuned_allgatherv_intra_dec_fixed"
" rank %d com_size %d msg_length %lu", " rank %d com_size %d msg_length %lu",
rank, communicator_size, (unsigned long)total_dsize)); ompi_comm_rank(comm), communicator_size, (unsigned long)total_dsize));
for (pow2_size = 1; pow2_size <= communicator_size; pow2_size <<=1); for (pow2_size = 1; pow2_size <= communicator_size; pow2_size <<=1);
pow2_size >>=1; pow2_size >>=1;

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

@ -150,7 +150,7 @@ static int
tuned_module_enable(struct mca_coll_base_module_1_1_0_t *module, tuned_module_enable(struct mca_coll_base_module_1_1_0_t *module,
struct ompi_communicator_t *comm) struct ompi_communicator_t *comm)
{ {
int size, rank; int size;
mca_coll_tuned_module_t *tuned_module = (mca_coll_tuned_module_t *) module; mca_coll_tuned_module_t *tuned_module = (mca_coll_tuned_module_t *) module;
mca_coll_tuned_comm_t *data = NULL; mca_coll_tuned_comm_t *data = NULL;
/* fanout parameters */ /* fanout parameters */
@ -228,7 +228,6 @@ tuned_module_enable(struct mca_coll_base_module_1_1_0_t *module,
/* (B) so we can get our very own customised ompi_coll_com_rule_t ptr */ /* (B) so we can get our very own customised ompi_coll_com_rule_t ptr */
/* which only has rules in it for our com size */ /* which only has rules in it for our com size */
rank = ompi_comm_rank(comm); /* find rank as only MCW:0 opens any tuned conf files */
/* actually if they are below a threadhold, they all open it */ /* actually if they are below a threadhold, they all open it */
/* have to build a collective in here.. but just for MCW.. */ /* have to build a collective in here.. but just for MCW.. */
/* but we have to make sure we have the same rules everywhere :( */ /* but we have to make sure we have the same rules everywhere :( */