Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add support for MPI Errhandlers in Comm, File, Win.
[simgrid.git] / src / smpi / include / smpi_file.hpp
index bd49500..3feb57f 100644 (file)
@@ -10,6 +10,7 @@
 #include "smpi_comm.hpp"
 #include "smpi_coll.hpp"
 #include "smpi_datatype.hpp"
+#include "smpi_errhandler.hpp"
 #include "smpi_info.hpp"
 #include  <algorithm>
 
@@ -26,8 +27,10 @@ class File{
   s4u::MutexPtr shared_mutex_;
   MPI_Win win_;
   char* list_;
+  MPI_Errhandler errhandler_;
+
   public:
-  File(MPI_Comm comm, char *filename, int amode, MPI_Info info);
+  File(MPI_Comm comm, const char *filename, int amode, MPI_Info info);
   File(const File&) = delete;
   File& operator=(const File&) = delete;
   ~File();
@@ -35,6 +38,7 @@ class File{
   int get_position(MPI_Offset* offset);
   int get_position_shared(MPI_Offset* offset);
   int flags();
+  MPI_Comm comm();
   int sync();
   int seek(MPI_Offset offset, int whence);
   int seek_shared(MPI_Offset offset, int whence);
@@ -44,11 +48,13 @@ class File{
   static int read_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
   static int read_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
   static int write(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
-  static int write_shared(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
-  static int write_ordered(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
+  static int write_shared(MPI_File fh, const void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
+  static int write_ordered(MPI_File fh, const void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
   template <int (*T)(MPI_File, void *, int, MPI_Datatype, MPI_Status *)> int op_all(void *buf, int count,MPI_Datatype datatype, MPI_Status *status);
   static int close(MPI_File *fh);
-  static int del(char *filename, MPI_Info info);
+  static int del(const char *filename, MPI_Info info);
+  MPI_Errhandler errhandler();
+  void set_errhandler( MPI_Errhandler errhandler);
 };
 
   /* Read_all, Write_all : loosely based on */
@@ -159,7 +165,7 @@ class File{
     }
     XBT_CDEBUG(smpi_pmpi, "will have to access %lld from my chunk", totreads);
 
-    char* sendbuf= static_cast<char *>(smpi_get_tmp_sendbuffer(total_sent));
+    unsigned char* sendbuf = smpi_get_tmp_sendbuffer(total_sent);
 
     if(totreads>0){
       seek(min_offset, MPI_SEEK_SET);