This source file includes following definitions.
- MPI_File_iread_shared
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_iread_shared = PMPI_File_iread_shared
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_File_iread_shared MPI_File_iread_shared
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_File_iread_shared as PMPI_File_iread_shared
18
19 #elif defined(HAVE_WEAK_ATTRIBUTE)
20 int MPI_File_iread_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
21 MPIO_Request *request) __attribute__((weak,alias("PMPI_File_iread_shared")));
22 #endif
23
24
25 #define MPIO_BUILD_PROFILING
26 #include "mpioprof.h"
27 #endif
28
29 #ifdef HAVE_MPI_GREQUEST
30 #include "mpiu_greq.h"
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
47 MPI_Datatype datatype, MPI_Request *request)
48 {
49 int error_code, buftype_is_contig, filetype_is_contig;
50 ADIO_Offset bufsize;
51 ADIO_File adio_fh;
52 static char myname[] = "MPI_FILE_IREAD_SHARED";
53 MPI_Count datatype_size, incr;
54 MPI_Status status;
55 ADIO_Offset off, shared_fp;
56 MPI_Offset nbytes=0;
57
58 ROMIO_THREAD_CS_ENTER();
59
60 adio_fh = MPIO_File_resolve(fh);
61
62
63 MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
64 MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
65 MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
66
67
68 MPI_Type_size_x(datatype, &datatype_size);
69
70
71 MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
72 MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code);
73 MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
74
75
76 ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
77 ADIOI_Datatype_iscontig(adio_fh->filetype, &filetype_is_contig);
78
79 ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
80
81 incr = (count*datatype_size)/adio_fh->etype_size;
82 ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code);
83
84
85 if (error_code != MPI_SUCCESS)
86 {
87
88 MPIO_Err_return_file(adio_fh, error_code);
89 }
90
91
92 if (buftype_is_contig && filetype_is_contig)
93 {
94
95 bufsize = datatype_size * count;
96 off = adio_fh->disp + adio_fh->etype_size * shared_fp;
97 if (!(adio_fh->atomicity))
98 {
99 ADIO_IreadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
100 off, request, &error_code);
101 }
102 else
103 {
104
105
106
107 if (adio_fh->file_system != ADIO_NFS)
108 {
109 ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize);
110 }
111
112 ADIO_ReadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
113 off, &status, &error_code);
114
115 if (adio_fh->file_system != ADIO_NFS)
116 {
117 ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize);
118 }
119 if (error_code == MPI_SUCCESS){
120 nbytes = count * datatype_size;
121 }
122 MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request);
123 }
124 }
125 else
126 {
127 ADIO_IreadStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
128 shared_fp, request, &error_code);
129 }
130
131
132 if (error_code != MPI_SUCCESS)
133 error_code = MPIO_Err_return_file(adio_fh, error_code);
134
135
136 fn_exit:
137 ROMIO_THREAD_CS_EXIT();
138 return error_code;
139 }
140 #endif