This source file includes following definitions.
- MPI_Dist_graph_create_adjacent
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 #include "ompi_config.h"
  25 
  26 #include "ompi/mpi/c/bindings.h"
  27 #include "ompi/runtime/params.h"
  28 #include "ompi/communicator/communicator.h"
  29 #include "ompi/errhandler/errhandler.h"
  30 #include "ompi/memchecker.h"
  31 #include "ompi/mca/topo/topo.h"
  32 #include "ompi/mca/topo/base/base.h"
  33 
  34 #if OMPI_BUILD_MPI_PROFILING
  35 #if OPAL_HAVE_WEAK_SYMBOLS
  36 #pragma weak MPI_Dist_graph_create_adjacent = PMPI_Dist_graph_create_adjacent
  37 #endif
  38 #define MPI_Dist_graph_create_adjacent PMPI_Dist_graph_create_adjacent
  39 #endif
  40 
  41 static const char FUNC_NAME[] = "MPI_Dist_graph_create_adjacent";
  42 
  43 
  44 int MPI_Dist_graph_create_adjacent(MPI_Comm comm_old,
  45                                    int indegree, const int sources[],
  46                                    const int sourceweights[], int outdegree,
  47                                    const int destinations[], const int destweights[],
  48                                    MPI_Info info, int reorder,
  49                                    MPI_Comm *comm_dist_graph)
  50 {
  51     mca_topo_base_module_t* topo;
  52     int i, comm_size, err;
  53 
  54     MEMCHECKER(
  55         memchecker_comm(comm_old);
  56     );
  57 
  58     if (MPI_PARAM_CHECK) {
  59         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  60         if (ompi_comm_invalid(comm_old)) {
  61             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  62                                           FUNC_NAME);
  63         } else if (OMPI_COMM_IS_INTER(comm_old)) {
  64             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  65                                           FUNC_NAME);
  66         } else if (indegree < 0 || outdegree < 0 || NULL == comm_dist_graph) {
  67             return OMPI_ERRHANDLER_INVOKE(comm_old, MPI_ERR_ARG,
  68                                           "MPI_Dist_graph_create_adjacent negative degree");
  69         } else if ((indegree > 0 &&
  70                     (NULL == sources || NULL == sourceweights)) ||
  71                    (outdegree > 0 &&
  72                     (NULL == destinations || NULL == destweights))) {
  73             return OMPI_ERRHANDLER_INVOKE(comm_old, MPI_ERR_ARG, "MPI_Dist_graph_create_adjacent mismatched sources or destinations");
  74         }
  75         comm_size = ompi_comm_size(comm_old);
  76         for (i = 0; i < indegree; ++i) {
  77             if (((sources[i] < 0) && (sources[i] != MPI_PROC_NULL)) || sources[i] >= comm_size) {
  78                 return OMPI_ERRHANDLER_INVOKE(comm_old, MPI_ERR_ARG,
  79                                               "MPI_Dist_graph_create_adjacent invalid sources");
  80             } else if (MPI_UNWEIGHTED != sourceweights && sourceweights[i] < 0) {
  81                 return OMPI_ERRHANDLER_INVOKE(comm_old, MPI_ERR_ARG,
  82                                               "MPI_Dist_graph_create_adjacent invalid sourceweights");
  83             }
  84         }
  85         for (i = 0; i < outdegree; ++i) {
  86             if (((destinations[i] < 0) && (destinations[i] != MPI_PROC_NULL)) || destinations[i] >= comm_size) {
  87                 return OMPI_ERRHANDLER_INVOKE(comm_old, MPI_ERR_ARG,
  88                                               "MPI_Dist_graph_create_adjacent invalid destinations");
  89             } else if (MPI_UNWEIGHTED != destweights && destweights[i] < 0) {
  90                 return OMPI_ERRHANDLER_INVOKE(comm_old, MPI_ERR_ARG,
  91                                               "MPI_Dist_graph_create_adjacent invalid destweights");
  92             }
  93         }
  94     }
  95 
  96     
  97     if(OMPI_SUCCESS != (err = mca_topo_base_comm_select(comm_old, NULL,
  98                                                         &topo, OMPI_COMM_DIST_GRAPH))) {
  99         return OMPI_ERRHANDLER_INVOKE(comm_old, err, FUNC_NAME);
 100     }
 101 
 102     err = topo->topo.dist_graph.dist_graph_create_adjacent(topo, comm_old, indegree,
 103                                                            sources, sourceweights, outdegree,
 104                                                            destinations, destweights, &(info->super),
 105                                                            reorder, comm_dist_graph);
 106     OMPI_ERRHANDLER_RETURN(err, comm_old, err, FUNC_NAME);
 107 }
 108