diff --git a/ompi/mca/coll/ml/coll_ml_allocation.c b/ompi/mca/coll/ml/coll_ml_allocation.c index 15840a3b51..2a91d948d7 100644 --- a/ompi/mca/coll/ml/coll_ml_allocation.c +++ b/ompi/mca/coll/ml/coll_ml_allocation.c @@ -44,7 +44,7 @@ mca_bcol_base_memory_block_desc_t *mca_coll_ml_allocate_block(struct mca_coll_ml memory_block->size_block = memory_manager->list_block_size; if (!memory_block->block){ - ML_ERROR(("lmngr failed.")); + ML_VERBOSE(1, ("lmngr failed.")); ret = NULL; goto exit_ERROR; } diff --git a/ompi/mca/coll/ml/coll_ml_hier_algorithms_allgather_setup.c b/ompi/mca/coll/ml/coll_ml_hier_algorithms_allgather_setup.c index 1fc128654a..3b4a900edf 100644 --- a/ompi/mca/coll/ml/coll_ml_hier_algorithms_allgather_setup.c +++ b/ompi/mca/coll/ml/coll_ml_hier_algorithms_allgather_setup.c @@ -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 Los Alamos National Security, LLC. All rights + * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -197,7 +197,7 @@ int ml_coll_hier_allgather_setup(mca_coll_ml_module_t *ml_module) void ml_coll_hier_allgather_cleanup(mca_coll_ml_module_t *ml_module) { /* Hierarchy Setup */ - int ret, topo_index, alg; + int topo_index, alg; mca_coll_ml_topology_t *topo_info = ml_module->topo_list; alg = mca_coll_ml_component.coll_config[ML_ALLGATHER][ML_SMALL_MSG].algorithm_id; @@ -208,10 +208,19 @@ void ml_coll_hier_allgather_cleanup(mca_coll_ml_module_t *ml_module) return; } - free(ml_module->coll_ml_allgather_functions[alg]->component_functions); - ml_module->coll_ml_allgather_functions[alg]->component_functions = NULL; - free(ml_module->coll_ml_allgather_functions[alg]); - ml_module->coll_ml_allgather_functions[alg] = NULL; + if (NULL == ml_module->coll_ml_allgather_functions[alg]) { + return; + } + + if (ml_module->coll_ml_allgather_functions[alg]->component_functions) { + free(ml_module->coll_ml_allgather_functions[alg]->component_functions); + ml_module->coll_ml_allgather_functions[alg]->component_functions = NULL; + } + + if (ml_module->coll_ml_allgather_functions[alg]) { + free(ml_module->coll_ml_allgather_functions[alg]); + ml_module->coll_ml_allgather_functions[alg] = NULL; + } alg = mca_coll_ml_component.coll_config[ML_ALLGATHER][ML_LARGE_MSG].algorithm_id; topo_index = ml_module->collectives_topology_map[ML_ALLGATHER][alg]; @@ -221,8 +230,13 @@ void ml_coll_hier_allgather_cleanup(mca_coll_ml_module_t *ml_module) return; } - free(ml_module->coll_ml_allgather_functions[alg]->component_functions); - ml_module->coll_ml_allgather_functions[alg]->component_functions = NULL; - free(ml_module->coll_ml_allgather_functions[alg]); - ml_module->coll_ml_allgather_functions[alg] = NULL; + if (ml_module->coll_ml_allgather_functions[alg]->component_functions) { + free(ml_module->coll_ml_allgather_functions[alg]->component_functions); + ml_module->coll_ml_allgather_functions[alg]->component_functions = NULL; + } + + if (ml_module->coll_ml_allgather_functions[alg]) { + free(ml_module->coll_ml_allgather_functions[alg]); + ml_module->coll_ml_allgather_functions[alg] = NULL; + } } diff --git a/ompi/mca/coll/ml/coll_ml_hier_algorithms_allreduce_setup.c b/ompi/mca/coll/ml/coll_ml_hier_algorithms_allreduce_setup.c index 1bb5349682..cabb3f2685 100644 --- a/ompi/mca/coll/ml/coll_ml_hier_algorithms_allreduce_setup.c +++ b/ompi/mca/coll/ml/coll_ml_hier_algorithms_allreduce_setup.c @@ -382,6 +382,10 @@ void ml_coll_hier_allreduce_cleanup_new(mca_coll_ml_module_t *ml_module) return; } + if (NULL == ml_module->coll_ml_allreduce_functions[alg]) { + return; + } + free(ml_module->coll_ml_allreduce_functions[alg]->component_functions); ml_module->coll_ml_allreduce_functions[alg]->component_functions = NULL; free(ml_module->coll_ml_allreduce_functions[alg]); diff --git a/ompi/mca/coll/ml/coll_ml_hier_algorithms_bcast_setup.c b/ompi/mca/coll/ml/coll_ml_hier_algorithms_bcast_setup.c index 0593ea5281..3f6c172d0a 100644 --- a/ompi/mca/coll/ml/coll_ml_hier_algorithms_bcast_setup.c +++ b/ompi/mca/coll/ml/coll_ml_hier_algorithms_bcast_setup.c @@ -1,8 +1,11 @@ +/* -*- 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) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2014 Los Alamos National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -806,7 +809,7 @@ int ml_coll_hier_bcast_setup(mca_coll_ml_module_t *ml_module) void ml_coll_hier_bcast_cleanup(mca_coll_ml_module_t *ml_module) { /* Hierarchy Setup */ - int ret, i , size_code, alg; + int i, alg; int topo_index = 0; mca_coll_ml_topology_t *topo_info = ml_module->topo_list; @@ -829,6 +832,10 @@ void ml_coll_hier_bcast_cleanup(mca_coll_ml_module_t *ml_module) return; } + if (NULL == ml_module->coll_ml_bcast_functions[alg]) { + continue; + } + switch (alg) { case ML_BCAST_SMALL_DATA_KNOWN: case ML_BCAST_LARGE_DATA_KNOWN: @@ -836,10 +843,15 @@ void ml_coll_hier_bcast_cleanup(mca_coll_ml_module_t *ml_module) case ML_BCAST_LARGE_DATA_UNKNOWN: case ML_BCAST_SMALL_DATA_SEQUENTIAL: case ML_BCAST_LARGE_DATA_SEQUENTIAL: - free(ml_module->coll_ml_bcast_functions[alg]->component_functions); - ml_module->coll_ml_bcast_functions[alg]->component_functions = NULL; - free(ml_module->coll_ml_bcast_functions[alg]); - ml_module->coll_ml_bcast_functions[alg] = NULL; + if (ml_module->coll_ml_bcast_functions[alg]->component_functions) { + free(ml_module->coll_ml_bcast_functions[alg]->component_functions); + ml_module->coll_ml_bcast_functions[alg]->component_functions = NULL; + } + + if (ml_module->coll_ml_bcast_functions[alg]) { + free(ml_module->coll_ml_bcast_functions[alg]); + ml_module->coll_ml_bcast_functions[alg] = NULL; + } break; default: topo_info->hierarchical_algorithms[ML_BCAST] = NULL; diff --git a/ompi/mca/coll/ml/coll_ml_hier_algorithms_reduce_setup.c b/ompi/mca/coll/ml/coll_ml_hier_algorithms_reduce_setup.c index acd87ade48..465de228c1 100644 --- a/ompi/mca/coll/ml/coll_ml_hier_algorithms_reduce_setup.c +++ b/ompi/mca/coll/ml/coll_ml_hier_algorithms_reduce_setup.c @@ -331,16 +331,29 @@ void ml_coll_hier_reduce_cleanup(mca_coll_ml_module_t *ml_module) return; } - for (i=0; itopo_list[topo_index].n_levels; i++) { - free(ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr[i]); - ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr[i] = NULL; + if (NULL == ml_module->coll_ml_reduce_functions[alg]) { + return; } - free(ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr); - ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr = NULL; + for (i=0; itopo_list[topo_index].n_levels; i++) { + if (ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr[i]) { + free(ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr[i]); + ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr[i] = NULL; + } + } - free(ml_module->coll_ml_reduce_functions[alg]->component_functions); - ml_module->coll_ml_reduce_functions[alg]->component_functions = NULL; - free(ml_module->coll_ml_reduce_functions[alg]); - ml_module->coll_ml_reduce_functions[alg] = NULL; + if (ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr) { + free(ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr); + ml_module->coll_ml_reduce_functions[alg]->comp_fn_arr = NULL; + } + + if (ml_module->coll_ml_reduce_functions[alg]->component_functions) { + free(ml_module->coll_ml_reduce_functions[alg]->component_functions); + ml_module->coll_ml_reduce_functions[alg]->component_functions = NULL; + } + + if (ml_module->coll_ml_reduce_functions[alg]) { + free(ml_module->coll_ml_reduce_functions[alg]); + ml_module->coll_ml_reduce_functions[alg] = NULL; + } } diff --git a/ompi/mca/coll/ml/coll_ml_module.c b/ompi/mca/coll/ml/coll_ml_module.c index 3d74f238cf..e8ff23faa2 100644 --- a/ompi/mca/coll/ml/coll_ml_module.c +++ b/ompi/mca/coll/ml/coll_ml_module.c @@ -92,20 +92,11 @@ mca_coll_ml_module_construct(mca_coll_ml_module_t *module) int index_topo, coll_i, st_i; mca_coll_ml_topology_t *topo; - module->max_fn_calls = 0; - module->initialized = false; - module->comm = NULL; - module->collective_sequence_num = 0; - module->no_data_collective_sequence_num = 0; - module->payload_block = NULL; - - module->reference_convertor = NULL; + memset ((char *) module + sizeof (module->super), 0, sizeof (*module) - sizeof (module->super)); /* It's critical to reset data_offset to zero */ module->data_offset = -1; - module->coll_ml_barrier_function = NULL; - /* If the topology support zero level and no fragmentation was requested */ for (index_topo = 0; index_topo < COLL_ML_TOPO_MAX; index_topo++) { topo = &module->topo_list[index_topo]; @@ -113,22 +104,8 @@ mca_coll_ml_module_construct(mca_coll_ml_module_t *module) topo->global_highest_hier_group_index = -1; topo->number_of_all_subgroups = -1; topo->n_levels = -1; - topo->sort_list = NULL; - topo->hier_layout_info = NULL; topo->all_bcols_mode = ~(0); /* set to all bits */ - topo->route_vector = NULL; - topo->array_of_all_subgroups = NULL; - topo->component_pairs = NULL; - topo->hier_layout_info = NULL; topo->status = COLL_ML_TOPO_DISABLED; /* all topologies are not used by default */ - - /* Init ordering info */ - topo->topo_ordering_info.next_inorder = 0; - topo->topo_ordering_info.next_order_num = 0; - topo->topo_ordering_info.num_bcols_need_ordering = 0; - - memset(topo->hierarchical_algorithms, 0, - BCOL_NUM_OF_FUNCTIONS * sizeof(coll_ml_collective_description_t *)); } for (coll_i = 0; coll_i < ML_NUM_OF_FUNCTIONS; coll_i++) { @@ -161,7 +138,7 @@ mca_coll_ml_module_construct(mca_coll_ml_module_t *module) static void mca_coll_ml_module_destruct(mca_coll_ml_module_t *module) { - int i, j, k,fnc, index_topo, alg; + int i, j, k,fnc, index_topo; mca_coll_ml_topology_t *topo; ML_VERBOSE(4, ("ML module destruct")); @@ -557,7 +534,7 @@ static int ml_module_memory_initialization(mca_coll_ml_module_t *ml_module) ml_module->payload_block = mca_coll_ml_allocate_block(cs,ml_module->payload_block); if (NULL == ml_module->payload_block) { - ML_ERROR(("mca_coll_ml_allocate_block exited with error.")); + ML_VERBOSE(1, ("mca_coll_ml_allocate_block exited with error.")); return OMPI_ERROR; }