This source file includes following definitions.
- ompi_waitall_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_WAITALL = ompi_waitall_f
32 #pragma weak pmpi_waitall = ompi_waitall_f
33 #pragma weak pmpi_waitall_ = ompi_waitall_f
34 #pragma weak pmpi_waitall__ = ompi_waitall_f
35
36 #pragma weak PMPI_Waitall_f = ompi_waitall_f
37 #pragma weak PMPI_Waitall_f08 = ompi_waitall_f
38 #else
39 OMPI_GENERATE_F77_BINDINGS (PMPI_WAITALL,
40 pmpi_waitall,
41 pmpi_waitall_,
42 pmpi_waitall__,
43 pompi_waitall_f,
44 (MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *array_of_statuses, MPI_Fint *ierr),
45 (count, array_of_requests, array_of_statuses, ierr) )
46 #endif
47 #endif
48
49 #if OPAL_HAVE_WEAK_SYMBOLS
50 #pragma weak MPI_WAITALL = ompi_waitall_f
51 #pragma weak mpi_waitall = ompi_waitall_f
52 #pragma weak mpi_waitall_ = ompi_waitall_f
53 #pragma weak mpi_waitall__ = ompi_waitall_f
54
55 #pragma weak MPI_Waitall_f = ompi_waitall_f
56 #pragma weak MPI_Waitall_f08 = ompi_waitall_f
57 #else
58 #if ! OMPI_BUILD_MPI_PROFILING
59 OMPI_GENERATE_F77_BINDINGS (MPI_WAITALL,
60 mpi_waitall,
61 mpi_waitall_,
62 mpi_waitall__,
63 ompi_waitall_f,
64 (MPI_Fint *count, MPI_Fint *array_of_requests, MPI_Fint *array_of_statuses, MPI_Fint *ierr),
65 (count, array_of_requests, array_of_statuses, ierr) )
66 #else
67 #define ompi_waitall_f pompi_waitall_f
68 #endif
69 #endif
70
71
72 static const char FUNC_NAME[] = "MPI_WAITALL";
73
74
75 void ompi_waitall_f(MPI_Fint *count, MPI_Fint *array_of_requests,
76 MPI_Fint *array_of_statuses, MPI_Fint *ierr)
77 {
78 MPI_Request *c_req;
79 MPI_Status *c_status;
80 int i, c_ierr;
81
82
83
84 if (OPAL_UNLIKELY(0 == OMPI_FINT_2_INT(*count))) {
85 *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
86 return;
87 }
88
89 c_req = (MPI_Request *) malloc(OMPI_FINT_2_INT(*count) *
90 (sizeof(MPI_Request) + sizeof(MPI_Status)));
91 if (NULL == c_req) {
92 c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
93 MPI_ERR_NO_MEM,
94 FUNC_NAME);
95 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
96 return;
97 }
98 c_status = (MPI_Status*) (c_req + OMPI_FINT_2_INT(*count));
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_Waitall(OMPI_FINT_2_INT(*count), c_req, c_status);
105 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
106
107 if (MPI_SUCCESS == c_ierr) {
108 for (i = 0; i < OMPI_FINT_2_INT(*count); ++i) {
109 array_of_requests[i] = c_req[i]->req_f_to_c_index;
110 if (!OMPI_IS_FORTRAN_STATUSES_IGNORE(array_of_statuses) &&
111 !OMPI_IS_FORTRAN_STATUS_IGNORE(&array_of_statuses[i])) {
112 PMPI_Status_c2f( &c_status[i], &array_of_statuses[i * (sizeof(MPI_Status) / sizeof(int))]);
113 }
114 }
115 }
116 free(c_req);
117 }