1 /* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
\r
3 /* This program is free software; you can redistribute it and/or modify it
\r
4 * under the terms of the license (GNU LGPL) which comes with this package. */
\r
6 #include "private.hpp"
\r
7 #include "smpi_file.hpp"
\r
9 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
\r
11 int PMPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh){
\r
12 if (comm == MPI_COMM_NULL) {
\r
13 return MPI_ERR_COMM;
\r
14 } else if (filename == nullptr) {
\r
15 return MPI_ERR_FILE;
\r
16 } else if (amode < 0) {
\r
17 return MPI_ERR_AMODE;
\r
20 *fh = new simgrid::smpi::File(comm, filename, amode, info);
\r
22 if((*fh)->size()==0 && not amode & MPI_MODE_CREATE){
\r
24 return MPI_ERR_AMODE;
\r
30 int PMPI_File_close(MPI_File *fh){
\r
35 int ret = simgrid::smpi::File::close(fh);
\r
36 *fh = MPI_FILE_NULL;
\r
42 int PMPI_File_delete(char *filename, MPI_Info info){
\r
43 if (filename == nullptr) {
\r
44 return MPI_ERR_FILE;
\r
47 int ret = simgrid::smpi::File::del(filename, info);
\r