1 // -*- c++ -*-
2 //
3 // Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 // University Research and Technology
5 // Corporation. All rights reserved.
6 // Copyright (c) 2004-2005 The University of Tennessee and The University
7 // of Tennessee Research Foundation. All rights
8 // reserved.
9 // Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 // University of Stuttgart. All rights reserved.
11 // Copyright (c) 2004-2005 The Regents of the University of California.
12 // All rights reserved.
13 // Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
14 // $COPYRIGHT$
15 //
16 // Additional copyrights may follow
17 //
18 // $HEADER$
19 //
20
21
22 inline void
Delete(const char * filename,const MPI::Info & info)23 MPI::File::Delete(const char* filename, const MPI::Info& info)
24 {
25 (void) MPI_File_delete(const_cast<char *>(filename), info);
26 }
27
28
29 inline int
Get_amode()30 MPI::File::Get_amode() const
31 {
32 int amode;
33 (void) MPI_File_get_amode(mpi_file, &amode);
34 return amode;
35 }
36
37
38 inline bool
Get_atomicity()39 MPI::File::Get_atomicity() const
40 {
41 int flag;
42 (void) MPI_File_get_atomicity(mpi_file, &flag);
43 return OPAL_INT_TO_BOOL(flag);
44 }
45
46 inline MPI::Offset
Get_byte_offset(const MPI::Offset disp)47 MPI::File::Get_byte_offset(const MPI::Offset disp) const
48 {
49 MPI_Offset offset, ldisp;
50 ldisp = disp;
51 (void) MPI_File_get_byte_offset(mpi_file, ldisp, &offset);
52 return offset;
53 }
54
55 inline MPI::Group
Get_group()56 MPI::File::Get_group() const
57 {
58 MPI_Group group;
59 (void) MPI_File_get_group(mpi_file, &group);
60 return group;
61 }
62
63
64 inline MPI::Info
Get_info()65 MPI::File::Get_info() const
66 {
67 MPI_Info info_used;
68 (void) MPI_File_get_info(mpi_file, &info_used);
69 return info_used;
70 }
71
72
73 inline MPI::Offset
Get_position()74 MPI::File::Get_position() const
75 {
76 MPI_Offset offset;
77 (void) MPI_File_get_position(mpi_file, &offset);
78 return offset;
79 }
80
81
82 inline MPI::Offset
Get_position_shared()83 MPI::File::Get_position_shared() const
84 {
85 MPI_Offset offset;
86 (void) MPI_File_get_position_shared(mpi_file, &offset);
87 return offset;
88 }
89
90
91 inline MPI::Offset
Get_size()92 MPI::File::Get_size() const
93 {
94 MPI_Offset offset;
95 (void) MPI_File_get_size(mpi_file, &offset);
96 return offset;
97
98 }
99
100
101 inline MPI::Aint
Get_type_extent(const MPI::Datatype & datatype)102 MPI::File::Get_type_extent(const MPI::Datatype& datatype) const
103 {
104 MPI_Aint extent;
105 (void) MPI_File_get_type_extent(mpi_file, datatype, &extent);
106 return extent;
107 }
108
109
110 inline void
Get_view(MPI::Offset & disp,MPI::Datatype & etype,MPI::Datatype & filetype,char * datarep)111 MPI::File::Get_view(MPI::Offset& disp,
112 MPI::Datatype& etype,
113 MPI::Datatype& filetype,
114 char* datarep) const
115 {
116 MPI_Datatype type, ftype;
117 type = etype;
118 ftype = filetype;
119 MPI::Offset odisp = disp;
120
121 (void) MPI_File_get_view(mpi_file, &odisp, &type, &ftype,
122 datarep);
123 }
124
125
126 inline MPI::Request
Iread(void * buf,int count,const MPI::Datatype & datatype)127 MPI::File::Iread(void* buf, int count,
128 const MPI::Datatype& datatype)
129 {
130 MPI_Request req;
131 (void) MPI_File_iread(mpi_file, buf, count, datatype, &req);
132 return req;
133 }
134
135
136 inline MPI::Request
Iread_at(MPI::Offset offset,void * buf,int count,const MPI::Datatype & datatype)137 MPI::File::Iread_at(MPI::Offset offset, void* buf, int count,
138 const MPI::Datatype& datatype)
139 {
140 MPI_Request req;
141 (void) MPI_File_iread_at(mpi_file, offset, buf, count, datatype, &req);
142 return req;
143 }
144
145
146 inline MPI::Request
Iread_shared(void * buf,int count,const MPI::Datatype & datatype)147 MPI::File::Iread_shared(void* buf, int count,
148 const MPI::Datatype& datatype)
149 {
150 MPI_Request req;
151 (void) MPI_File_iread_shared(mpi_file, buf, count, datatype, &req);
152 return req;
153 }
154
155
156 inline MPI::Request
Iwrite(const void * buf,int count,const MPI::Datatype & datatype)157 MPI::File::Iwrite(const void* buf, int count,
158 const MPI::Datatype& datatype)
159 {
160 MPI_Request req;
161 (void) MPI_File_iwrite(mpi_file, const_cast<void *>(buf), count, datatype, &req);
162 return req;
163 }
164
165
166 inline MPI::Request
Iwrite_at(MPI::Offset offset,const void * buf,int count,const MPI::Datatype & datatype)167 MPI::File::Iwrite_at(MPI::Offset offset, const void* buf,
168 int count, const MPI::Datatype& datatype)
169 {
170 MPI_Request req;
171 (void) MPI_File_iwrite_at(mpi_file, offset, const_cast<void *>(buf), count, datatype,
172 &req);
173 return req;
174 }
175
176
177 inline MPI::Request
Iwrite_shared(const void * buf,int count,const MPI::Datatype & datatype)178 MPI::File::Iwrite_shared(const void* buf, int count,
179 const MPI::Datatype& datatype)
180 {
181 MPI_Request req;
182 (void) MPI_File_iwrite_shared(mpi_file, const_cast<void *>(buf), count, datatype, &req);
183 return req;
184 }
185
186
187 inline MPI::File
Open(const MPI::Intracomm & comm,const char * filename,int amode,const MPI::Info & info)188 MPI::File::Open(const MPI::Intracomm& comm,
189 const char* filename, int amode,
190 const MPI::Info& info)
191 {
192 MPI_File fh;
193 (void) MPI_File_open(comm, const_cast<char *>(filename), amode, info, &fh);
194 return fh;
195 }
196
197
198 inline void
Preallocate(MPI::Offset size)199 MPI::File::Preallocate(MPI::Offset size)
200 {
201 (void) MPI_File_preallocate(mpi_file, size);
202 }
203
204
205 inline void
Read(void * buf,int count,const MPI::Datatype & datatype)206 MPI::File::Read(void* buf, int count,
207 const MPI::Datatype& datatype)
208 {
209 MPI_Status status;
210 (void) MPI_File_read(mpi_file, buf, count, datatype, &status);
211 }
212
213
214 inline void
Read(void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)215 MPI::File::Read(void* buf, int count,
216 const MPI::Datatype& datatype,
217 MPI::Status& status)
218 {
219 (void) MPI_File_read(mpi_file, buf, count, datatype, &status.mpi_status);
220 }
221
222
223 inline void
Read_all(void * buf,int count,const MPI::Datatype & datatype)224 MPI::File::Read_all(void* buf, int count,
225 const MPI::Datatype& datatype)
226 {
227 MPI_Status status;
228 (void) MPI_File_read_all(mpi_file, buf, count, datatype, &status);
229 }
230
231
232 inline void
Read_all(void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)233 MPI::File::Read_all(void* buf, int count,
234 const MPI::Datatype& datatype,
235 MPI::Status& status)
236 {
237 (void) MPI_File_read_all(mpi_file, buf, count, datatype, &status.mpi_status);
238 }
239
240
241 inline void
Read_all_begin(void * buf,int count,const MPI::Datatype & datatype)242 MPI::File::Read_all_begin(void* buf, int count,
243 const MPI::Datatype& datatype)
244 {
245 (void) MPI_File_read_all_begin(mpi_file, buf, count, datatype);
246 }
247
248
249 inline void
Read_all_end(void * buf)250 MPI::File::Read_all_end(void* buf)
251 {
252 MPI_Status status;
253 (void) MPI_File_read_all_end(mpi_file, buf, &status);
254 }
255
256
257 inline void
Read_all_end(void * buf,MPI::Status & status)258 MPI::File::Read_all_end(void* buf, MPI::Status& status)
259 {
260 (void) MPI_File_read_all_end(mpi_file, buf, &status.mpi_status);
261 }
262
263
264 inline void
Read_at(MPI::Offset offset,void * buf,int count,const MPI::Datatype & datatype)265 MPI::File::Read_at(MPI::Offset offset,
266 void* buf, int count,
267 const MPI::Datatype& datatype)
268 {
269 MPI_Status status;
270 (void) MPI_File_read_at(mpi_file, offset, buf, count, datatype, &status);
271
272 }
273
274
275 inline void
Read_at(MPI::Offset offset,void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)276 MPI::File::Read_at(MPI::Offset offset, void* buf, int count,
277 const MPI::Datatype& datatype,
278 MPI::Status& status)
279 {
280 (void) MPI_File_read_at(mpi_file, offset, buf, count, datatype,
281 &status.mpi_status);
282 }
283
284
285 inline void
Read_at_all(MPI::Offset offset,void * buf,int count,const MPI::Datatype & datatype)286 MPI::File::Read_at_all(MPI::Offset offset, void* buf, int count,
287 const MPI::Datatype& datatype)
288 {
289 MPI_Status status;
290 (void) MPI_File_read_at_all(mpi_file, offset, buf, count, datatype, &status);
291 }
292
293
294 inline void
Read_at_all(MPI::Offset offset,void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)295 MPI::File::Read_at_all(MPI::Offset offset, void* buf, int count,
296 const MPI::Datatype& datatype,
297 MPI::Status& status)
298 {
299 (void) MPI_File_read_at_all(mpi_file, offset, buf, count, datatype,
300 &status.mpi_status);
301 }
302
303
304 inline void
Read_at_all_begin(MPI::Offset offset,void * buf,int count,const MPI::Datatype & datatype)305 MPI::File::Read_at_all_begin(MPI::Offset offset,
306 void* buf, int count,
307 const MPI::Datatype& datatype)
308 {
309 (void) MPI_File_read_at_all_begin(mpi_file, offset, buf, count, datatype);
310 }
311
312
313 inline void
Read_at_all_end(void * buf)314 MPI::File::Read_at_all_end(void* buf)
315 {
316 MPI_Status status;
317 (void) MPI_File_read_at_all_end(mpi_file, buf, &status);
318 }
319
320
321 inline void
Read_at_all_end(void * buf,MPI::Status & status)322 MPI::File::Read_at_all_end(void* buf, MPI::Status& status)
323 {
324 (void) MPI_File_read_at_all_end(mpi_file, buf, &status.mpi_status);
325 }
326
327
328 inline void
Read_ordered(void * buf,int count,const MPI::Datatype & datatype)329 MPI::File::Read_ordered(void* buf, int count,
330 const MPI::Datatype& datatype)
331 {
332 MPI_Status status;
333 (void) MPI_File_read_ordered(mpi_file, buf, count, datatype, &status);
334 }
335
336
337 inline void
Read_ordered(void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)338 MPI::File::Read_ordered(void* buf, int count,
339 const MPI::Datatype& datatype,
340 MPI::Status& status)
341 {
342 (void) MPI_File_read_ordered(mpi_file, buf, count, datatype,
343 &status.mpi_status);
344 }
345
346
347 inline void
Read_ordered_begin(void * buf,int count,const MPI::Datatype & datatype)348 MPI::File::Read_ordered_begin(void* buf, int count,
349 const MPI::Datatype& datatype)
350 {
351 (void) MPI_File_read_ordered_begin(mpi_file, buf, count, datatype);
352 }
353
354
355 inline void
Read_ordered_end(void * buf)356 MPI::File::Read_ordered_end(void* buf)
357 {
358 MPI_Status status;
359 (void) MPI_File_read_ordered_end(mpi_file, buf, &status);
360 }
361
362
363 inline void
Read_ordered_end(void * buf,MPI::Status & status)364 MPI::File::Read_ordered_end(void* buf, MPI::Status& status)
365 {
366 (void) MPI_File_read_ordered_end(mpi_file, buf, &status.mpi_status);
367 }
368
369
370 inline void
Read_shared(void * buf,int count,const MPI::Datatype & datatype)371 MPI::File::Read_shared(void* buf, int count,
372 const MPI::Datatype& datatype)
373 {
374 MPI_Status status;
375 (void) MPI_File_read_shared(mpi_file, buf, count, datatype, &status);
376 }
377
378
379 inline void
Read_shared(void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)380 MPI::File::Read_shared(void* buf, int count,
381 const MPI::Datatype& datatype,
382 MPI::Status& status)
383 {
384 (void) MPI_File_read_shared(mpi_file, buf, count, datatype,
385 &status.mpi_status);
386 }
387
388 inline void
Seek(MPI::Offset offset,int whence)389 MPI::File::Seek(MPI::Offset offset, int whence)
390 {
391 (void) MPI_File_seek(mpi_file, offset, whence);
392 }
393
394
395 inline void
Seek_shared(MPI::Offset offset,int whence)396 MPI::File::Seek_shared(MPI::Offset offset, int whence)
397 {
398 (void) MPI_File_seek_shared(mpi_file, offset, whence);
399 }
400
401
402 inline void
Set_atomicity(bool flag)403 MPI::File::Set_atomicity(bool flag)
404 {
405 (void) MPI_File_set_atomicity(mpi_file, flag);
406 }
407
408
409 inline void
Set_info(const MPI::Info & info)410 MPI::File::Set_info(const MPI::Info& info)
411 {
412 (void) MPI_File_set_info(mpi_file, info);
413 }
414
415
416 inline void
Set_size(MPI::Offset size)417 MPI::File::Set_size(MPI::Offset size)
418 {
419 (void) MPI_File_set_size(mpi_file, size);
420 }
421
422
423 inline void
Set_view(MPI::Offset disp,const MPI::Datatype & etype,const MPI::Datatype & filetype,const char * datarep,const MPI::Info & info)424 MPI::File::Set_view(MPI::Offset disp,
425 const MPI::Datatype& etype,
426 const MPI::Datatype& filetype,
427 const char* datarep,
428 const MPI::Info& info)
429 {
430 (void) MPI_File_set_view(mpi_file, disp, etype, filetype, const_cast<char *>(datarep),
431 info);
432 }
433
434
435 inline void
Sync()436 MPI::File::Sync()
437 {
438 (void) MPI_File_sync(mpi_file);
439 }
440
441
442 inline void
Write(const void * buf,int count,const MPI::Datatype & datatype)443 MPI::File::Write(const void* buf, int count,
444 const MPI::Datatype& datatype)
445 {
446 MPI_Status status;
447 (void) MPI_File_write(mpi_file, const_cast<void *>(buf), count, datatype, &status);
448 }
449
450
451 inline void
Write(const void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)452 MPI::File::Write(const void* buf, int count,
453 const MPI::Datatype& datatype,
454 MPI::Status& status)
455 {
456 (void) MPI_File_write(mpi_file, const_cast<void *>(buf), count, datatype,
457 &status.mpi_status);
458 }
459
460
461 inline void
Write_all(const void * buf,int count,const MPI::Datatype & datatype)462 MPI::File::Write_all(const void* buf, int count,
463 const MPI::Datatype& datatype)
464 {
465 MPI_Status status;
466 (void) MPI_File_write_all(mpi_file, const_cast<void *>(buf), count, datatype, &status);
467 }
468
469
470
471 inline void
Write_all(const void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)472 MPI::File::Write_all(const void* buf, int count,
473 const MPI::Datatype& datatype,
474 MPI::Status& status)
475 {
476 (void) MPI_File_write_all(mpi_file, const_cast<void *>(buf), count, datatype,
477 &status.mpi_status);
478 }
479
480
481 inline void
Write_all_begin(const void * buf,int count,const MPI::Datatype & datatype)482 MPI::File::Write_all_begin(const void* buf, int count,
483 const MPI::Datatype& datatype)
484 {
485 (void) MPI_File_write_all_begin(mpi_file, const_cast<void *>(buf), count, datatype);
486 }
487
488
489 inline void
Write_all_end(const void * buf)490 MPI::File::Write_all_end(const void* buf)
491 {
492 MPI_Status status;
493 (void) MPI_File_write_all_end(mpi_file, const_cast<void *>(buf), &status);
494 }
495
496
497 inline void
Write_all_end(const void * buf,MPI::Status & status)498 MPI::File::Write_all_end(const void* buf, MPI::Status& status)
499 {
500 (void) MPI_File_write_all_end(mpi_file, const_cast<void *>(buf), &status.mpi_status);
501 }
502
503
504 inline void
Write_at(MPI::Offset offset,const void * buf,int count,const MPI::Datatype & datatype)505 MPI::File::Write_at(MPI::Offset offset,
506 const void* buf, int count,
507 const MPI::Datatype& datatype)
508 {
509 MPI_Status status;
510 (void) MPI_File_write_at(mpi_file, offset, const_cast<void *>(buf), count,
511 datatype, &status);
512 }
513
514
515 inline void
Write_at(MPI::Offset offset,const void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)516 MPI::File::Write_at(MPI::Offset offset,
517 const void* buf, int count,
518 const MPI::Datatype& datatype,
519 MPI::Status& status)
520 {
521 (void) MPI_File_write_at(mpi_file, offset, const_cast<void *>(buf), count,
522 datatype, &status.mpi_status);
523 }
524
525
526 inline void
Write_at_all(MPI::Offset offset,const void * buf,int count,const MPI::Datatype & datatype)527 MPI::File::Write_at_all(MPI::Offset offset,
528 const void* buf, int count,
529 const MPI::Datatype& datatype)
530 {
531 MPI_Status status;
532 (void) MPI_File_write_at_all(mpi_file, offset, const_cast<void *>(buf), count,
533 datatype, &status);
534 }
535
536
537 inline void
Write_at_all(MPI::Offset offset,const void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)538 MPI::File::Write_at_all(MPI::Offset offset,
539 const void* buf, int count,
540 const MPI::Datatype& datatype,
541 MPI::Status& status)
542 {
543 (void) MPI_File_write_at_all(mpi_file, offset, const_cast<void *>(buf), count,
544 datatype, &status.mpi_status);
545 }
546
547
548 inline void
Write_at_all_begin(MPI::Offset offset,const void * buf,int count,const MPI::Datatype & datatype)549 MPI::File::Write_at_all_begin(MPI::Offset offset,
550 const void* buf, int count,
551 const MPI::Datatype& datatype)
552 {
553 (void) MPI_File_write_at_all_begin(mpi_file, offset, const_cast<void *>(buf), count,
554 datatype);
555 }
556
557
558 inline void
Write_at_all_end(const void * buf)559 MPI::File::Write_at_all_end(const void* buf)
560 {
561 MPI_Status status;
562 (void) MPI_File_write_at_all_end(mpi_file, const_cast<void *>(buf), &status);
563 }
564
565
566 inline void
Write_at_all_end(const void * buf,MPI::Status & status)567 MPI::File::Write_at_all_end(const void* buf, MPI::Status& status)
568 {
569 (void) MPI_File_write_at_all_end(mpi_file, const_cast<void *>(buf), &status.mpi_status);
570 }
571
572
573 inline void
Write_ordered(const void * buf,int count,const MPI::Datatype & datatype)574 MPI::File::Write_ordered(const void* buf, int count,
575 const MPI::Datatype& datatype)
576 {
577 MPI_Status status;
578 (void) MPI_File_write_ordered(mpi_file, const_cast<void *>(buf), count, datatype,
579 &status);
580 }
581
582
583 inline void
Write_ordered(const void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)584 MPI::File::Write_ordered(const void* buf, int count,
585 const MPI::Datatype& datatype,
586 MPI::Status& status)
587 {
588 (void) MPI_File_write_ordered(mpi_file, const_cast<void *>(buf), count, datatype,
589 &status.mpi_status);
590 }
591
592
593 inline void
Write_ordered_begin(const void * buf,int count,const MPI::Datatype & datatype)594 MPI::File::Write_ordered_begin(const void* buf, int count,
595 const MPI::Datatype& datatype)
596 {
597 (void) MPI_File_write_ordered_begin(mpi_file, const_cast<void *>(buf), count, datatype);
598 }
599
600
601 inline void
Write_ordered_end(const void * buf)602 MPI::File::Write_ordered_end(const void* buf)
603 {
604 MPI_Status status;
605 (void) MPI_File_write_ordered_end(mpi_file, const_cast<void *>(buf), &status);
606 }
607
608
609 inline void
Write_ordered_end(const void * buf,MPI::Status & status)610 MPI::File::Write_ordered_end(const void* buf,
611 MPI::Status& status)
612 {
613 (void) MPI_File_write_ordered_end(mpi_file, const_cast<void *>(buf), &status.mpi_status);
614 }
615
616
617 inline void
Write_shared(const void * buf,int count,const MPI::Datatype & datatype)618 MPI::File::Write_shared(const void* buf, int count,
619 const MPI::Datatype& datatype)
620 {
621 MPI_Status status;
622 (void) MPI_File_write_shared(mpi_file, const_cast<void *>(buf), count,
623 datatype, &status);
624 }
625
626
627 inline void
Write_shared(const void * buf,int count,const MPI::Datatype & datatype,MPI::Status & status)628 MPI::File::Write_shared(const void* buf, int count,
629 const MPI::Datatype& datatype, MPI::Status& status)
630 {
631 (void) MPI_File_write_shared(mpi_file, const_cast<void *>(buf), count,
632 datatype, &status.mpi_status);
633 }
634
635
636 inline void
Set_errhandler(const MPI::Errhandler & errhandler)637 MPI::File::Set_errhandler(const MPI::Errhandler& errhandler) const
638 {
639 (void)MPI_File_set_errhandler(mpi_file, errhandler);
640 }
641
642
643 inline MPI::Errhandler
Get_errhandler()644 MPI::File::Get_errhandler() const
645 {
646 MPI_Errhandler errhandler;
647 MPI_File_get_errhandler(mpi_file, &errhandler);
648 return errhandler;
649 }
650
651 inline void
Call_errhandler(int errorcode)652 MPI::File::Call_errhandler(int errorcode) const
653 {
654 (void) MPI_File_call_errhandler(mpi_file, errorcode);
655 }
656