File: file.h

package info (click to toggle)
openmpi 4.1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 127,592 kB
  • sloc: ansic: 690,998; makefile: 43,047; f90: 19,220; sh: 7,182; java: 6,360; perl: 3,590; cpp: 2,227; python: 1,350; lex: 989; fortran: 61; tcl: 12
file content (317 lines) | stat: -rw-r--r-- 9,904 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
// -*- c++ -*-
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
//                         University Research and Technology
//                         Corporation.  All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
//                         of Tennessee Research Foundation.  All rights
//                         reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
//                         University of Stuttgart.  All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
//                         All rights reserved.
// Copyright (c) 2006-2009 Cisco Systems, Inc.  All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//

// Typedefs for C++ callbacks registered via MPI::Register_datarep
typedef void Datarep_extent_function(const Datatype& datatype,
                                     Aint& file_extent, void* extra_state);
typedef void Datarep_conversion_function(void* userbuf, Datatype& datatype,
                                         int count, void* filebuf,
                                         Offset position, void* extra_state);

// Both callback functions in C++
void Register_datarep(const char* datarep,
                      Datarep_conversion_function* read_conversion_fn,
                      Datarep_conversion_function* write_conversion_fn,
                      Datarep_extent_function* dtype_file_extent_fn,
                      void* extra_state);

// Overload for C read callback function (MPI_CONVERSION_FN_NULL)
void Register_datarep(const char* datarep,
                      MPI_Datarep_conversion_function* read_conversion_fn,
                      Datarep_conversion_function* write_conversion_fn,
                      Datarep_extent_function* dtype_file_extent_fn,
                      void* extra_state);

// Overload for C write callback function (MPI_CONVERSION_FN_NULL)
void Register_datarep(const char* datarep,
                      Datarep_conversion_function* read_conversion_fn,
                      MPI_Datarep_conversion_function* write_conversion_fn,
                      Datarep_extent_function* dtype_file_extent_fn,
                      void* extra_state);

// Overload for C read and write callback functions (MPI_CONVERSION_FN_NULL)
void Register_datarep(const char* datarep,
                      MPI_Datarep_conversion_function* read_conversion_fn,
                      MPI_Datarep_conversion_function* write_conversion_fn,
                      Datarep_extent_function* dtype_file_extent_fn,
                      void* extra_state);

class File {
#if 0 /* OMPI_ENABLE_MPI_PROFILING */
  //  friend class P;

#endif
  friend class MPI::Comm; //so I can access pmpi_file data member in comm.cc
  friend class MPI::Request; //and also from request.cc

public:
#if 0 /* OMPI_ENABLE_MPI_PROFILING */

  // construction / destruction
  File() { }
  virtual ~File() { }


  // copy / assignment
  File(const File& data) : pmpi_file(data.pmpi_file) { }

  File(MPI_File i) : pmpi_file(i) { }

  File& operator=(const File& data) {
    pmpi_file = data.pmpi_file; return *this; }

  // comparison, don't need for file

  // inter-language operability
  File& operator= (const MPI_File &i) {
    pmpi_file = i; return *this; }
  operator MPI_File () const { return pmpi_file; }
  //  operator MPI_File* () const { return pmpi_file; }
  operator const PMPI::File&() const { return pmpi_file; }

#else

  File() : mpi_file(MPI_FILE_NULL) { }
  // copy
  File(const File& data) : mpi_file(data.mpi_file) { }

  File(MPI_File i) : mpi_file(i) { }

  virtual ~File() { }

  File& operator=(const File& data) {
    mpi_file = data.mpi_file; return *this; }

  // comparison, don't need for file

  // inter-language operability
  File& operator= (const MPI_File &i) {
    mpi_file = i; return *this; }
  operator MPI_File () const { return mpi_file; }
  //  operator MPI_File* () const { return (MPI_File*)&mpi_file; }

#endif

  // from the I/o chapter of MPI - 2

  void Close();

  static void Delete(const char* filename, const MPI::Info& info);

  int Get_amode() const;

  bool Get_atomicity() const;

  MPI::Offset Get_byte_offset(const MPI::Offset disp) const;

  MPI::Group Get_group() const;

  MPI::Info Get_info() const;

  MPI::Offset Get_position() const;

  MPI::Offset Get_position_shared() const;

  MPI::Offset Get_size() const;

  MPI::Aint Get_type_extent(const MPI::Datatype& datatype) const;

  void Get_view(MPI::Offset& disp, MPI::Datatype& etype,
		MPI::Datatype& filetype, char* datarep) const;

  MPI::Request Iread(void* buf, int count,
		     const MPI::Datatype& datatype);

  MPI::Request Iread_at(MPI::Offset offset, void* buf, int count,
			const MPI::Datatype& datatype);

  MPI::Request Iread_shared(void* buf, int count,
			    const MPI::Datatype& datatype);

  MPI::Request Iwrite(const void* buf, int count,
		       const MPI::Datatype& datatype);

  MPI::Request Iwrite_at(MPI::Offset offset, const void* buf,
			 int count,  const MPI::Datatype& datatype);

  MPI::Request Iwrite_shared(const void* buf, int count,
			      const MPI::Datatype& datatype);

