1 /*
2 * Copyright (c) 2004-2005 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) 2007 Sun Microsystems, Inc. All rights reserved.
13 * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2015 Research Organization for Information Science
15 * and Technology (RIST). All rights reserved.
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23 #include "ompi_config.h"
24
25 #include "ompi/mpi/fortran/mpif-h/bindings.h"
26
27 #if OMPI_BUILD_MPI_PROFILING
28 #if OPAL_HAVE_WEAK_SYMBOLS
29 #pragma weak PMPI_BUFFER_DETACH = ompi_buffer_detach_f
30 #pragma weak pmpi_buffer_detach = ompi_buffer_detach_f
31 #pragma weak pmpi_buffer_detach_ = ompi_buffer_detach_f
32 #pragma weak pmpi_buffer_detach__ = ompi_buffer_detach_f
33
34 #pragma weak PMPI_Buffer_detach_f = ompi_buffer_detach_f
35 #else
36 OMPI_GENERATE_F77_BINDINGS (PMPI_BUFFER_DETACH,
37 pmpi_buffer_detach,
38 pmpi_buffer_detach_,
39 pmpi_buffer_detach__,
40 pompi_buffer_detach_f,
41 (char *buffer, MPI_Fint *size, MPI_Fint *ierr),
42 (buffer, size, ierr) )
43 #endif
44 #endif
45
46 #if OPAL_HAVE_WEAK_SYMBOLS
47 #pragma weak MPI_BUFFER_DETACH = ompi_buffer_detach_f
48 #pragma weak mpi_buffer_detach = ompi_buffer_detach_f
49 #pragma weak mpi_buffer_detach_ = ompi_buffer_detach_f
50 #pragma weak mpi_buffer_detach__ = ompi_buffer_detach_f
51
52 #pragma weak MPI_Buffer_detach_f = ompi_buffer_detach_f
53 #else
54 #if ! OMPI_BUILD_MPI_PROFILING
55 OMPI_GENERATE_F77_BINDINGS (MPI_BUFFER_DETACH,
56 mpi_buffer_detach,
57 mpi_buffer_detach_,
58 mpi_buffer_detach__,
59 ompi_buffer_detach_f,
60 (char *buffer, MPI_Fint *size, MPI_Fint *ierr),
61 (buffer, size, ierr) )
62 #else
63 #define ompi_buffer_detach_f pompi_buffer_detach_f
64 #endif
65 #endif
66
67
68 /* (this comment is repeated in ompi/mpi/fortran/use-mpi-f08/buffer_detach.c)
69 *
70 * MPI-3.1 section 3.6, page 45, states that the mpif.h and mpi module
71 * interfaces for MPI_BUFFER_DETACH ignore the buffer argument.
72 * Therefore, for the mpif.h and mpi module interfaces, we use a dummy
73 * variable and leave the value handed in alone.
74 *
75 * The mpi_f08 implementation for MPI_BUFFER_DETACH therefore is a
76 * separate routine in the use-mpi-f08 directory (it's not built in
77 * the mpif-h directory because of all the different combinations of
78 * supporting weak symbols (or not), building the profiling layer (or
79 * not), etc.).
80 */
ompi_buffer_detach_f(char * buffer,MPI_Fint * size,MPI_Fint * ierr)81 void ompi_buffer_detach_f(char *buffer, MPI_Fint *size, MPI_Fint *ierr)
82 {
83 int c_ierr;
84 void *dummy;
85 OMPI_SINGLE_NAME_DECL(size);
86
87 c_ierr = PMPI_Buffer_detach(&dummy, OMPI_SINGLE_NAME_CONVERT(size));
88 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
89
90 if (MPI_SUCCESS == c_ierr) {
91 OMPI_SINGLE_INT_2_FINT(size);
92 }
93 }
94