root/ompi/mpi/fortran/mpif-h/dist_graph_create_adjacent_f.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_dist_graph_create_adjacent_f

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2011-2013 The University of Tennessee and The University
   4  *                         of Tennessee Research Foundation.  All rights
   5  *                         reserved.
   6  * Copyright (c) 2011-2013 Inria.  All rights reserved.
   7  * Copyright (c) 2011-2013 Université Bordeaux 1
   8  * Copyright (c) 2013-2014 Cisco Systems, Inc.  All rights reserved.
   9  * Copyright (c) 2014      Los Alamos National Security, LLC. All rights
  10  *                         reserved.
  11  * Copyright (c) 2015      Research Organization for Information Science
  12  *                         and Technology (RIST). All rights reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include "ompi_config.h"
  21 
  22 #include "ompi/mpi/fortran/mpif-h/bindings.h"
  23 #include "ompi/mpi/fortran/base/constants.h"
  24 
  25 #if OMPI_BUILD_MPI_PROFILING
  26 #if OPAL_HAVE_WEAK_SYMBOLS
  27 #pragma weak PMPI_DIST_GRAPH_CREATE_ADJACENT = ompi_dist_graph_create_adjacent_f
  28 #pragma weak pmpi_dist_graph_create_adjacent = ompi_dist_graph_create_adjacent_f
  29 #pragma weak pmpi_dist_graph_create_adjacent_ = ompi_dist_graph_create_adjacent_f
  30 #pragma weak pmpi_dist_graph_create_adjacent__ = ompi_dist_graph_create_adjacent_f
  31 
  32 #pragma weak PMPI_Dist_graph_create_adjacent_f = ompi_dist_graph_create_adjacent_f
  33 #pragma weak PMPI_Dist_graph_create_adjacent_f08 = ompi_dist_graph_create_adjacent_f
  34 #else
  35 OMPI_GENERATE_F77_BINDINGS (PMPI_DIST_GRAPH_CREATE_ADJACENT,
  36                             pmpi_dist_graph_create_adjacent,
  37                             pmpi_dist_graph_create_adjacent_,
  38                             pmpi_dist_graph_create_adjacent__,
  39                             pompi_dist_graph_create_adjacent_f,
  40                             (MPI_Fint *comm_old, MPI_Fint *indegree,  MPI_Fint *sources, MPI_Fint *sourceweights, MPI_Fint *outdegree,  MPI_Fint *destinations, MPI_Fint *destweights, MPI_Fint *info, ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph, MPI_Fint *ierr),
  41                             (comm_old, indegree, sources, sourceweights, outdegree, destinations, destweights, info, reorder, comm_graph, ierr) )
  42 #endif
  43 #endif
  44 
  45 #if OPAL_HAVE_WEAK_SYMBOLS
  46 #pragma weak MPI_DIST_GRAPH_CREATE_ADJACENT = ompi_dist_graph_create_adjacent_f
  47 #pragma weak mpi_dist_graph_create_adjacent = ompi_dist_graph_create_adjacent_f
  48 #pragma weak mpi_dist_graph_create_adjacent_ = ompi_dist_graph_create_adjacent_f
  49 #pragma weak mpi_dist_graph_create_adjacent__ = ompi_dist_graph_create_adjacent_f
  50 
  51 #pragma weak MPI_Dist_graph_create_adjacent_f = ompi_dist_graph_create_adjacent_f
  52 #pragma weak MPI_Dist_graph_create_adjacent_f08 = ompi_dist_graph_create_adjacent_f
  53 #else
  54 #if ! OMPI_BUILD_MPI_PROFILING
  55 OMPI_GENERATE_F77_BINDINGS (MPI_DIST_GRAPH_CREATE_ADJACENT,
  56                             mpi_dist_graph_create_adjacent,
  57                             mpi_dist_graph_create_adjacent_,
  58                             mpi_dist_graph_create_adjacent__,
  59                             ompi_dist_graph_create_adjacent_f,
  60                             (MPI_Fint *comm_old, MPI_Fint *indegree,  MPI_Fint *sources, MPI_Fint *sourceweights, MPI_Fint *outdegree,  MPI_Fint *destinations, MPI_Fint *destweights, MPI_Fint *info, ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph, MPI_Fint *ierr),
  61                             (comm_old, indegree,  sources, sourceweights, outdegree, destinations, destweights, info, reorder, comm_graph, ierr) )
  62 #endif
  63 
  64 #if OMPI_BUILD_MPI_PROFILING && ! OPAL_HAVE_WEAK_SYMBOLS
  65 #define ompi_dist_graph_create_adjacent_f pompi_dist_graph_create_adjacent_f
  66 #endif
  67 #endif
  68 
  69 
  70 
  71 void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree,
  72                                        MPI_Fint *sources, MPI_Fint *sourceweights,
  73                                        MPI_Fint *outdegree,
  74                                        MPI_Fint *destinations, MPI_Fint *destweights, MPI_Fint *info,
  75                                        ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph,
  76                                        MPI_Fint *ierr)
  77 {
  78     MPI_Info c_info;
  79     MPI_Comm c_comm_old, c_comm_graph;
  80     int *c_destweights, *c_sourceweights;
  81 
  82     OMPI_ARRAY_NAME_DECL(sources);
  83     OMPI_ARRAY_NAME_DECL(destinations);
  84 
  85     c_comm_old = PMPI_Comm_f2c(*comm_old);
  86     c_info = PMPI_Info_f2c(*info);
  87 
  88     OMPI_ARRAY_FINT_2_INT(sources, *indegree);
  89     if (OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights)) {
  90         c_sourceweights = MPI_UNWEIGHTED;
  91     } else if (OMPI_IS_FORTRAN_WEIGHTS_EMPTY(sourceweights)) {
  92         c_sourceweights = MPI_WEIGHTS_EMPTY;
  93     } else {
  94         OMPI_ARRAY_FINT_2_INT(sourceweights, *indegree);
  95         c_sourceweights = OMPI_ARRAY_NAME_CONVERT(sourceweights);
  96     }
  97 
  98     OMPI_ARRAY_FINT_2_INT(destinations, *outdegree);
  99     if (OMPI_IS_FORTRAN_UNWEIGHTED(destweights)) {
 100         c_destweights = MPI_UNWEIGHTED;
 101     } else if (OMPI_IS_FORTRAN_WEIGHTS_EMPTY(destweights)) {
 102         c_destweights = MPI_WEIGHTS_EMPTY;
 103     } else {
 104         OMPI_ARRAY_FINT_2_INT(destweights, *indegree);
 105         c_destweights = OMPI_ARRAY_NAME_CONVERT(destweights);
 106     }
 107 
 108     *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree),
 109                                                             OMPI_ARRAY_NAME_CONVERT(sources),
 110                                                             c_sourceweights,
 111                                                             OMPI_FINT_2_INT(*outdegree),
 112                                                             OMPI_ARRAY_NAME_CONVERT(destinations),
 113                                                             c_destweights,
 114                                                             c_info,
 115                                                             OMPI_LOGICAL_2_INT(*reorder),
 116                                                             &c_comm_graph));
 117     if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
 118         *comm_graph = PMPI_Comm_c2f(c_comm_graph);
 119     }
 120 
 121     OMPI_ARRAY_FINT_2_INT_CLEANUP(sources);
 122     if( MPI_UNWEIGHTED != c_sourceweights && MPI_WEIGHTS_EMPTY != c_sourceweights ) {
 123         OMPI_ARRAY_FINT_2_INT_CLEANUP(sourceweights);
 124     }
 125     OMPI_ARRAY_FINT_2_INT_CLEANUP(destinations);
 126     if( MPI_UNWEIGHTED != c_destweights && MPI_WEIGHTS_EMPTY != c_destweights ) {
 127         OMPI_ARRAY_FINT_2_INT_CLEANUP(destweights);
 128     }
 129 }

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