This source file includes following definitions.
- MPI_File_write_ordered
1
2
3
4
5
6
7
8
9 #include "mpioimpl.h"
10
11 #ifdef HAVE_WEAK_SYMBOLS
12
13 #if defined(HAVE_PRAGMA_WEAK)
14 #pragma weak MPI_File_write_ordered = PMPI_File_write_ordered
15 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
16 #pragma _HP_SECONDARY_DEF PMPI_File_write_ordered MPI_File_write_ordered
17 #elif defined(HAVE_PRAGMA_CRI_DUP)
18 #pragma _CRI duplicate MPI_File_write_ordered as PMPI_File_write_ordered
19
20 #elif defined(HAVE_WEAK_ATTRIBUTE)
21 int MPI_File_write_ordered(MPI_File fh, const void *buf, int count, MPI_Datatype datatype,
22 MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_ordered")));
23 #endif
24
25
26 #define MPIO_BUILD_PROFILING
27 #include "mpioprof.h"
28 #endif
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count,
47 MPI_Datatype datatype, MPI_Status *status)
48 {
49 int error_code, nprocs, myrank;
50 ADIO_Offset incr;
51 MPI_Count datatype_size;
52 int source, dest;
53 static char myname[] = "MPI_FILE_WRITE_ORDERED";
54 ADIO_Offset shared_fp;
55 ADIO_File adio_fh;
56 void *e32buf=NULL;
57 const void *xbuf;
58
59 ROMIO_THREAD_CS_ENTER();
60
61 adio_fh = MPIO_File_resolve(fh);
62
63
64 MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
65 MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
66 MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
67
68
69 MPI_Type_size_x(datatype, &datatype_size);
70
71
72 MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
73 MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code);
74 MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
75
76
77 ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
78
79 MPI_Comm_size(adio_fh->comm, &nprocs);
80 MPI_Comm_rank(adio_fh->comm, &myrank);
81
82 incr = (count*datatype_size)/adio_fh->etype_size;
83
84 source = myrank - 1;
85 dest = myrank + 1;
86 if (source < 0) source = MPI_PROC_NULL;
87 if (dest >= nprocs) dest = MPI_PROC_NULL;
88 MPI_Recv(NULL, 0, MPI_BYTE, source, 0, adio_fh->comm, MPI_STATUS_IGNORE);
89
90 ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code);
91
92
93 if (error_code != MPI_SUCCESS) {
94 error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL,
95 myname, __LINE__, MPI_ERR_INTERN,
96 "**iosharedfailed", 0);
97 error_code = MPIO_Err_return_file(adio_fh, error_code);
98 goto fn_exit;
99 }
100
101
102 MPI_Send(NULL, 0, MPI_BYTE, dest, 0, adio_fh->comm);
103
104 xbuf = buf;
105 if (adio_fh->is_external32) {
106 error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
107 if (error_code != MPI_SUCCESS)
108 goto fn_exit;
109
110 xbuf = e32buf;
111 }
112
113 ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET,
114 shared_fp, status, &error_code);
115
116
117 if (error_code != MPI_SUCCESS)
118 error_code = MPIO_Err_return_file(adio_fh, error_code);
119
120
121 fn_exit:
122 if (e32buf != NULL) ADIOI_Free(e32buf);
123 ROMIO_THREAD_CS_EXIT();
124
125
126 return error_code;
127 }
128