From 43ef261d46fc6843530bd0d6cbf1288621cda88d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 31 Aug 2015 08:46:55 +0900 Subject: [PATCH] topo: do not cast way the const modifier when this is not necessary update the topo framework and mpi c bindings --- ompi/mca/topo/base/base.h | 34 +++++++++---------- ompi/mca/topo/base/topo_base_cart_create.c | 13 ++++--- ompi/mca/topo/base/topo_base_cart_map.c | 12 ++++--- ompi/mca/topo/base/topo_base_cart_rank.c | 10 +++--- ompi/mca/topo/base/topo_base_cart_sub.c | 14 ++++---- .../topo/base/topo_base_dist_graph_create.c | 12 +++---- .../topo_base_dist_graph_create_adjacent.c | 8 ++--- ompi/mca/topo/base/topo_base_graph_create.c | 4 +-- ompi/mca/topo/base/topo_base_graph_map.c | 4 ++- ompi/mca/topo/topo.h | 34 +++++++++---------- ompi/mca/topo/treematch/topo_treematch.h | 8 +++-- .../topo_treematch_dist_graph_create.c | 8 +++-- ompi/mpi/c/cart_create.c | 5 +-- ompi/mpi/c/cart_map.c | 7 ++-- ompi/mpi/c/cart_rank.c | 5 ++- ompi/mpi/c/cart_sub.c | 5 ++- ompi/mpi/c/dist_graph_create.c | 7 ++-- ompi/mpi/c/dist_graph_create_adjacent.c | 7 ++-- ompi/mpi/c/graph_create.c | 5 +-- ompi/mpi/c/graph_map.c | 5 +-- 20 files changed, 108 insertions(+), 99 deletions(-) diff --git a/ompi/mca/topo/base/base.h b/ompi/mca/topo/base/base.h index a755b36512..5e05a8009d 100644 --- a/ompi/mca/topo/base/base.h +++ b/ompi/mca/topo/base/base.h @@ -13,7 +13,7 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -73,8 +73,8 @@ OMPI_DECLSPEC int mca_topo_base_cart_create(mca_topo_base_module_t *topo_module, ompi_communicator_t* old_comm, int ndims, - int *dims, - int *periods, + const int *dims, + const int *periods, bool reorder, ompi_communicator_t** comm_topo); @@ -98,11 +98,11 @@ mca_topo_base_cart_get(ompi_communicator_t *comm, OMPI_DECLSPEC int mca_topo_base_cart_map(ompi_communicator_t * comm, int ndims, - int *dims, int *periods, int *newrank); + const int *dims, const int *periods, int *newrank); OMPI_DECLSPEC int mca_topo_base_cart_rank(ompi_communicator_t *comm, - int *coords, + const int *coords, int *rank); OMPI_DECLSPEC int @@ -114,7 +114,7 @@ mca_topo_base_cart_shift(ompi_communicator_t *comm, OMPI_DECLSPEC int mca_topo_base_cart_sub(ompi_communicator_t *comm, - int *remain_dims, + const int *remain_dims, ompi_communicator_t **new_comm); OMPI_DECLSPEC int @@ -126,8 +126,8 @@ OMPI_DECLSPEC int mca_topo_base_graph_create(mca_topo_base_module_t *topo_module, ompi_communicator_t* old_comm, int nnodes, - int *index, - int *edges, + const int *index, + const int *edges, bool reorder, ompi_communicator_t** new_comm); @@ -141,7 +141,7 @@ mca_topo_base_graph_get(ompi_communicator_t *comm, OMPI_DECLSPEC int mca_topo_base_graph_map(ompi_communicator_t * comm, int nnodes, - int *index, int *edges, int *newrank); + const int *index, const int *edges, int *newrank); OMPI_DECLSPEC int mca_topo_base_graph_neighbors(ompi_communicator_t *comm, @@ -161,25 +161,25 @@ mca_topo_base_graph_neighbors_count(ompi_communicator_t *comm, OMPI_DECLSPEC int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module, ompi_communicator_t *comm, - int n, int nodes[], - int degrees[], int targets[], - int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], + const int weights[], mca_topo_base_comm_dist_graph_2_2_0_t** ptopo); OMPI_DECLSPEC int mca_topo_base_dist_graph_create(mca_topo_base_module_t* module, ompi_communicator_t *old_comm, - int n, int nodes[], - int degrees[], int targets[], int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], const int weights[], ompi_info_t *info, int reorder, ompi_communicator_t **new_comm); OMPI_DECLSPEC int mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module, ompi_communicator_t *old_comm, - int indegree, int sources[], - int sourceweights[], int outdegree, - int destinations[], int destweights[], + int indegree, const int sources[], + const int sourceweights[], int outdegree, + const int destinations[], const int destweights[], ompi_info_t *info, int reorder, ompi_communicator_t **comm_dist_graph); diff --git a/ompi/mca/topo/base/topo_base_cart_create.c b/ompi/mca/topo/base/topo_base_cart_create.c index 3b9689c9db..c4737096d5 100644 --- a/ompi/mca/topo/base/topo_base_cart_create.c +++ b/ompi/mca/topo/base/topo_base_cart_create.c @@ -50,12 +50,12 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo, ompi_communicator_t* old_comm, int ndims, - int *dims, - int *periods, + const int *dims, + const int *periods, bool reorder, ompi_communicator_t** comm_topo) { - int nprocs = 1, i, *p, new_rank, num_procs, ret; + int nprocs = 1, i, new_rank, num_procs, ret; ompi_communicator_t *new_comm; ompi_proc_t **topo_procs = NULL; mca_topo_base_comm_cart_2_2_0_t* cart; @@ -65,12 +65,11 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo, assert(topo->type == OMPI_COMM_CART); /* Calculate the number of processes in this grid */ - p = dims; - for (i = 0; i < ndims; ++i, ++p) { - if(*p <= 0) { + for (i = 0; i < ndims; ++i) { + if(dims[i] <= 0) { return OMPI_ERROR; } - nprocs *= *p; + nprocs *= dims[i]; } /* check for the error condition */ diff --git a/ompi/mca/topo/base/topo_base_cart_map.c b/ompi/mca/topo/base/topo_base_cart_map.c index f75ebd2aea..64faa6612e 100644 --- a/ompi/mca/topo/base/topo_base_cart_map.c +++ b/ompi/mca/topo/base/topo_base_cart_map.c @@ -9,6 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,19 +40,19 @@ int mca_topo_base_cart_map(ompi_communicator_t* comm, int ndims, - int *dims, int *periods, int *newrank) + const int *dims, const int *periods, int *newrank) { - int nprocs, rank, size, i, *p; + int nprocs, rank, size, i; /* * Compute the # of processes in the grid. */ nprocs = 1; - for (i = 0, p = dims; i < ndims; ++i, ++p) { - if (*p <= 0) { + for (i = 0 ; i < ndims; ++i) { + if (dims[i] <= 0) { return MPI_ERR_DIMS; } - nprocs *= *p; + nprocs *= dims[i]; } /* * Check that number of processes <= size of communicator. diff --git a/ompi/mca/topo/base/topo_base_cart_rank.c b/ompi/mca/topo/base/topo_base_cart_rank.c index 7099232520..677e0792f1 100644 --- a/ompi/mca/topo/base/topo_base_cart_rank.c +++ b/ompi/mca/topo/base/topo_base_cart_rank.c @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +40,7 @@ */ int mca_topo_base_cart_rank(ompi_communicator_t* comm, - int *coords, + const int *coords, int *rank) { int prank; @@ -47,7 +49,6 @@ int mca_topo_base_cart_rank(ompi_communicator_t* comm, int factor; int i; int *d; - int *c; /* * Loop over coordinates computing the rank. @@ -57,11 +58,10 @@ int mca_topo_base_cart_rank(ompi_communicator_t* comm, i = comm->c_topo->mtc.cart->ndims - 1; d = comm->c_topo->mtc.cart->dims + i; - c = coords + i; - for (; i >= 0; --i, --c, --d) { + for (; i >= 0; --i, --d) { dim = *d; - ord = *c; + ord = coords[i]; /* Per MPI-2.1 7.5.4 (description of MPI_CART_RANK), if the dimension is periodic and the coordinate is outside of 0 <= coord(i) < dim, then normalize it. If the dimension is not diff --git a/ompi/mca/topo/base/topo_base_cart_sub.c b/ompi/mca/topo/base/topo_base_cart_sub.c index 0511ef2e04..40176090ff 100644 --- a/ompi/mca/topo/base/topo_base_cart_sub.c +++ b/ompi/mca/topo/base/topo_base_cart_sub.c @@ -43,14 +43,14 @@ * @retval MPI_ERR_COMM */ int mca_topo_base_cart_sub (ompi_communicator_t* comm, - int *remain_dims, + const int *remain_dims, ompi_communicator_t** new_comm) { struct ompi_communicator_t *temp_comm; mca_topo_base_comm_cart_2_2_0_t *old_cart; int errcode, colour, key, colfactor, keyfactor; int ndim, dim, i; - int *d, *dorig = NULL, *dold, *c, *r, *p, *porig = NULL, *pold; + int *d, *dorig = NULL, *dold, *c, *p, *porig = NULL, *pold; mca_topo_base_module_t* topo; mca_topo_base_comm_cart_2_2_0_t* cart; @@ -67,11 +67,10 @@ int mca_topo_base_cart_sub (ompi_communicator_t* comm, i = old_cart->ndims - 1; d = old_cart->dims + i; c = comm->c_topo->mtc.cart->coords + i; - r = remain_dims + i; - for (; i >= 0; --i, --d, --c, --r) { + for (; i >= 0; --i, --d, --c) { dim = *d; - if (*r == 0) { + if (remain_dims[i] == 0) { colour += colfactor * (*c); colfactor *= dim; } else { @@ -110,9 +109,8 @@ int mca_topo_base_cart_sub (ompi_communicator_t* comm, /* Copy the periods */ porig = p = (int*)malloc(ndim * sizeof(int)); pold = old_cart->periods; - r = remain_dims; - for (i = 0; i < old_cart->ndims; ++i, ++dold, ++pold, ++r) { - if (*r) { + for (i = 0; i < old_cart->ndims; ++i, ++dold, ++pold) { + if (remain_dims[i]) { *d++ = *dold; *p++ = *pold; } diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create.c b/ompi/mca/topo/base/topo_base_dist_graph_create.c index 8b61680a33..30b04c1708 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create.c @@ -33,9 +33,9 @@ typedef struct _dist_graph_elem { int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module, ompi_communicator_t *comm, - int n, int nodes[], - int degrees[], int targets[], - int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], + const int weights[], mca_topo_base_comm_dist_graph_2_2_0_t** ptopo) { int i, j, err, count, left_over, pending_reqs, current_pos, index, csize; @@ -280,9 +280,9 @@ int mca_topo_base_dist_graph_distribute(mca_topo_base_module_t* module, int mca_topo_base_dist_graph_create(mca_topo_base_module_t* module, ompi_communicator_t *comm_old, - int n, int nodes[], - int degrees[], int targets[], - int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], + const int weights[], ompi_info_t *info, int reorder, ompi_communicator_t **newcomm) { diff --git a/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c b/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c index 4179f07d86..55100229fd 100644 --- a/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c +++ b/ompi/mca/topo/base/topo_base_dist_graph_create_adjacent.c @@ -21,11 +21,11 @@ int mca_topo_base_dist_graph_create_adjacent(mca_topo_base_module_t* module, ompi_communicator_t *comm_old, - int indegree, int sources[], - int sourceweights[], + int indegree, const int sources[], + const int sourceweights[], int outdegree, - int destinations[], - int destweights[], + const int destinations[], + const int destweights[], ompi_info_t *info, int reorder, ompi_communicator_t **newcomm) { diff --git a/ompi/mca/topo/base/topo_base_graph_create.c b/ompi/mca/topo/base/topo_base_graph_create.c index 53e4dab01a..e2998bd185 100644 --- a/ompi/mca/topo/base/topo_base_graph_create.c +++ b/ompi/mca/topo/base/topo_base_graph_create.c @@ -43,8 +43,8 @@ int mca_topo_base_graph_create(mca_topo_base_module_t *topo, ompi_communicator_t* old_comm, int nnodes, - int *index, - int *edges, + const int *index, + const int *edges, bool reorder, ompi_communicator_t** comm_topo) { diff --git a/ompi/mca/topo/base/topo_base_graph_map.c b/ompi/mca/topo/base/topo_base_graph_map.c index 80b8c02bdc..7cd738ba51 100644 --- a/ompi/mca/topo/base/topo_base_graph_map.c +++ b/ompi/mca/topo/base/topo_base_graph_map.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +40,7 @@ int mca_topo_base_graph_map(ompi_communicator_t * comm, int nnodes, - int *index, int *edges, int *newrank) + const int *index, const int *edges, int *newrank) { int myrank; diff --git a/ompi/mca/topo/topo.h b/ompi/mca/topo/topo.h index 173af72c8a..d4460793b3 100644 --- a/ompi/mca/topo/topo.h +++ b/ompi/mca/topo/topo.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. @@ -155,8 +155,8 @@ typedef int (*mca_topo_base_module_cart_create_fn_t) (mca_topo_base_module_t *topo_module, ompi_communicator_t* old_comm, int ndims, - int *dims, - int *periods, + const int *dims, + const int *periods, bool reorder, ompi_communicator_t** comm_topo); @@ -177,14 +177,14 @@ typedef int (*mca_topo_base_module_cartdim_get_fn_t) typedef int (*mca_topo_base_module_cart_map_fn_t) (struct ompi_communicator_t *comm, int ndims, - int *dims, - int *periods, + const int *dims, + const int *periods, int *newrank); /* Back end for MPI_CART_RANK */ typedef int (*mca_topo_base_module_cart_rank_fn_t) (struct ompi_communicator_t *comm, - int *coords, + const int *coords, int *rank); /* Back end for MPI_CART_SHIFT */ @@ -198,7 +198,7 @@ typedef int (*mca_topo_base_module_cart_shift_fn_t) /* Back end for MPI_CART_SUB */ typedef int (*mca_topo_base_module_cart_sub_fn_t) (struct ompi_communicator_t *comm, - int *remain_dims, + const int *remain_dims, struct ompi_communicator_t ** new_comm); /* Back end for MPI_GRAPH_CREATE */ @@ -206,8 +206,8 @@ typedef int (*mca_topo_base_module_graph_create_fn_t) (mca_topo_base_module_t *topo_module, ompi_communicator_t* old_comm, int nnodes, - int *index, - int *edges, + const int *index, + const int *edges, bool reorder, ompi_communicator_t** new_comm); @@ -223,8 +223,8 @@ typedef int (*mca_topo_base_module_graph_get_fn_t) typedef int (*mca_topo_base_module_graph_map_fn_t) (struct ompi_communicator_t *comm, int nnodes, - int *index, - int *edges, + const int *index, + const int *edges, int *newrank); /* Back end for MPI_GRAPHDIMS_GET */ @@ -250,8 +250,8 @@ typedef int (*mca_topo_base_module_graph_neighbors_count_fn_t) typedef int (*mca_topo_base_module_dist_graph_create_fn_t) (struct mca_topo_base_module_t* module, struct ompi_communicator_t *old_comm, - int n, int nodes[], - int degrees[], int targets[], int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], const int weights[], struct ompi_info_t *info, int reorder, struct ompi_communicator_t **new_comm); @@ -259,11 +259,11 @@ typedef int (*mca_topo_base_module_dist_graph_create_fn_t) typedef int (*mca_topo_base_module_dist_graph_create_adjacent_fn_t) (struct mca_topo_base_module_t* module, ompi_communicator_t *comm_old, - int indegree, int sources[], - int sourceweights[], + int indegree, const int sources[], + const int sourceweights[], int outdegree, - int destinations[], - int destweights[], + const int destinations[], + const int destweights[], struct ompi_info_t *info, int reorder, ompi_communicator_t **comm_dist_graph); diff --git a/ompi/mca/topo/treematch/topo_treematch.h b/ompi/mca/topo/treematch/topo_treematch.h index 42d12c54f3..7c11cdf542 100644 --- a/ompi/mca/topo/treematch/topo_treematch.h +++ b/ompi/mca/topo/treematch/topo_treematch.h @@ -4,6 +4,8 @@ * reserved. * Copyright (c) 2011-2015 INRIA. All rights reserved. * Copyright (c) 2011-2015 Bordeaux Polytechnic Institute + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,9 +66,9 @@ OBJ_CLASS_DECLARATION(mca_topo_treematch_module_t); int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* module, ompi_communicator_t *comm_old, - int n, int nodes[], - int degrees[], int targets[], - int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], + const int weights[], struct ompi_info_t *info, int reorder, ompi_communicator_t **newcomm); /* diff --git a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c index 725d6778f5..d66dcf746a 100644 --- a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c +++ b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c @@ -5,6 +5,8 @@ * Copyright (c) 2011-2015 INRIA. All rights reserved. * Copyright (c) 2012-2015 Bordeaux Poytechnic Institute * Copyright (c) 2015 Intel, Inc. All rights reserved + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -97,9 +99,9 @@ static int check_oversubscribing(int rank, int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, ompi_communicator_t *comm_old, - int n, int nodes[], - int degrees[], int targets[], - int weights[], + int n, const int nodes[], + const int degrees[], const int targets[], + const int weights[], struct ompi_info_t *info, int reorder, ompi_communicator_t **newcomm) { diff --git a/ompi/mpi/c/cart_create.c b/ompi/mpi/c/cart_create.c index eeedf011a0..fc93dd59a1 100644 --- a/ompi/mpi/c/cart_create.c +++ b/ompi/mpi/c/cart_create.c @@ -14,6 +14,8 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -100,9 +102,8 @@ int MPI_Cart_create(MPI_Comm old_comm, int ndims, const int dims[], } /* Now let that topology module rearrange procs/ranks if it wants to */ - /* XXX -- CONST -- do not cast away const -- update mca/topo */ err = topo->topo.cart.cart_create(topo, old_comm, - ndims, (int *) dims, (int *) periods, + ndims, dims, periods, (0 == reorder) ? false : true, comm_cart); OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/cart_map.c b/ompi/mpi/c/cart_map.c index b839843e44..e176acea21 100644 --- a/ompi/mpi/c/cart_map.c +++ b/ompi/mpi/c/cart_map.c @@ -14,6 +14,8 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -75,9 +77,8 @@ int MPI_Cart_map(MPI_Comm comm, int ndims, const int dims[], newrank = rank */ *newrank = ompi_comm_rank(comm); } else { - /* XXX -- CONST -- do not cast away const -- update mca/topo */ - err = comm->c_topo->topo.cart.cart_map(comm, ndims, (int *) dims, - (int *) periods, newrank); + err = comm->c_topo->topo.cart.cart_map(comm, ndims, dims, + periods, newrank); } OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/cart_rank.c b/ompi/mpi/c/cart_rank.c index 590a63f78a..cce97d413d 100644 --- a/ompi/mpi/c/cart_rank.c +++ b/ompi/mpi/c/cart_rank.c @@ -14,7 +14,7 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -100,8 +100,7 @@ int MPI_Cart_rank(MPI_Comm comm, const int coords[], int *rank) } OPAL_CR_ENTER_LIBRARY(); - /* XXX -- CONST -- do not cast away const -- update mca/topo */ - err = comm->c_topo->topo.cart.cart_rank(comm, (int *) coords, rank); + err = comm->c_topo->topo.cart.cart_rank(comm, coords, rank); OPAL_CR_EXIT_LIBRARY(); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/cart_sub.c b/ompi/mpi/c/cart_sub.c index 961cfe371d..af5768410f 100644 --- a/ompi/mpi/c/cart_sub.c +++ b/ompi/mpi/c/cart_sub.c @@ -14,7 +14,7 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -75,8 +75,7 @@ int MPI_Cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *new_comm) } OPAL_CR_ENTER_LIBRARY(); - /* XXX -- CONST -- do not cast away const -- update mca/topo */ - err = comm->c_topo->topo.cart.cart_sub(comm, (int *) remain_dims, new_comm); + err = comm->c_topo->topo.cart.cart_sub(comm, remain_dims, new_comm); OPAL_CR_EXIT_LIBRARY(); OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/dist_graph_create.c b/ompi/mpi/c/dist_graph_create.c index 8be9d6d05e..a578dce8fd 100644 --- a/ompi/mpi/c/dist_graph_create.c +++ b/ompi/mpi/c/dist_graph_create.c @@ -6,6 +6,8 @@ * Copyright (c) 2012-2013 Inria. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * */ @@ -83,9 +85,8 @@ int MPI_Dist_graph_create(MPI_Comm comm_old, int n, const int sources[], return OMPI_ERRHANDLER_INVOKE(comm_old, err, FUNC_NAME); } - /* XXX -- CONST -- do not cast away const -- update mca/topo */ - err = topo->topo.dist_graph.dist_graph_create(topo, comm_old, n, (int *) sources, (int *) degrees, - (int *) destinations, (int *) weights, info, + err = topo->topo.dist_graph.dist_graph_create(topo, comm_old, n, sources, degrees, + destinations, weights, info, reorder, newcomm); OMPI_ERRHANDLER_RETURN(err, comm_old, err, FUNC_NAME); } diff --git a/ompi/mpi/c/dist_graph_create_adjacent.c b/ompi/mpi/c/dist_graph_create_adjacent.c index b791c73fa1..0b8b31b125 100644 --- a/ompi/mpi/c/dist_graph_create_adjacent.c +++ b/ompi/mpi/c/dist_graph_create_adjacent.c @@ -10,6 +10,8 @@ * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * * Author(s): Torsten Hoefler * @@ -94,10 +96,9 @@ int MPI_Dist_graph_create_adjacent(MPI_Comm comm_old, return OMPI_ERRHANDLER_INVOKE(comm_old, err, FUNC_NAME); } - /* XXX -- CONST -- do not cast away const -- update mca/topo */ err = topo->topo.dist_graph.dist_graph_create_adjacent(topo, comm_old, indegree, - (int *) sources, (int *) sourceweights, outdegree, - (int *) destinations, (int *) destweights, info, + sources, sourceweights, outdegree, + destinations, destweights, info, reorder, comm_dist_graph); OMPI_ERRHANDLER_RETURN(err, comm_old, err, FUNC_NAME); } diff --git a/ompi/mpi/c/graph_create.c b/ompi/mpi/c/graph_create.c index de4d0b094e..32dcb3b412 100644 --- a/ompi/mpi/c/graph_create.c +++ b/ompi/mpi/c/graph_create.c @@ -14,6 +14,8 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -100,9 +102,8 @@ int MPI_Graph_create(MPI_Comm old_comm, int nnodes, const int indx[], } /* Now let that topology module rearrange procs/ranks if it wants to */ - /* XXX -- CONST -- do not cast away const -- update mca/topo */ err = topo->topo.graph.graph_create(topo, old_comm, - nnodes, (int *) indx, (int *) edges, + nnodes, indx, edges, (0 == reorder) ? false : true, comm_graph); OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/graph_map.c b/ompi/mpi/c/graph_map.c index 6e554f0ba3..d3bc762ff2 100644 --- a/ompi/mpi/c/graph_map.c +++ b/ompi/mpi/c/graph_map.c @@ -14,6 +14,8 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -75,8 +77,7 @@ int MPI_Graph_map(MPI_Comm comm, int nnodes, const int indx[], const int edges[] newrank = rank */ *newrank = ompi_comm_rank(comm); } else { - /* XXX -- CONST -- do not cast away const -- update mca/topo */ - err = comm->c_topo->topo.graph.graph_map(comm, nnodes, (int *) indx, (int *) edges, newrank); + err = comm->c_topo->topo.graph.graph_map(comm, nnodes, indx, edges, newrank); } OPAL_CR_EXIT_LIBRARY();