2004-03-06 22:40:26 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2013-07-01 12:40:08 +00:00
|
|
|
* Copyright (c) 2004-2013 The University of Tennessee and The University
|
2005-11-05 19:57:48 +00:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2008-03-05 12:22:34 +00:00
|
|
|
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
2014-05-16 22:23:52 +00:00
|
|
|
* Copyright (c) 2012-2013 Inria. All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-03-06 22:40:26 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 01:03:09 +00:00
|
|
|
#include "ompi_config.h"
|
2008-03-05 12:22:34 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "ompi/mca/topo/base/base.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
2004-03-06 22:40:26 +00:00
|
|
|
|
2004-03-08 06:48:24 +00:00
|
|
|
/*
|
|
|
|
* function - retrieves Cartesian topology information associated with a
|
|
|
|
* communicator
|
|
|
|
*
|
|
|
|
* @param comm communicator with cartesian structure (handle)
|
|
|
|
* @param maxdims length of vectors 'dims', 'periods', and 'coords'
|
|
|
|
* in the calling program (integer)
|
|
|
|
* @param dims number of processes for each cartesian dimension (array of integer)
|
|
|
|
* @param periods periodicity (true/false) for each cartesian dimension
|
|
|
|
* (array of logical)
|
|
|
|
* @param coords coordinates of calling process in cartesian structure
|
|
|
|
* (array of integer)
|
|
|
|
*
|
|
|
|
* @retval MPI_SUCCESS
|
|
|
|
*/
|
2013-07-01 12:40:08 +00:00
|
|
|
int mca_topo_base_cart_get(ompi_communicator_t* comm,
|
|
|
|
int maxdims,
|
|
|
|
int *dims,
|
|
|
|
int *periods,
|
|
|
|
int *coords)
|
2008-03-05 12:22:34 +00:00
|
|
|
{
|
2013-07-01 12:40:08 +00:00
|
|
|
int m = (maxdims <= comm->c_topo->mtc.cart->ndims) ?
|
|
|
|
maxdims : comm->c_topo->mtc.cart->ndims;
|
2004-07-20 22:32:45 +00:00
|
|
|
|
2013-07-01 12:40:08 +00:00
|
|
|
memcpy(dims, comm->c_topo->mtc.cart->dims, m * sizeof(int));
|
|
|
|
memcpy(periods, comm->c_topo->mtc.cart->periods, m * sizeof(int));
|
|
|
|
memcpy(coords, comm->c_topo->mtc.cart->coords, m * sizeof(int));
|
2004-03-08 06:48:24 +00:00
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|