  static MPI::File Open(const MPI::Intracomm& comm,
			const char* filename, int amode,
			const MPI::Info& info);

  void Preallocate(MPI::Offset size);

  void Read(void* buf, int count, const MPI::Datatype& datatype);

  void Read(void* buf, int count, const MPI::Datatype& datatype,
	    MPI::Status& status);

  void Read_all(void* buf, int count, const MPI::Datatype& datatype);

  void Read_all(void* buf, int count, const MPI::Datatype& datatype,
		MPI::Status& status);

  void Read_all_begin(void* buf, int count,
		      const MPI::Datatype& datatype);

  void Read_all_end(void* buf);

  void Read_all_end(void* buf, MPI::Status& status);

  void Read_at(MPI::Offset offset,
	       void* buf, int count,  const MPI::Datatype& datatype);

  void Read_at(MPI::Offset offset, void* buf, int count,
	       const MPI::Datatype& datatype, MPI::Status& status);

  void Read_at_all(MPI::Offset offset, void* buf, int count,
		   const MPI::Datatype& datatype);

  void Read_at_all(MPI::Offset offset, void* buf, int count,
		   const MPI::Datatype& datatype, MPI::Status& status);

  void Read_at_all_begin(MPI::Offset offset, void* buf, int count,
			 const MPI::Datatype& datatype);

  void Read_at_all_end(void* buf);

  void Read_at_all_end(void* buf, MPI::Status& status);

  void Read_ordered(void* buf, int count,
		    const MPI::Datatype& datatype);

  void Read_ordered(void* buf, int count,
		    const MPI::Datatype& datatype,
		    MPI::Status& status);

  void Read_ordered_begin(void* buf, int count,
			  const MPI::Datatype& datatype);

  void Read_ordered_end(void* buf);

  void Read_ordered_end(void* buf, MPI::Status& status);

  void Read_shared(void* buf, int count,
		   const MPI::Datatype& datatype);

  void Read_shared(void* buf, int count,
		   const MPI::Datatype& datatype, MPI::Status& status);

  void Seek(MPI::Offset offset, int whence);

  void Seek_shared(MPI::Offset offset, int whence);

  void Set_atomicity(bool flag);

  void Set_info(const MPI::Info& info);

  void Set_size(MPI::Offset size);

  void Set_view(MPI::Offset disp,  const MPI::Datatype& etype,
		const MPI::Datatype& filetype, const char* datarep,
		const MPI::Info& info);

  void Sync();

  void Write(const void* buf, int count,
	      const MPI::Datatype& datatype);

  void Write(const void* buf, int count,
	      const MPI::Datatype& datatype, MPI::Status& status);

  void Write_all(const void* buf, int count,
		  const MPI::Datatype& datatype);

  void Write_all(const void* buf, int count,
		  const MPI::Datatype& datatype, MPI::Status& status);

  void Write_all_begin(const void* buf, int count,
			const MPI::Datatype& datatype);

  void Write_all_end(const void* buf);

  void Write_all_end(const void* buf, MPI::Status& status);

  void Write_at(MPI::Offset offset,  const void* buf, int count,
		const MPI::Datatype& datatype);

  void Write_at(MPI::Offset offset,  const void* buf, int count,
		const MPI::Datatype& datatype, MPI::Status& status);

  void Write_at_all(MPI::Offset offset,  const void* buf, int count,
		    const MPI::Datatype& datatype);

  void Write_at_all(MPI::Offset offset,  const void* buf, int count,
		    const MPI::Datatype& datatype,
  			     MPI::Status& status);

  void Write_at_all_begin(MPI::Offset offset, const void* buf,
			  int count,  const MPI::Datatype& datatype);

  void Write_at_all_end(const void* buf);

  void Write_at_all_end(const void* buf, MPI::Status& status);

  void Write_ordered(const void* buf, int count,
		      const MPI::Datatype& datatype);

  void Write_ordered(const void* buf, int count,
		      const MPI::Datatype& datatype, MPI::Status& status);

  void Write_ordered_begin(const void* buf, int count,
			    const MPI::Datatype& datatype);

  void Write_ordered_end(const void* buf);

  void Write_ordered_end(const void* buf, MPI::Status& status);

  void Write_shared(const void* buf, int count,
		     const MPI::Datatype& datatype);

  void Write_shared(const void* buf, int count,
		     const MPI::Datatype& datatype, MPI::Status& status);

  //
  // Errhandler
  //
  typedef void Errhandler_function(MPI::File &, int *, ... );
  typedef Errhandler_function Errhandler_fn
        __mpi_interface_deprecated__("MPI::File::Errhandler_fn was deprecated in MPI-2.2; use MPI::File::Errhandler_function instead");

  static MPI::Errhandler Create_errhandler(Errhandler_function* function);

  MPI::Errhandler Get_errhandler() const;

  void Set_errhandler(const MPI::Errhandler& errhandler) const;

  void Call_errhandler(int errorcode) const;

protected:
#if 0 /* OMPI_ENABLE_MPI_PROFILING */
      PMPI::File pmpi_file;

#else
  MPI_File mpi_file;

#endif
};