Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement MPI_File_get_type_extent, MPI_File_s/get_atomicity, MPI_File_get_byte_offset
authorAugustin Degomme <adegomme@users.noreply.github.com>
Tue, 9 Aug 2022 13:56:32 +0000 (15:56 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Tue, 9 Aug 2022 14:29:43 +0000 (16:29 +0200)
src/smpi/bindings/smpi_mpi.cpp
src/smpi/bindings/smpi_pmpi_file.cpp
src/smpi/mpi/smpi_file.cpp

index 0144bc6..5db772d 100644 (file)
@@ -395,6 +395,10 @@ WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_set_errhandler,( MPI_File fh, MP
 WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_get_errhandler,( MPI_File fh, MPI_Errhandler *errhandler), (fh, errhandler))
 WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_set_view,(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char *datarep, MPI_Info info), (fh, disp, etype, filetype, datarep, info))
 WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_get_view,(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, char *datarep), (fh, disp, etype, filetype, datarep))
+WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_get_type_extent,(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent), (fh, datatype, extent))
+WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_set_atomicity,(MPI_File fh, int flag), (fh, flag))
+WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_get_atomicity,(MPI_File fh, int *flag), (fh, flag))
+WRAPPED_PMPI_CALL_ERRHANDLER_FILE(int, MPI_File_get_byte_offset,(MPI_File fh, MPI_Offset offset, MPI_Offset *disp), (fh, offset, disp))
 /*
   Unimplemented Calls - both PMPI and MPI calls are generated.
   When implementing, please move ahead, swap UNIMPLEMENTED_WRAPPED_PMPI_CALL for WRAPPED_PMPI_CALL,
@@ -433,7 +437,6 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_iread,(MPI_File fh, void *buf, int
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_iwrite,(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request), (fh, buf, count, datatype, request))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_iread_all,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request), (fh, buf, count, datatype, request))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_iwrite_all,(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request), (fh, buf, count, datatype, request))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_get_byte_offset,(MPI_File fh, MPI_Offset offset, MPI_Offset *disp), (fh, offset, disp))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_iread_shared,(MPI_File fh, void *buf, int count,MPI_Datatype datatype, MPI_Request *request), (fh, buf, count, datatype, request))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_iwrite_shared,(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request), (fh, buf, count, datatype, request))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_read_at_all_begin,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype), (fh, offset, buf, count, datatype))
@@ -448,9 +451,6 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_read_ordered_begin,(MPI_File fh, v
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_read_ordered_end,(MPI_File fh, void *buf, MPI_Status *status), (fh, buf, status))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_write_ordered_begin,(MPI_File fh, const void *buf, int count, MPI_Datatype datatype), (fh, buf, count, datatype))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_write_ordered_end,(MPI_File fh, const void *buf, MPI_Status *status), (fh, buf, status))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_get_type_extent,(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent), (fh, datatype, extent))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_set_atomicity,(MPI_File fh, int flag), (fh, flag))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_get_atomicity,(MPI_File fh, int *flag), (fh, flag))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Get_elements,(MPI_Status* status, MPI_Datatype datatype, int* elements) ,(status, datatype, elements))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Get_elements_x,(MPI_Status* status, MPI_Datatype datatype, MPI_Count* elements) ,(status, datatype, elements))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Graph_create,(MPI_Comm comm_old, int nnodes, const int* index, const int* edges, int reorder, MPI_Comm* comm_graph) ,(comm_old, nnodes, index, edges, reorder, comm_graph))
index e87680f..1faed5f 100644 (file)
@@ -367,3 +367,31 @@ int PMPI_File_call_errhandler(MPI_File file,int errorcode){
   simgrid::smpi::Errhandler::unref(err);
   return MPI_SUCCESS;
 }
+
+int PMPI_File_get_type_extent(MPI_File fh, MPI_Datatype
+    datatype, MPI_Aint *extent){
+  CHECK_FILE(1, fh)
+  CHECK_TYPE(2, datatype)
+  CHECK_NULL(3, MPI_ERR_OTHER, extent)
+  *extent = datatype->get_extent();
+  return MPI_SUCCESS;
+}
+
+int PMPI_File_set_atomicity(MPI_File fh, int a){
+  CHECK_FILE(1, fh)
+  fh->set_atomicity(a != 0);
+  return MPI_SUCCESS;
+}
+
+int PMPI_File_get_atomicity(MPI_File fh, int* a){
+  CHECK_FILE(1, fh)
+  *a = fh->get_atomicity();
+  return MPI_SUCCESS;
+}
+
+int PMPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp){
+  CHECK_FILE(1, fh)
+  CHECK_NULL(3, MPI_ERR_OTHER, disp)
+  *disp = offset * fh->etype()->get_extent();
+  return MPI_SUCCESS;
+}
index b832510..9eac544 100644 (file)
@@ -49,9 +49,12 @@ File::File(MPI_Comm comm, const char* filename, int amode, MPI_Info info) : comm
       fullname.insert(0, mount);
     }
   }
-
+  XBT_DEBUG("Opening %s", fullname.c_str());
   file_ = simgrid::s4u::File::open(fullname, nullptr);
   list_ = nullptr;
+  disp_ = 0;
+  etype_ = MPI_BYTE;
+  atomicity_ = true;
   if (comm_->rank() == 0) {
     int size    = comm_->size() + FP_SIZE;
     list_       = new char[size];
@@ -299,6 +302,11 @@ int File::flags() const
   return flags_;
 }
 
+MPI_Datatype File::etype() const
+{
+  return etype_;
+}
+
 int File::sync()
 {
   // no idea
@@ -344,4 +352,13 @@ File* File::f2c(int id)
 {
   return static_cast<File*>(F2C::f2c(id));
 }
+
+void File::set_atomicity(bool a){
+  atomicity_ = a;
+}
+
+bool File::get_atomicity(){
+  return atomicity_;
+}
+
 } // namespace simgrid::smpi