1 /* 2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana 3 * University Research and Technology 4 * Corporation. All rights reserved. 5 * Copyright (c) 2004-2013 The University of Tennessee and The University 6 * of Tennessee Research Foundation. All rights 7 * reserved. 8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 9 * University of Stuttgart. All rights reserved. 10 * Copyright (c) 2004-2005 The Regents of the University of California. 11 * All rights reserved. 12 * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. 13 * Copyright (c) 2012-2013 Inria. All rights reserved. 14 * $COPYRIGHT$ 15 * 16 * Additional copyrights may follow 17 * 18 * $HEADER$ 19 */ 20 21 #include "ompi_config.h" 22 23 #include <string.h> 24 25 #include "ompi/mca/topo/base/base.h" 26 #include "ompi/communicator/communicator.h" 27 28 /* 29 * function - retrieves Cartesian topology information associated with a 30 * communicator 31 * 32 * @param comm communicator with cartesian structure (handle) 33 * @param maxdims length of vectors 'dims', 'periods', and 'coords' 34 * in the calling program (integer) 35 * @param dims number of processes for each cartesian dimension (array of integer) 36 * @param periods periodicity (true/false) for each cartesian dimension 37 * (array of logical) 38 * @param coords coordinates of calling process in cartesian structure 39 * (array of integer) 40 * 41 * @retval MPI_SUCCESS 42 */ 43 int mca_topo_base_cart_get(ompi_communicator_t* comm, 44 int maxdims, 45 int *dims, 46 int *periods, 47 int *coords) 48 { 49 int m = (maxdims <= comm->c_topo->mtc.cart->ndims) ? 50 maxdims : comm->c_topo->mtc.cart->ndims; 51 52 memcpy(dims, comm->c_topo->mtc.cart->dims, m * sizeof(int)); 53 memcpy(periods, comm->c_topo->mtc.cart->periods, m * sizeof(int)); 54 memcpy(coords, comm->c_topo->mtc.cart->coords, m * sizeof(int)); 55 56 return MPI_SUCCESS; 57 }