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

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_comm_set_name_f

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 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) 2011-2012 Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2015-2017 Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 #include "ompi_config.h"
  23 
  24 #include "ompi/mpi/fortran/mpif-h/bindings.h"
  25 #include "ompi/constants.h"
  26 #include "ompi/communicator/communicator.h"
  27 #include "ompi/mpi/fortran/base/fortran_base_strings.h"
  28 
  29 #if OMPI_BUILD_MPI_PROFILING
  30 #if OPAL_HAVE_WEAK_SYMBOLS
  31 #pragma weak PMPI_COMM_SET_NAME = ompi_comm_set_name_f
  32 #pragma weak pmpi_comm_set_name = ompi_comm_set_name_f
  33 #pragma weak pmpi_comm_set_name_ = ompi_comm_set_name_f
  34 #pragma weak pmpi_comm_set_name__ = ompi_comm_set_name_f
  35 
  36 #pragma weak PMPI_Comm_set_name_f = ompi_comm_set_name_f
  37 #pragma weak PMPI_Comm_set_name_f08 = ompi_comm_set_name_f
  38 #else
  39 OMPI_GENERATE_F77_BINDINGS (PMPI_COMM_SET_NAME,
  40                             pmpi_comm_set_name,
  41                             pmpi_comm_set_name_,
  42                             pmpi_comm_set_name__,
  43                             pompi_comm_set_name_f,
  44                             (MPI_Fint *comm, char *comm_name, MPI_Fint *ierr, int name_len),
  45                             (comm, comm_name, ierr, name_len) )
  46 #endif
  47 #endif
  48 
  49 #if OPAL_HAVE_WEAK_SYMBOLS
  50 #pragma weak MPI_COMM_SET_NAME = ompi_comm_set_name_f
  51 #pragma weak mpi_comm_set_name = ompi_comm_set_name_f
  52 #pragma weak mpi_comm_set_name_ = ompi_comm_set_name_f
  53 #pragma weak mpi_comm_set_name__ = ompi_comm_set_name_f
  54 
  55 #pragma weak MPI_Comm_set_name_f = ompi_comm_set_name_f
  56 #pragma weak MPI_Comm_set_name_f08 = ompi_comm_set_name_f
  57 #else
  58 #if ! OMPI_BUILD_MPI_PROFILING
  59 OMPI_GENERATE_F77_BINDINGS (MPI_COMM_SET_NAME,
  60                             mpi_comm_set_name,
  61                             mpi_comm_set_name_,
  62                             mpi_comm_set_name__,
  63                             ompi_comm_set_name_f,
  64                             (MPI_Fint *comm, char *comm_name, MPI_Fint *ierr, int name_len),
  65                             (comm, comm_name, ierr, name_len) )
  66 #else
  67 #define ompi_comm_set_name_f pompi_comm_set_name_f
  68 #endif
  69 #endif
  70 
  71 
  72 void ompi_comm_set_name_f(MPI_Fint *comm, char *comm_name, MPI_Fint *ierr,
  73                           int name_len)
  74 {
  75     int ret, c_ierr;
  76     char *c_name;
  77     MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
  78 
  79     /* Convert the fortran string */
  80 
  81     if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(comm_name, name_len,
  82                                                        &c_name))) {
  83         c_ierr = OMPI_ERRHANDLER_INVOKE(c_comm, ret,
  84                                         "MPI_COMM_SET_NAME");
  85         if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
  86         return;
  87     }
  88 
  89     /* Call the C function */
  90 
  91     c_ierr = PMPI_Comm_set_name(c_comm, c_name);
  92     if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
  93 
  94     /* Free the C name */
  95 
  96     free(c_name);
  97 }

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