root/ompi/mpi/c/cart_map.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Cart_map

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2013 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2012-2013 Los Alamos National Security, LLC.  All rights
  15  *                         reserved.
  16  * Copyright (c) 2012-2013 Inria.  All rights reserved.
  17  * Copyright (c) 2015      Research Organization for Information Science
  18  *                         and Technology (RIST). All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 #include "ompi_config.h"
  26 #include <stdio.h>
  27 
  28 #include "ompi/mpi/c/bindings.h"
  29 #include "ompi/runtime/params.h"
  30 #include "ompi/communicator/communicator.h"
  31 #include "ompi/errhandler/errhandler.h"
  32 #include "ompi/mca/topo/topo.h"
  33 #include "ompi/memchecker.h"
  34 
  35 #if OMPI_BUILD_MPI_PROFILING
  36 #if OPAL_HAVE_WEAK_SYMBOLS
  37 #pragma weak MPI_Cart_map = PMPI_Cart_map
  38 #endif
  39 #define MPI_Cart_map PMPI_Cart_map
  40 #endif
  41 
  42 static const char FUNC_NAME[] = "MPI_Cart_map";
  43 
  44 
  45 int MPI_Cart_map(MPI_Comm comm, int ndims, const int dims[],
  46                  const int periods[], int *newrank)
  47 {
  48     int err = MPI_SUCCESS;
  49 
  50     MEMCHECKER(
  51         memchecker_comm(comm);
  52     );
  53 
  54     /* check the arguments */
  55     if (MPI_PARAM_CHECK) {
  56         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  57         if (ompi_comm_invalid(comm)) {
  58             return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM,
  59                                           FUNC_NAME);
  60         }
  61         if (OMPI_COMM_IS_INTER(comm)) {
  62             return OMPI_ERRHANDLER_INVOKE (comm, MPI_ERR_COMM,
  63                                           FUNC_NAME);
  64         }
  65         if ((NULL == dims) || (NULL == periods) || (NULL == newrank)) {
  66             return OMPI_ERRHANDLER_INVOKE (comm, MPI_ERR_ARG,
  67                                           FUNC_NAME);
  68         }
  69     }
  70 
  71     OPAL_CR_ENTER_LIBRARY();
  72 
  73     if(!OMPI_COMM_IS_CART(comm)) {
  74         /* In case the communicator has no topo-module attached to
  75            it, we just return the "default" value suggested by MPI:
  76            newrank = rank */
  77         *newrank = ompi_comm_rank(comm);
  78     } else {
  79         err = comm->c_topo->topo.cart.cart_map(comm, ndims, dims,
  80                                                periods, newrank);
  81     }
  82 
  83     OPAL_CR_EXIT_LIBRARY();
  84     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
  85 }

/* [<][>][^][v][top][bottom][index][help] */