root/ompi/mca/topo/base/topo_base_dist_graph_neighbors.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_topo_base_dist_graph_neighbors

   1 /*
   2  * Copyright (c) 2008      The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2009      Cisco Systems, Inc.  All rights reserved.
   6  * Copyright (c) 2011-2013 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2011-2013 Inria.  All rights reserved.
  10  * Copyright (c) 2011-2013 Universite Bordeaux 1
  11  * Copyright (c) 2014-2016 Research Organization for Information Science
  12  *                         and Technology (RIST). All rights reserved.
  13  */
  14 
  15 #include "ompi_config.h"
  16 
  17 #include "ompi/communicator/communicator.h"
  18 #include "ompi/info/info.h"
  19 #include "ompi/mca/topo/base/base.h"
  20 
  21 
  22 int mca_topo_base_dist_graph_neighbors(ompi_communicator_t *comm,
  23                                        int maxindegree,
  24                                        int sources[], int sourceweights[],
  25                                        int maxoutdegree, int destinations[],
  26                                        int destweights[])
  27 {
  28     mca_topo_base_comm_dist_graph_2_2_0_t *dg = comm->c_topo->mtc.dist_graph;
  29     int i;
  30 
  31     if (!OMPI_COMM_IS_DIST_GRAPH(comm)) {
  32         return OMPI_ERR_NOT_FOUND;
  33     }
  34     if (maxindegree > dg->indegree) {
  35         maxindegree = dg->indegree;
  36     }
  37     if (maxoutdegree > dg->outdegree) {
  38         maxoutdegree = dg->outdegree;
  39     }
  40 
  41     for (i = 0; i < maxindegree; ++i) {
  42         sources[i] = dg->in[i];
  43         if (MPI_UNWEIGHTED != sourceweights && NULL != dg->inw) {
  44             sourceweights[i] = dg->inw[i];
  45         }
  46     }
  47     for (i = 0; i < maxoutdegree; ++i) {
  48         destinations[i] = dg->out[i];
  49         if (MPI_UNWEIGHTED != destweights && NULL != dg->outw) {
  50             destweights[i] = dg->outw[i];
  51         }
  52     }
  53 
  54     return MPI_SUCCESS;
  55 }
  56 

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