This source file includes following definitions.
- MPI_Testany
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "ompi_config.h"
25 #include <stdio.h>
26
27 #include "ompi/mpi/c/bindings.h"
28 #include "ompi/runtime/params.h"
29 #include "ompi/communicator/communicator.h"
30 #include "ompi/errhandler/errhandler.h"
31 #include "ompi/request/request.h"
32 #include "ompi/memchecker.h"
33 #include "ompi/runtime/ompi_spc.h"
34
35 #if OMPI_BUILD_MPI_PROFILING
36 #if OPAL_HAVE_WEAK_SYMBOLS
37 #pragma weak MPI_Testany = PMPI_Testany
38 #endif
39 #define MPI_Testany PMPI_Testany
40 #endif
41
42 static const char FUNC_NAME[] = "MPI_Testany";
43
44
45 int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MPI_Status *status)
46 {
47 SPC_RECORD(OMPI_SPC_TESTANY, 1);
48
49 MEMCHECKER(
50 int j;
51 for (j = 0; j < count; j++){
52 memchecker_request(&requests[j]);
53 }
54 );
55
56 if ( MPI_PARAM_CHECK ) {
57 int i, rc = MPI_SUCCESS;
58 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
59 if ((NULL == requests) && (0 != count)) {
60 rc = MPI_ERR_REQUEST;
61 } else {
62 for (i = 0; i < count; i++) {
63 if (NULL == requests[i]) {
64 rc = MPI_ERR_REQUEST;
65 break;
66 }
67 }
68 }
69 if (((NULL == indx || NULL == completed) && count > 0) ||
70 count < 0) {
71 rc = MPI_ERR_ARG;
72 }
73 OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
74 }
75
76 if (OPAL_UNLIKELY(0 == count)) {
77 *completed = true;
78 *indx = MPI_UNDEFINED;
79 if (MPI_STATUS_IGNORE != status) {
80 *status = ompi_status_empty;
81 }
82 return MPI_SUCCESS;
83 }
84
85 OPAL_CR_ENTER_LIBRARY();
86
87 if (OMPI_SUCCESS == ompi_request_test_any(count, requests,
88 indx, completed, status)) {
89 OPAL_CR_EXIT_LIBRARY();
90 return MPI_SUCCESS;
91 }
92
93 OPAL_CR_EXIT_LIBRARY();
94 return ompi_errhandler_request_invoke(count, requests, FUNC_NAME);
95 }