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

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_dist_graph_create_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) 2014      Los Alamos National Security, LLC. All rights
   9  *                         reserved.
  10  * Copyright (c) 2015      Research Organization for Information Science
  11  *                         and Technology (RIST). All rights reserved.
  12  * $COPYRIGHT$
  13  *
  14  * Additional copyrights may follow
  15  *
  16  * $HEADER$
  17  */
  18 
  19 #include "ompi_config.h"
  20 
  21 #include "ompi/mpi/fortran/mpif-h/bindings.h"
  22 #include "ompi/mpi/fortran/base/constants.h"
  23 
  24 #if OMPI_BUILD_MPI_PROFILING
  25 #if OPAL_HAVE_WEAK_SYMBOLS
  26 #pragma weak PMPI_DIST_GRAPH_CREATE = ompi_dist_graph_create_f
  27 #pragma weak pmpi_dist_graph_create = ompi_dist_graph_create_f
  28 #pragma weak pmpi_dist_graph_create_ = ompi_dist_graph_create_f
  29 #pragma weak pmpi_dist_graph_create__ = ompi_dist_graph_create_f
  30 
  31 #pragma weak PMPI_Dist_graph_create_f = ompi_dist_graph_create_f
  32 #pragma weak PMPI_Dist_graph_create_f08 = ompi_dist_graph_create_f
  33 #else
  34 OMPI_GENERATE_F77_BINDINGS (PMPI_DIST_GRAPH_CREATE,
  35                             pmpi_dist_graph_create,
  36                             pmpi_dist_graph_create_,
  37                             pmpi_dist_graph_create__,
  38                             pompi_dist_graph_create_f,
  39                             (MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources, MPI_Fint *degrees, MPI_Fint *destinations, MPI_Fint *weights, MPI_Fint *info,  ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph,  MPI_Fint *ierr),
  40                             (comm_old, n, sources, degrees, destinations, weights, info,  reorder, comm_graph, ierr) )
  41 #endif
  42 #endif
  43 
  44 #if OPAL_HAVE_WEAK_SYMBOLS
  45 #pragma weak MPI_DIST_GRAPH_CREATE = ompi_dist_graph_create_f
  46 #pragma weak mpi_dist_graph_create = ompi_dist_graph_create_f
  47 #pragma weak mpi_dist_graph_create_ = ompi_dist_graph_create_f
  48 #pragma weak mpi_dist_graph_create__ = ompi_dist_graph_create_f
  49 
  50 #pragma weak MPI_Dist_graph_create_f = ompi_dist_graph_create_f
  51 #pragma weak MPI_Dist_graph_create_f08 = ompi_dist_graph_create_f
  52 #else
  53 #if ! OMPI_BUILD_MPI_PROFILING
  54 OMPI_GENERATE_F77_BINDINGS (MPI_DIST_GRAPH_CREATE,
  55                             mpi_dist_graph_create,
  56                             mpi_dist_graph_create_,
  57                             mpi_dist_graph_create__,
  58                             ompi_dist_graph_create_f,
  59                             (MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources, MPI_Fint *degrees, MPI_Fint *destinations, MPI_Fint *weights, MPI_Fint *info,  ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph,  MPI_Fint *ierr),
  60                             (comm_old, n, sources, degrees, destinations, weights, info, reorder, comm_graph, ierr) )
  61 #endif
  62 
  63 #if OMPI_BUILD_MPI_PROFILING && ! OPAL_HAVE_WEAK_SYMBOLS
  64 #define ompi_dist_graph_create_f pompi_dist_graph_create_f
  65 #endif
  66 #endif
  67 
  68 
  69 void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources,
  70                               MPI_Fint *degrees, MPI_Fint *destinations, MPI_Fint *weights,
  71                               MPI_Fint *info,  ompi_fortran_logical_t *reorder, MPI_Fint *comm_graph,
  72                               MPI_Fint *ierr)
  73 {
  74     MPI_Comm c_comm_old, c_comm_graph;
  75     int count = 0, i;
  76     MPI_Info c_info;
  77     int *c_weights;
  78 
  79     OMPI_ARRAY_NAME_DECL(sources);
  80     OMPI_ARRAY_NAME_DECL(degrees);
  81     OMPI_ARRAY_NAME_DECL(destinations);
  82 
  83     c_comm_old = PMPI_Comm_f2c(*comm_old);
  84     c_info = PMPI_Info_f2c(*info);
  85     OMPI_ARRAY_FINT_2_INT(sources, *n);
  86     OMPI_ARRAY_FINT_2_INT(degrees, *n);
  87     for( i = 0; i < OMPI_FINT_2_INT(*n); i++ )
  88         count += OMPI_ARRAY_NAME_CONVERT(degrees)[i];
  89     OMPI_ARRAY_FINT_2_INT(destinations, count);
  90 
  91     if (OMPI_IS_FORTRAN_UNWEIGHTED(weights)) {
  92         c_weights = MPI_UNWEIGHTED;
  93     } else if (OMPI_IS_FORTRAN_WEIGHTS_EMPTY(weights)) {
  94         c_weights = MPI_WEIGHTS_EMPTY;
  95     } else {
  96         OMPI_ARRAY_FINT_2_INT(weights, count);
  97         c_weights = OMPI_ARRAY_NAME_CONVERT(weights);
  98     }
  99 
 100 
 101     *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources),
 102                                                    OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations),
 103                                                    c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph));
 104     if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
 105         *comm_graph = PMPI_Comm_c2f(c_comm_graph);
 106     }
 107 
 108     OMPI_ARRAY_FINT_2_INT_CLEANUP(sources);
 109     OMPI_ARRAY_FINT_2_INT_CLEANUP(degrees);
 110     OMPI_ARRAY_FINT_2_INT_CLEANUP(destinations);
 111     if( MPI_UNWEIGHTED != c_weights && MPI_WEIGHTS_EMPTY != c_weights ) {
 112         OMPI_ARRAY_FINT_2_INT_CLEANUP(weights);
 113     }
 114 }

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