This source file includes following definitions.
- ADIOI_PVFS2_ReadContig
- ADIOI_PVFS2_ReadStridedListIO
- ADIOI_PVFS2_ReadStridedDtypeIO
- ADIOI_PVFS2_ReadStrided
1
2
3
4
5
6
7
8 #include "adio.h"
9 #include "adio_extern.h"
10 #include "ad_pvfs2.h"
11 #include "ad_pvfs2_io.h"
12 #include "ad_pvfs2_common.h"
13
14 void ADIOI_PVFS2_ReadContig(ADIO_File fd, void *buf, int count,
15 MPI_Datatype datatype, int file_ptr_type,
16 ADIO_Offset offset, ADIO_Status *status,
17 int *error_code)
18 {
19 int ret;
20 MPI_Count datatype_size, len;
21 PVFS_Request file_req, mem_req;
22 PVFS_sysresp_io resp_io;
23 ADIOI_PVFS2_fs *pvfs_fs;
24 static char myname[] = "ADIOI_PVFS2_READCONTIG";
25
26 pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
27
28 MPI_Type_size_x(datatype, &datatype_size);
29 len = datatype_size * count;
30
31 ret = PVFS_Request_contiguous(len, PVFS_BYTE, &mem_req);
32
33 if (ret != 0) {
34 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
35 MPIR_ERR_RECOVERABLE,
36 myname, __LINE__,
37 ADIOI_PVFS2_error_convert(ret),
38 "Error in pvfs_request_contig (memory)", 0);
39 return;
40 }
41
42
43 ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req);
44
45 if (ret != 0) {
46 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
47 MPIR_ERR_RECOVERABLE,
48 myname, __LINE__,
49 ADIOI_PVFS2_error_convert(ret),
50 "Error in pvfs_request_contig (file)", 0);
51 return;
52 }
53
54
55 if (file_ptr_type == ADIO_INDIVIDUAL) {
56
57 offset = fd->fp_ind;
58 }
59
60 #ifdef ADIOI_MPE_LOGGING
61 MPE_Log_event( ADIOI_MPE_read_a, 0, NULL );
62 #endif
63 ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, offset, buf,
64 mem_req, &(pvfs_fs->credentials), &resp_io);
65 #ifdef ADIOI_MPE_LOGGING
66 MPE_Log_event( ADIOI_MPE_read_b, 0, NULL );
67 #endif
68
69 if (ret != 0 ) {
70 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
71 MPIR_ERR_RECOVERABLE,
72 myname, __LINE__,
73 ADIOI_PVFS2_error_convert(ret),
74 "Error in PVFS_sys_read", 0);
75 goto fn_exit;
76 }
77
78
79 if (file_ptr_type == ADIO_INDIVIDUAL) {
80 fd->fp_ind += (int) resp_io.total_completed;
81
82 }
83 fd->fp_sys_posn = offset + (int)resp_io.total_completed;
84
85 #ifdef HAVE_STATUS_SET_BYTES
86 MPIR_Status_set_bytes(status, datatype, resp_io.total_completed);
87 #endif
88
89 *error_code = MPI_SUCCESS;
90 fn_exit:
91 PVFS_Request_free(&mem_req);
92 PVFS_Request_free(&file_req);
93 return;
94 }
95
96 static int ADIOI_PVFS2_ReadStridedListIO(ADIO_File fd, void *buf, int count,
97 MPI_Datatype datatype, int file_ptr_type,
98 ADIO_Offset offset, ADIO_Status *status,
99 int *error_code)
100 {
101 return ADIOI_PVFS2_StridedListIO(fd, buf, count,
102 datatype, file_ptr_type,
103 offset, status,
104 error_code, READ);
105 }
106
107 static int ADIOI_PVFS2_ReadStridedDtypeIO(ADIO_File fd, void *buf, int count,
108 MPI_Datatype datatype, int file_ptr_type,
109 ADIO_Offset offset, ADIO_Status *status,
110 int *error_code)
111 {
112 return ADIOI_PVFS2_StridedDtypeIO(fd, buf, count,
113 datatype, file_ptr_type,
114 offset, status, error_code,
115 READ);
116 }
117
118 void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count,
119 MPI_Datatype datatype, int file_ptr_type,
120 ADIO_Offset offset, ADIO_Status *status, int
121 *error_code)
122 {
123
124
125
126
127
128
129
130
131 int ret = -1;
132
133 if (fd->hints->fs_hints.pvfs2.posix_read == ADIOI_HINT_ENABLE) {
134 ADIOI_GEN_ReadStrided(fd, buf, count, datatype,
135 file_ptr_type, offset, status, error_code);
136 return;
137 }
138 if (fd->hints->fs_hints.pvfs2.dtype_read == ADIOI_HINT_ENABLE) {
139 ret = ADIOI_PVFS2_ReadStridedDtypeIO(fd, buf, count,
140 datatype, file_ptr_type,
141 offset, status, error_code);
142
143
144 if (ret != 0)
145 {
146 fprintf(stderr,
147 "Falling back to list I/O since datatype I/O failed\n");
148 ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count,
149 datatype, file_ptr_type,
150 offset, status, error_code);
151 }
152 return;
153 }
154 if (fd->hints->fs_hints.pvfs2.listio_read == ADIOI_HINT_ENABLE) {
155 ret = ADIOI_PVFS2_ReadStridedListIO(fd, buf, count, datatype,
156 file_ptr_type, offset, status, error_code);
157 return;
158 }
159
160
161 ADIOI_PVFS2_OldReadStrided(fd, buf, count, datatype,
162 file_ptr_type, offset, status, error_code);
163 return;
164 }
165
166
167
168
169