This source file includes following definitions.
- ADIOI_GEN_ReadContig
1
2
3
4
5
6
7
8
9 #include "adio.h"
10 #include <unistd.h>
11
12 #ifdef AGGREGATION_PROFILE
13 #include "mpe.h"
14 #endif
15 #ifdef ROMIO_GPFS
16 # include "adio/ad_gpfs/ad_gpfs_tuning.h"
17 #endif
18
19 #ifdef HAVE_LIMITS_H
20 #include <limits.h>
21 #endif
22
23 void ADIOI_GEN_ReadContig(ADIO_File fd, void *buf, int count,
24 MPI_Datatype datatype, int file_ptr_type,
25 ADIO_Offset offset, ADIO_Status *status,
26 int *error_code)
27 {
28 ssize_t err = -1;
29 MPI_Count datatype_size;
30 ADIO_Offset len, bytes_xfered=0;
31 size_t rd_count;
32 static char myname[] = "ADIOI_GEN_READCONTIG";
33 #ifdef ROMIO_GPFS
34 double io_time=0;
35 #endif
36 char *p;
37
38 #ifdef AGGREGATION_PROFILE
39 MPE_Log_event (5034, 0, NULL);
40 #endif
41 MPI_Type_size_x(datatype, &datatype_size);
42 len = datatype_size * (ADIO_Offset)count;
43
44 #ifdef ROMIO_GPFS
45 io_time = MPI_Wtime();
46 if (gpfsmpio_timing) {
47 gpfsmpio_prof_cr[ GPFSMPIO_CIO_DATA_SIZE ] += len;
48 }
49 #endif
50
51 if (file_ptr_type == ADIO_INDIVIDUAL) {
52 offset = fd->fp_ind;
53 }
54
55 p=buf;
56 while (bytes_xfered < len) {
57 #ifdef ADIOI_MPE_LOGGING
58 MPE_Log_event( ADIOI_MPE_read_a, 0, NULL );
59 #endif
60 rd_count = len - bytes_xfered;
61
62
63 if (rd_count > INT_MAX)
64 rd_count = INT_MAX;
65 #ifdef ROMIO_GPFS
66 if (gpfsmpio_devnullio)
67 err = pread(fd->null_fd, p, rd_count, offset+bytes_xfered);
68 else
69 #endif
70 err = pread(fd->fd_sys, p, rd_count, offset+bytes_xfered);
71
72 if (err == -1) {
73 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
74 MPIR_ERR_RECOVERABLE,
75 myname, __LINE__,
76 MPI_ERR_IO, "**io",
77 "**io %s", strerror(errno));
78 fd->fp_sys_posn = -1;
79 return;
80 }
81
82 if (err == 0) {
83
84 break;
85 }
86
87 #ifdef ADIOI_MPE_LOGGING
88 MPE_Log_event( ADIOI_MPE_read_b, 0, NULL );
89 #endif
90 bytes_xfered += err;
91 p += err;
92 }
93 #ifdef ROMIO_GPFS
94 if (gpfsmpio_timing) gpfsmpio_prof_cr[ GPFSMPIO_CIO_T_POSI_RW ] += (MPI_Wtime() - io_time);
95 #endif
96 fd->fp_sys_posn = offset + bytes_xfered;
97
98 if (file_ptr_type == ADIO_INDIVIDUAL) {
99 fd->fp_ind += bytes_xfered;
100 }
101
102 #ifdef HAVE_STATUS_SET_BYTES
103
104
105 if (err != -1) MPIR_Status_set_bytes(status, datatype, bytes_xfered);
106 #endif
107
108 *error_code = MPI_SUCCESS;
109 #ifdef AGGREGATION_PROFILE
110 MPE_Log_event (5035, 0, NULL);
111 #endif
112 #ifdef ROMIO_GPFS
113 if (gpfsmpio_timing) gpfsmpio_prof_cr[ GPFSMPIO_CIO_T_MPIO_RW ] += (MPI_Wtime() - io_time);
114 #endif
115 }