This source file includes following definitions.
- ompi_waitany_f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23
24 #include "ompi/mpi/fortran/mpif-h/bindings.h"
25 #include "ompi/mpi/fortran/base/constants.h"
26 #include "ompi/errhandler/errhandler.h"
27 #include "ompi/communicator/communicator.h"
28
29 #if OMPI_BUILD_MPI_PROFILING
30 #if OPAL_HAVE_WEAK_SYMBOLS
31 #pragma weak PMPI_WAITANY = ompi_waitany_f
32 #pragma weak pmpi_waitany = ompi_waitany_f
33 #pragma weak pmpi_waitany_ = ompi_waitany_f
34 #pragma weak pmpi_waitany__ = ompi_waitany_f
35
36 #pragma weak PMPI_Waitany_f = ompi_waitany_f
37 #pragma weak PMPI_Waitany_f08 = ompi_waitany_f
38 #else
39 OMPI_GENERATE_F77_BINDINGS (PMPI_WAITANY,
40 pmpi_waitany,
41 pmpi_waitany_,
42 pmpi_waitany__,
43 pompi_waitany_f,
44 (MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *indx, MPI_Fint *status, MPI_Fint *ierr),
45 (count, array_of_requests, indx, status, ierr) )
46 #endif
47 #endif
48
49 #if OPAL_HAVE_WEAK_SYMBOLS
50 #pragma weak MPI_WAITANY = ompi_waitany_f
51 #pragma weak mpi_waitany = ompi_waitany_f
52 #pragma weak mpi_waitany_ = ompi_waitany_f
53 #pragma weak mpi_waitany__ = ompi_waitany_f
54
55 #pragma weak MPI_Waitany_f = ompi_waitany_f
56 #pragma weak MPI_Waitany_f08 = ompi_waitany_f
57 #else
58 #if ! OMPI_BUILD_MPI_PROFILING
59 OMPI_GENERATE_F77_BINDINGS (MPI_WAITANY,
60 mpi_waitany,
61 mpi_waitany_,
62 mpi_waitany__,
63 ompi_waitany_f,
64 (MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *indx, MPI_Fint *status, MPI_Fint *ierr),
65 (count, array_of_requests, indx, status, ierr) )
66 #else
67 #define ompi_waitany_f pompi_waitany_f
68 #endif
69 #endif
70
71
72 static const char FUNC_NAME[] = "MPI_WAITANY";
73
74
75 void ompi_waitany_f(MPI_Fint *count, MPI_Fint *array_of_requests,
76 MPI_Fint *indx, MPI_Fint *status, MPI_Fint *ierr)
77 {
78 MPI_Request *c_req;
79 MPI_Status c_status;
80 int i, c_ierr;
81 OMPI_SINGLE_NAME_DECL(indx);
82
83
84
85 if (OPAL_UNLIKELY(0 == OMPI_FINT_2_INT(*count))) {
86 *indx = OMPI_INT_2_FINT(MPI_UNDEFINED);
87 PMPI_Status_c2f(&ompi_status_empty, status);
88 *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
89 return;
90 }
91
92 c_req = (MPI_Request *) malloc(OMPI_FINT_2_INT(*count) * sizeof(MPI_Request));
93 if (NULL == c_req) {
94 c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,
95 FUNC_NAME);
96 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
97 return;
98 }
99
100 for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
101 c_req[i] = PMPI_Request_f2c(array_of_requests[i]);
102 }
103
104 c_ierr = PMPI_Waitany(OMPI_FINT_2_INT(*count), c_req,
105 OMPI_SINGLE_NAME_CONVERT(indx),
106 &c_status);
107 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
108
109 if (MPI_SUCCESS == c_ierr) {
110
111
112
113 OMPI_SINGLE_INT_2_FINT(indx);
114 if (MPI_UNDEFINED != *(OMPI_SINGLE_NAME_CONVERT(indx))) {
115 array_of_requests[OMPI_INT_2_FINT(*indx)] =
116 c_req[OMPI_INT_2_FINT(*indx)]->req_f_to_c_index;
117 ++(*indx);
118 }
119 if (!OMPI_IS_FORTRAN_STATUS_IGNORE(status)) {
120 PMPI_Status_c2f(&c_status, status);
121 }
122 }
123 free(c_req);
124 }