Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions ompi/mca/bcol/basesmuma/bcol_basesmuma_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -271,12 +271,7 @@ static int basesmuma_close(void)
mca_bcol_basesmuma_component_t *cs = &mca_bcol_basesmuma_component;

/* gvm Leak FIX */
while(!opal_list_is_empty(&(cs->ctl_structures))) {
opal_list_item_t *item;
item = opal_list_remove_first(&(cs->ctl_structures));
OBJ_DESTRUCT(item);
}
OBJ_DESTRUCT(&(cs->ctl_structures));
OPAL_LIST_DESTRUCT (&cs->ctl_structures);

/* deregister the progress function */
ret=opal_progress_unregister(bcol_basesmuma_progress);
Expand Down Expand Up @@ -331,7 +326,7 @@ int mca_bcol_basesmuma_init_query(bool enable_progress_threads,
int mca_bcol_basesmuma_allocate_sm_ctl_memory(mca_bcol_basesmuma_component_t *cs)
{
/* local variables */
int name_length, ret;
int name_length, ret = OMPI_SUCCESS;
size_t ctl_length;
char *name;
size_t page_size = getpagesize ();
Expand All @@ -347,6 +342,7 @@ int mca_bcol_basesmuma_allocate_sm_ctl_memory(mca_bcol_basesmuma_component_t *cs
}
/* make sure name is not too long */
if ( OPAL_PATH_MAX < (name_length-1) ) {
free (name);
return OMPI_ERROR;
}

Expand All @@ -371,21 +367,14 @@ int mca_bcol_basesmuma_allocate_sm_ctl_memory(mca_bcol_basesmuma_component_t *cs
if( !cs->sm_ctl_structs) {
opal_output (ompi_bcol_base_framework.framework_output,
"In mca_bcol_basesmuma_allocate_sm_ctl_memory failed to allocathe backing file %s\n", name);
ret=OMPI_ERR_OUT_OF_RESOURCE;
goto Error;
ret = OMPI_ERR_OUT_OF_RESOURCE;
}

/* free the memory allocated by asprintf for the file name -
* in mca_base_smcm_mem_reg this name is copied into a new
* memory location */
free(name);
free (name);

/* successful return */
return OMPI_SUCCESS;

Error:
if(name) {
free(name);
}
return ret;
}
54 changes: 26 additions & 28 deletions ompi/mca/bcol/basesmuma/bcol_basesmuma_rk_barrier.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -72,7 +75,7 @@ int bcol_basesmuma_k_nomial_barrier_init(bcol_function_args_t *input_args,
int pow_k, tree_order;
int max_requests = 0; /* important to initialize this */

int matched = 0;
bool matched;
int64_t sequence_number=input_args->sequence_num;
int my_rank = bcol_module->super.sbgp_partner_module->my_index;

Expand Down Expand Up @@ -128,10 +131,8 @@ int bcol_basesmuma_k_nomial_barrier_init(bcol_function_args_t *input_args,
src = exchange_node->rank_extra_sources_array[0];
peer_ctl_pointer = data_buffs[src].ctl_struct;

for( i = 0; i < cm->num_to_probe && (0 == matched); i++ ) {
for( i = 0; i < cm->num_to_probe ; i++ ) {
if(IS_PEER_READY(peer_ctl_pointer, ready_flag, sequence_number, BARRIER_RKING_FLAG, bcol_id)){
matched = 1;

goto FINISHED;
}

Expand All @@ -148,20 +149,21 @@ int bcol_basesmuma_k_nomial_barrier_init(bcol_function_args_t *input_args,
peer_ctl_pointer = data_buffs[src].ctl_struct;

/* probe for extra rank's arrival */
for( i = 0; i < cm->num_to_probe && ( 0 == matched); i++) {
for( i = 0, matched = false ; i < cm->num_to_probe && !matched ; i++) {
if(IS_PEER_READY(peer_ctl_pointer,ready_flag, sequence_number, BARRIER_RKING_FLAG, bcol_id)){
matched = 1;
/* copy it in */
goto MAIN_PHASE;
/* copy it in */
matched = true;
break;
}
}
*status = ready_flag;
*iteration = -1;
return BCOL_FN_STARTED;

if (!matched) {
*status = ready_flag;
*iteration = -1;
return BCOL_FN_STARTED;
}
}

MAIN_PHASE:
/* bump the ready flag */
ready_flag++;

Expand Down Expand Up @@ -189,12 +191,11 @@ int bcol_basesmuma_k_nomial_barrier_init(bcol_function_args_t *input_args,
* better temporal locality, this comes at a cost to asynchronicity
* but should get better cache performance
*/
matched = 0;
for( probe = 0; probe < cm->num_to_probe && (0 == matched); probe++){
for( probe = 0; probe < cm->num_to_probe ; probe++){
if(IS_PEER_READY(peer_ctl_pointer,ready_flag, sequence_number, BARRIER_RKING_FLAG, bcol_id)){
matched = 1;
/* set this request's bit */
*active_requests ^= (1<<j);
break;
}
}
}
Expand Down Expand Up @@ -261,7 +262,7 @@ int bcol_basesmuma_k_nomial_barrier_progress(bcol_function_args_t *input_args,
int pow_k, tree_order;
int bcol_id = (int) bcol_module->super.bcol_id;

int matched = 0;
bool matched;
int64_t sequence_number=input_args->sequence_num;
int my_rank = bcol_module->super.sbgp_partner_module->my_index;

Expand Down Expand Up @@ -311,10 +312,8 @@ int bcol_basesmuma_k_nomial_barrier_progress(bcol_function_args_t *input_args,
src = exchange_node->rank_extra_sources_array[0];
peer_ctl_pointer = data_buffs[src].ctl_struct;

for( i = 0; i < cm->num_to_probe && (0 == matched); i++ ) {
for( i = 0; i < cm->num_to_probe ; i++ ) {
if(IS_PEER_READY(peer_ctl_pointer, ready_flag, sequence_number, BARRIER_RKING_FLAG, bcol_id)){
matched = 1;

goto FINISHED;
}

Expand All @@ -330,21 +329,21 @@ int bcol_basesmuma_k_nomial_barrier_progress(bcol_function_args_t *input_args,
peer_ctl_pointer = data_buffs[src].ctl_struct;

/* probe for extra rank's arrival */
for( i = 0; i < cm->num_to_probe && ( 0 == matched); i++) {
for( i = 0, matched = false ; i < cm->num_to_probe && !matched ; i++) {
if(IS_PEER_READY(peer_ctl_pointer,ready_flag, sequence_number, BARRIER_RKING_FLAG, bcol_id)){
matched = 1;
matched = true;
/* bump the flag */
ready_flag++;
*iteration = 0;
goto MAIN_PHASE;
break;
}
}
return BCOL_FN_STARTED;

if (!matched) {
return BCOL_FN_STARTED;
}
}

MAIN_PHASE:

/* start the recursive k - ing phase */
for( *iter=*iteration; *iter < pow_k; (*iter)++) {
/* I am ready at this level */
Expand All @@ -369,12 +368,11 @@ int bcol_basesmuma_k_nomial_barrier_progress(bcol_function_args_t *input_args,
/* I am putting the probe loop as the inner most loop to achieve
* better temporal locality
*/
matched = 0;
for( probe = 0; probe < cm->num_to_probe && (0 == matched); probe++){
for( probe = 0; probe < cm->num_to_probe ; probe++){
if(IS_PEER_READY(peer_ctl_pointer,ready_flag, sequence_number, BARRIER_RKING_FLAG, bcol_id)){
matched = 1;
/* flip the request's bit */
*active_requests ^= (1<<j);
break;
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions ompi/mca/bcol/basesmuma/bcol_basesmuma_smcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
Expand Down Expand Up @@ -371,7 +371,10 @@ bcol_basesmuma_smcm_mmap_t *bcol_basesmuma_smcm_mem_reg(void *in_ptr,
if (fd < 0) {
opal_output (ompi_bcol_base_framework.framework_output, "basesmuma shared memory allocation open failed with errno: %d",
errno);
} else if (0 != ftruncate(fd,length)) {
return NULL;
}

if (0 != ftruncate(fd,length)) {
opal_output (ompi_bcol_base_framework.framework_output, "basesmuma shared memory allocation ftruncate failed with errno: %d",
errno);
} else {
Expand Down
3 changes: 3 additions & 0 deletions ompi/mca/bcol/ptpcoll/bcol_ptpcoll_bcast.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down
5 changes: 4 additions & 1 deletion ompi/mca/bcol/ptpcoll/bcol_ptpcoll_bcast.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -66,7 +69,7 @@ do {
int dst_boundary_rank; \
int radix_mask = radix_mask_pow >= 0 ? 1 << radix_mask_pow : 0; \
\
while(radix_mask > 0) { \
while(radix_mask_pow >= 0) { \
/* For each level of tree, do sends */ \
dst = my_group_index ^ radix_mask; \
comm_dst = group_list[dst]; \
Expand Down
9 changes: 6 additions & 3 deletions ompi/mca/coll/base/coll_base_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
Expand Down Expand Up @@ -352,8 +352,11 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_coll_base_comm_t);
*/
static inline void ompi_coll_base_free_reqs(ompi_request_t **reqs, int count)
{
int i;
for (i = 0; i < count; ++i) {
if (OPAL_UNLIKELY(NULL == reqs)) {
return;
}

for (int i = 0; i < count; ++i) {
if( MPI_REQUEST_NULL != reqs[i] ) {
ompi_request_free(&reqs[i]);
}
Expand Down
40 changes: 12 additions & 28 deletions ompi/mca/coll/ml/coll_ml_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -440,6 +440,9 @@ static int parse_line(section_config_t *section)
if (COLL_ML_CONFIG_PARSE_SINGLE_WORD == val ||
COLL_ML_CONFIG_PARSE_VALUE == val) {
value = strdup(coll_ml_config_yytext);
if (NULL == value) {
return OMPI_ERR_OUT_OF_RESOURCE;
}

/* Now we need to see the newline */
val = coll_ml_config_yylex();
Expand All @@ -458,48 +461,29 @@ static int parse_line(section_config_t *section)
COLL_ML_CONFIG_PARSE_NEWLINE != val) {
ML_ERROR(("Line %d, expected new line or end of line",
coll_ml_config_yynewlines));
ret = OMPI_ERROR;
goto Error;
return OMPI_ERROR;
} else {
ML_ERROR(("Line %d malformed", coll_ml_config_yynewlines));
return OMPI_ERROR;
}

/* Line parsing is done, read the values */
if (!strcasecmp(key_buffer, "algorithm")) {
ret = parse_algorithm_key(section, value);
if (OMPI_SUCCESS != ret) {
goto Error;
}
}

else if (!strcasecmp(key_buffer, "threshold")) {
} else if (!strcasecmp(key_buffer, "threshold")) {
ret = parse_threshold_key(section, value);
if (OMPI_SUCCESS != ret) {
goto Error;
}
}

else if (!strcasecmp(key_buffer, "hierarchy")) {
} else if (!strcasecmp(key_buffer, "hierarchy")) {
ret = parse_hierarchy_key(section, value);
if (OMPI_SUCCESS != ret) {
goto Error;
}
}

else if (!strcasecmp(key_buffer, "fragmentation")) {
} else if (!strcasecmp(key_buffer, "fragmentation")) {
ret = parse_fragmentation_key(section, value);
if (OMPI_SUCCESS != ret) {
goto Error;
}
/* Failed to parse the key */
} else {
ML_ERROR(("Line %d, unknown key %s",
coll_ml_config_yynewlines, key_buffer));
}

/* All done */
Error:
if (NULL != value) {
free(value);
}
free(value);

return ret;
}
Expand Down
Loading