class Colls;
class Comm;
class Datatype;
+class File;
class Group;
class Info;
class Keyval;
typedef simgrid::smpi::Comm SMPI_Comm;
typedef simgrid::smpi::Datatype SMPI_Datatype;
+typedef simgrid::smpi::File SMPI_File;
typedef simgrid::smpi::Group SMPI_Group;
typedef simgrid::smpi::Info SMPI_Info;
typedef simgrid::smpi::Op SMPI_Op;
typedef struct SMPI_Comm SMPI_Comm;
typedef struct SMPI_Datatype SMPI_Datatype;
+typedef struct SMPI_File SMPI_File;
typedef struct SMPI_Group SMPI_Group;
typedef struct SMPI_Info SMPI_Info;
typedef struct SMPI_Op SMPI_Op;
typedef long long MPI_Offset;
typedef long long MPI_Count;
-struct s_MPI_File;
-typedef struct s_MPI_File *MPI_File;
-
-
+typedef SMPI_File *MPI_File;
typedef SMPI_Datatype *MPI_Datatype;
typedef struct {
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_create_errhandler,(MPI_File_errhandler_function *function, MPI_Errhandler *errhandler),(function, errhandler))
UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int, MPI_File_set_errhandler,( MPI_File file, MPI_Errhandler errhandler), (file, errhandler))
UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int, MPI_File_get_errhandler,( MPI_File file, MPI_Errhandler *errhandler), (file, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_open,(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh),(comm, filename, amode, info, fh))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_close,(MPI_File *fh), (fh))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_delete,(char *filename, MPI_Info info), (filename, info))
+WRAPPED_PMPI_CALL(int, MPI_File_open,(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh),(comm, filename, amode, info, fh))
+WRAPPED_PMPI_CALL(int, MPI_File_close,(MPI_File *fh), (fh))
+WRAPPED_PMPI_CALL(int, MPI_File_delete,(char *filename, MPI_Info info), (filename, info))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_set_size,(MPI_File fh, MPI_Offset size), (fh, size))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_preallocate,(MPI_File fh, MPI_Offset size), (fh, size))
UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_get_size,(MPI_File fh, MPI_Offset *size), (fh, size))
--- /dev/null
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */\r
+\r
+/* This program is free software; you can redistribute it and/or modify it\r
+ * under the terms of the license (GNU LGPL) which comes with this package. */\r
+\r
+#include "private.hpp"\r
+#include "smpi_file.hpp"\r
+\r
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);\r
+\r
+int PMPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh){\r
+ if (comm == MPI_COMM_NULL) {\r
+ return MPI_ERR_COMM;\r
+ } else if (filename == nullptr) {\r
+ return MPI_ERR_FILE;\r
+ } else if (amode < 0) {\r
+ return MPI_ERR_AMODE;\r
+ } else {\r
+ smpi_bench_end();\r
+ *fh = new simgrid::smpi::File(comm, filename, amode, info);\r
+ smpi_bench_begin();\r
+ if((*fh)->size()==0 && not amode & MPI_MODE_CREATE){\r
+ delete fh;\r
+ return MPI_ERR_AMODE;\r
+ }\r
+ return MPI_SUCCESS;\r
+ }\r
+}\r
+\r
+int PMPI_File_close(MPI_File *fh){\r
+ if (fh==nullptr){\r
+ return MPI_ERR_ARG;\r
+ } else {\r
+ smpi_bench_end();\r
+ int ret = simgrid::smpi::File::close(fh);\r
+ *fh = MPI_FILE_NULL;\r
+ smpi_bench_begin();\r
+ return ret;\r
+ }\r
+}\r
+\r
+int PMPI_File_delete(char *filename, MPI_Info info){\r
+ if (filename == nullptr) {\r
+ return MPI_ERR_FILE;\r
+ } else {\r
+ smpi_bench_end();\r
+ int ret = simgrid::smpi::File::del(filename, info);\r
+ smpi_bench_begin();\r
+ return ret;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2010-2019. The SimGrid Team.\r
+ * All rights reserved. */\r
+\r
+/* This program is free software; you can redistribute it and/or modify it\r
+ * under the terms of the license (GNU LGPL) which comes with this package. */\r
+\r
+#ifndef SMPI_FILE_HPP_INCLUDED\r
+#define SMPI_FILE_HPP_INCLUDED\r
+#include "simgrid/plugins/file_system.h"\r
+\r
+\r
+namespace simgrid{\r
+namespace smpi{\r
+class File{\r
+ MPI_Comm comm_;\r
+ int flags_;\r
+ simgrid::s4u::File* file_;\r
+ MPI_Info info_;\r
+ public:\r
+ File(MPI_Comm comm, char *filename, int amode, MPI_Info info);\r
+ ~File();\r
+ int size();\r
+ int flags();\r
+ int sync();\r
+ static int close(MPI_File *fh);\r
+ static int del(char *filename, MPI_Info info);\r
+};\r
+}\r
+}\r
+#endif
\ No newline at end of file
--- /dev/null
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */\r
+\r
+/* This program is free software; you can redistribute it and/or modify it\r
+ * under the terms of the license (GNU LGPL) which comes with this package. */\r
+#include "private.hpp"\r
+\r
+#include "smpi_comm.hpp"\r
+#include "smpi_coll.hpp"\r
+#include "smpi_info.hpp"\r
+#include "smpi_file.hpp"\r
+#include "simgrid/plugins/file_system.h"\r
+\r
+\r
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_io, smpi, "Logging specific to SMPI (RMA operations)");\r
+\r
+\r
+namespace simgrid{\r
+namespace smpi{\r
+ File::File(MPI_Comm comm, char *filename, int amode, MPI_Info info): comm_(comm), flags_(amode), info_(info){\r
+ file_= new simgrid::s4u::File(filename, nullptr);\r
+ }\r
+ \r
+ File::~File(){\r
+ delete file_;\r
+ }\r
+ \r
+ int File::close(MPI_File *fh){\r
+ (*fh)->sync();\r
+ if((*fh)->flags() & MPI_MODE_DELETE_ON_CLOSE)\r
+ (*fh)->file_->unlink();\r
+ delete fh;\r
+ return MPI_SUCCESS;\r
+ }\r
+ \r
+ int File::del(char *filename, MPI_Info info){\r
+ File* f = new File(MPI_COMM_SELF,filename,MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDWR, nullptr);\r
+ close(&f);\r
+ return MPI_SUCCESS;\r
+ }\r
+ \r
+ int File::size(){\r
+ return file_->size();\r
+ }\r
+ \r
+ int File::flags(){\r
+ return flags_;\r
+ }\r
+ int File::sync(){\r
+ //no idea\r
+ return simgrid::smpi::Colls::barrier(comm_);\r
+ }\r
+}\r
+}
\ No newline at end of file
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/bindings/smpi_pmpi_comm.cpp
+ src/smpi/bindings/smpi_pmpi_file.cpp
src/smpi/bindings/smpi_pmpi_group.cpp
src/smpi/bindings/smpi_pmpi_info.cpp
src/smpi/bindings/smpi_pmpi_op.cpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_datatype_derived.cpp
src/smpi/mpi/smpi_f2c.cpp
+ src/smpi/mpi/smpi_file.cpp
src/smpi/mpi/smpi_group.cpp
src/smpi/mpi/smpi_info.cpp
src/smpi/mpi/smpi_keyvals.cpp
src/smpi/include/smpi_datatype_derived.hpp
src/smpi/include/smpi_datatype.hpp
src/smpi/include/smpi_f2c.hpp
+ src/smpi/include/smpi_file.hpp
src/smpi/include/smpi_group.hpp
src/smpi/include/smpi_host.hpp
src/smpi/include/smpi_info.hpp