This source file includes following definitions.
- MPI_Fetch_and_op
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #include "ompi_config.h"
26 #include <stdio.h>
27
28 #include "ompi/mpi/c/bindings.h"
29 #include "ompi/runtime/params.h"
30 #include "ompi/communicator/communicator.h"
31 #include "ompi/errhandler/errhandler.h"
32 #include "ompi/win/win.h"
33 #include "ompi/mca/osc/osc.h"
34 #include "ompi/datatype/ompi_datatype.h"
35
36 #if OMPI_BUILD_MPI_PROFILING
37 #if OPAL_HAVE_WEAK_SYMBOLS
38 #pragma weak MPI_Fetch_and_op = PMPI_Fetch_and_op
39 #endif
40 #define MPI_Fetch_and_op PMPI_Fetch_and_op
41 #endif
42
43 static const char FUNC_NAME[] = "MPI_Fetch_and_op";
44
45
46 int MPI_Fetch_and_op(const void *origin_addr, void *result_addr, MPI_Datatype datatype,
47 int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win)
48 {
49 int rc;
50
51 if (MPI_PARAM_CHECK) {
52 rc = OMPI_SUCCESS;
53
54 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
55
56 if (ompi_win_invalid(win)) {
57 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME);
58 } else if (ompi_win_peer_invalid(win, target_rank) &&
59 (MPI_PROC_NULL != target_rank)) {
60 rc = MPI_ERR_RANK;
61 } else if ( MPI_WIN_FLAVOR_DYNAMIC != win->w_flavor && target_disp < 0 ) {
62 rc = MPI_ERR_DISP;
63 } else {
64 OMPI_CHECK_DATATYPE_FOR_ONE_SIDED(rc, datatype, 1);
65 }
66 OMPI_ERRHANDLER_CHECK(rc, win, rc, FUNC_NAME);
67 }
68
69 if (MPI_PROC_NULL == target_rank) return MPI_SUCCESS;
70
71 OPAL_CR_ENTER_LIBRARY();
72
73 rc = win->w_osc_module->osc_fetch_and_op(origin_addr, result_addr, datatype,
74 target_rank, target_disp, op, win);
75 OMPI_ERRHANDLER_RETURN(rc, win, rc, FUNC_NAME);
76 }