|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpiimpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* -- Begin Profiling Symbol Block for routine MPI_Cart_create */
|
|
Packit Service |
c5cf8c |
#if defined(HAVE_PRAGMA_WEAK)
|
|
Packit Service |
c5cf8c |
#pragma weak MPI_Cart_create = PMPI_Cart_create
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
|
|
Packit Service |
c5cf8c |
#pragma _HP_SECONDARY_DEF PMPI_Cart_create MPI_Cart_create
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_PRAGMA_CRI_DUP)
|
|
Packit Service |
c5cf8c |
#pragma _CRI duplicate MPI_Cart_create as PMPI_Cart_create
|
|
Packit Service |
c5cf8c |
#elif defined(HAVE_WEAK_ATTRIBUTE)
|
|
Packit Service |
c5cf8c |
int MPI_Cart_create(MPI_Comm comm_old, int ndims, const int dims[], const int periods[],
|
|
Packit Service |
c5cf8c |
int reorder, MPI_Comm * comm_cart)
|
|
Packit Service |
c5cf8c |
__attribute__ ((weak, alias("PMPI_Cart_create")));
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
/* -- End Profiling Symbol Block */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
|
|
Packit Service |
c5cf8c |
the MPI routines */
|
|
Packit Service |
c5cf8c |
#ifndef MPICH_MPI_FROM_PMPI
|
|
Packit Service |
c5cf8c |
#undef MPI_Cart_create
|
|
Packit Service |
c5cf8c |
#define MPI_Cart_create PMPI_Cart_create
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
|
|
Packit Service |
c5cf8c |
the MPI routines */
|
|
Packit Service |
c5cf8c |
#ifndef MPICH_MPI_FROM_PMPI
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPIR_Cart_create
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
int MPIR_Cart_create(MPIR_Comm * comm_ptr, int ndims, const int dims[],
|
|
Packit Service |
c5cf8c |
const int periods[], int reorder, MPI_Comm * comm_cart)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int i, newsize, rank, nranks, mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
MPIR_Comm *newcomm_ptr = NULL;
|
|
Packit Service |
c5cf8c |
MPIR_Topology *cart_ptr = NULL;
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_DECL(4);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Set this as null incase we exit with an error */
|
|
Packit Service |
c5cf8c |
*comm_cart = MPI_COMM_NULL;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Check for invalid arguments */
|
|
Packit Service |
c5cf8c |
newsize = 1;
|
|
Packit Service |
c5cf8c |
for (i = 0; i < ndims; i++)
|
|
Packit Service |
c5cf8c |
newsize *= dims[i];
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Use ERR_ARG instead of ERR_TOPOLOGY because there is no topology yet */
|
|
Packit Service |
c5cf8c |
MPIR_ERR_CHKANDJUMP2((newsize > comm_ptr->remote_size), mpi_errno,
|
|
Packit Service |
c5cf8c |
MPI_ERR_ARG, "**cartdim",
|
|
Packit Service |
c5cf8c |
"**cartdim %d %d", comm_ptr->remote_size, newsize);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (ndims == 0) {
|
|
Packit Service |
c5cf8c |
/* specified as a 0D Cartesian topology in MPI 2.1.
|
|
Packit Service |
c5cf8c |
* Rank 0 returns a dup of COMM_SELF with the topology info attached.
|
|
Packit Service |
c5cf8c |
* Others return MPI_COMM_NULL. */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
rank = comm_ptr->rank;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (rank == 0) {
|
|
Packit Service |
c5cf8c |
MPIR_Comm *comm_self_ptr;
|
|
Packit Service |
c5cf8c |
MPIR_Comm_get_ptr(MPI_COMM_SELF, comm_self_ptr);
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Comm_dup_impl(comm_self_ptr, &newcomm_ptr);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Create the topology structure */
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr, MPIR_Topology *, sizeof(MPIR_Topology),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart_ptr", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
cart_ptr->kind = MPI_CART;
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.nnodes = 1;
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.ndims = 0;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* make mallocs of size 1 int so that they get freed as part of the
|
|
Packit Service |
c5cf8c |
* normal free mechanism */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr->topo.cart.dims, int *, sizeof(int),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart.dims", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr->topo.cart.periodic, int *, sizeof(int),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart.periodic", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr->topo.cart.position, int *, sizeof(int),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart.position", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
*comm_cart = MPI_COMM_NULL;
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Create a new communicator as a duplicate of the input communicator
|
|
Packit Service |
c5cf8c |
* (but do not duplicate the attributes) */
|
|
Packit Service |
c5cf8c |
if (reorder) {
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Allow the cart map routine to remap the assignment of ranks to
|
|
Packit Service |
c5cf8c |
* processes */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Cart_map_impl(comm_ptr, ndims, (const int *) dims,
|
|
Packit Service |
c5cf8c |
(const int *) periods, &rank;;
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Create the new communicator with split, since we need to reorder
|
|
Packit Service |
c5cf8c |
* the ranks (including the related internals, such as the connection
|
|
Packit Service |
c5cf8c |
* tables */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Comm_split_impl(comm_ptr,
|
|
Packit Service |
c5cf8c |
rank == MPI_UNDEFINED ? MPI_UNDEFINED : 1,
|
|
Packit Service |
c5cf8c |
rank, &newcomm_ptr);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPII_Comm_copy((MPIR_Comm *) comm_ptr, newsize, &newcomm_ptr);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
rank = comm_ptr->rank;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* If this process is not in the resulting communicator, return a
|
|
Packit Service |
c5cf8c |
* null communicator and exit */
|
|
Packit Service |
c5cf8c |
if (rank >= newsize || rank == MPI_UNDEFINED) {
|
|
Packit Service |
c5cf8c |
*comm_cart = MPI_COMM_NULL;
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Create the topololgy structure */
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr, MPIR_Topology *, sizeof(MPIR_Topology),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart_ptr", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
cart_ptr->kind = MPI_CART;
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.nnodes = newsize;
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.ndims = ndims;
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr->topo.cart.dims, int *, ndims * sizeof(int),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart.dims", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr->topo.cart.periodic, int *, ndims * sizeof(int),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart.periodic", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_MALLOC(cart_ptr->topo.cart.position, int *, ndims * sizeof(int),
|
|
Packit Service |
c5cf8c |
mpi_errno, "cart.position", MPL_MEM_COMM);
|
|
Packit Service |
c5cf8c |
nranks = newsize;
|
|
Packit Service |
c5cf8c |
for (i = 0; i < ndims; i++) {
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.dims[i] = dims[i];
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.periodic[i] = periods[i];
|
|
Packit Service |
c5cf8c |
nranks = nranks / dims[i];
|
|
Packit Service |
c5cf8c |
/* FIXME: nranks could be zero (?) */
|
|
Packit Service |
c5cf8c |
cart_ptr->topo.cart.position[i] = rank / nranks;
|
|
Packit Service |
c5cf8c |
rank = rank % nranks;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Place this topology onto the communicator */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Topology_put(newcomm_ptr, cart_ptr);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_OBJ_PUBLISH_HANDLE(*comm_cart, newcomm_ptr->handle);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
MPIR_CHKPMEM_REAP();
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPIR_Cart_create_impl
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
int MPIR_Cart_create_impl(MPIR_Comm * comm_ptr, int ndims, const int dims[],
|
|
Packit Service |
c5cf8c |
const int periods[], int reorder, MPI_Comm * comm_cart)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (comm_ptr->topo_fns != NULL && comm_ptr->topo_fns->cartCreate != NULL) {
|
|
Packit Service |
c5cf8c |
/* --BEGIN USEREXTENSION-- */
|
|
Packit Service |
c5cf8c |
mpi_errno = comm_ptr->topo_fns->cartCreate(comm_ptr, ndims,
|
|
Packit Service |
c5cf8c |
(const int *) dims,
|
|
Packit Service |
c5cf8c |
(const int *) periods, reorder, comm_cart);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
/* --END USEREXTENSION-- */
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Cart_create(comm_ptr, ndims,
|
|
Packit Service |
c5cf8c |
(const int *) dims, (const int *) periods, reorder, comm_cart);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
MPIR_ERR_POP(mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#undef FUNCNAME
|
|
Packit Service |
c5cf8c |
#define FUNCNAME MPI_Cart_create
|
|
Packit Service |
c5cf8c |
#undef FCNAME
|
|
Packit Service |
c5cf8c |
#define FCNAME MPL_QUOTE(FUNCNAME)
|
|
Packit Service |
c5cf8c |
/*@
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Cart_create - Makes a new communicator to which topology information
|
|
Packit Service |
c5cf8c |
has been attached
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Input Parameters:
|
|
Packit Service |
c5cf8c |
+ comm_old - input communicator (handle)
|
|
Packit Service |
c5cf8c |
. ndims - number of dimensions of cartesian grid (integer)
|
|
Packit Service |
c5cf8c |
. dims - integer array of size ndims specifying the number of processes in
|
|
Packit Service |
c5cf8c |
each dimension
|
|
Packit Service |
c5cf8c |
. periods - logical array of size ndims specifying whether the grid is
|
|
Packit Service |
c5cf8c |
periodic (true) or not (false) in each dimension
|
|
Packit Service |
c5cf8c |
- reorder - ranking may be reordered (true) or not (false) (logical)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Output Parameters:
|
|
Packit Service |
c5cf8c |
. comm_cart - communicator with new cartesian topology (handle)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Algorithm:
|
|
Packit Service |
c5cf8c |
We ignore 'reorder' info currently.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N ThreadSafe
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N Fortran
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
.N Errors
|
|
Packit Service |
c5cf8c |
.N MPI_SUCCESS
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_TOPOLOGY
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_DIMS
|
|
Packit Service |
c5cf8c |
.N MPI_ERR_ARG
|
|
Packit Service |
c5cf8c |
@*/
|
|
Packit Service |
c5cf8c |
int MPI_Cart_create(MPI_Comm comm_old, int ndims, const int dims[],
|
|
Packit Service |
c5cf8c |
const int periods[], int reorder, MPI_Comm * comm_cart)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int mpi_errno = MPI_SUCCESS;
|
|
Packit Service |
c5cf8c |
MPIR_Comm *comm_ptr = NULL;
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_CART_CREATE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_INITIALIZED_ORDIE();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_CART_CREATE);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Validate parameters, especially handles needing to be converted */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPID_BEGIN_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_COMM(comm_old, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPID_END_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Convert MPI object handles to object pointers */
|
|
Packit Service |
c5cf8c |
MPIR_Comm_get_ptr(comm_old, comm_ptr);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Validate parameters and objects (post conversion) */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPID_BEGIN_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
/* Validate comm_ptr */
|
|
Packit Service |
c5cf8c |
MPIR_Comm_valid_ptr(comm_ptr, mpi_errno, FALSE);
|
|
Packit Service |
c5cf8c |
if (mpi_errno != MPI_SUCCESS)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
/* If comm_ptr is not valid, it will be reset to null */
|
|
Packit Service |
c5cf8c |
if (comm_ptr) {
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_COMM_INTRA(comm_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if (ndims > 0) {
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_ARGNULL(dims, "dims", mpi_errno);
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_ARGNULL(periods, "periods", mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_ARGNULL(comm_cart, "comm_cart", mpi_errno);
|
|
Packit Service |
c5cf8c |
if (ndims < 0) {
|
|
Packit Service |
c5cf8c |
/* Must have a non-negative number of dimensions */
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Err_create_code(MPI_SUCCESS,
|
|
Packit Service |
c5cf8c |
MPIR_ERR_RECOVERABLE, FCNAME, __LINE__,
|
|
Packit Service |
c5cf8c |
MPI_ERR_DIMS, "**dims", "**dims %d", 0);
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_ARGNEG(ndims, "ndims", mpi_errno);
|
|
Packit Service |
c5cf8c |
if (comm_ptr) {
|
|
Packit Service |
c5cf8c |
MPIR_ERRTEST_COMM_INTRA(comm_ptr, mpi_errno);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MPID_END_ERROR_CHECKS;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif /* HAVE_ERROR_CHECKING */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* ... body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Cart_create_impl(comm_ptr, ndims,
|
|
Packit Service |
c5cf8c |
(const int *) dims,
|
|
Packit Service |
c5cf8c |
(const int *) periods, reorder, comm_cart);
|
|
Packit Service |
c5cf8c |
if (mpi_errno)
|
|
Packit Service |
c5cf8c |
goto fn_fail;
|
|
Packit Service |
c5cf8c |
/* ... end of body of routine ... */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_exit:
|
|
Packit Service |
c5cf8c |
MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_CART_CREATE);
|
|
Packit Service |
c5cf8c |
MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
|
|
Packit Service |
c5cf8c |
return mpi_errno;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
fn_fail:
|
|
Packit Service |
c5cf8c |
/* --BEGIN ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_ERROR_CHECKING
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
mpi_errno =
|
|
Packit Service |
c5cf8c |
MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
|
|
Packit Service |
c5cf8c |
"**mpi_cart_create", "**mpi_cart_create %C %d %p %p %d %p",
|
|
Packit Service |
c5cf8c |
comm_old, ndims, dims, periods, reorder, comm_cart);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
mpi_errno = MPIR_Err_return_comm(comm_ptr, FCNAME, mpi_errno);
|
|
Packit Service |
c5cf8c |
/* --END ERROR HANDLING-- */
|
|
Packit Service |
c5cf8c |
goto fn_exit;
|
|
Packit Service |
c5cf8c |
}
|