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