diff --git a/source/adios2/helper/mpidummy.cpp b/source/adios2/helper/mpidummy.cpp index 03d32fd5b8..618a0ce721 100644 --- a/source/adios2/helper/mpidummy.cpp +++ b/source/adios2/helper/mpidummy.cpp @@ -299,77 +299,6 @@ int MPI_Wait(MPI_Request * /*request*/, MPI_Status * /*status*/) RETURN_CHECK(MPI_SUCCESS); } -#ifndef ADIOS2_HAVE_MPI - -int MPI_File_open(MPI_Comm /*comm*/, const char *filename, int amode, - MPI_Info /*info*/, MPI_File *fh) -{ - std::string mode; - if (amode | MPI_MODE_RDONLY) - { - mode += "r"; - } - if (amode | MPI_MODE_WRONLY) - { - mode += "w"; - } - if (amode | MPI_MODE_APPEND) - { - mode += "a"; - } - mode += "b"; - - *fh = std::fopen(filename, mode.c_str()); - if (!*fh) - { - return -1; - } - RETURN_CHECK(MPI_SUCCESS); -} - -int MPI_File_close(MPI_File *fh) { return fclose(*fh); } - -int MPI_File_get_size(MPI_File fh, MPI_Offset *size) -{ - long curpos = std::ftell(fh); - fseek(fh, 0, SEEK_END); // go to end, returned is the size in bytes - long endpos = std::ftell(fh); - std::fseek(fh, curpos, SEEK_SET); // go back where we were - *size = static_cast(endpos); - // printf("MPI_File_get_size: fh=%d, size=%lld\n", fh, *size); - RETURN_CHECK(MPI_SUCCESS); -} - -int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status) -{ - // FIXME: int count can read only 2GB (*datatype size) array at max - size_t bytes_to_read = static_cast(count) * datatype; - size_t bytes_read; - bytes_read = std::fread(buf, 1, bytes_to_read, fh); - if (bytes_read != bytes_to_read) - { - return -2; - } - *status = bytes_read; - // printf("MPI_File_read: fh=%d, count=%d, typesize=%d, bytes read=%lld\n", - // fh, count, datatype, *status); - RETURN_CHECK(MPI_SUCCESS); -} - -int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence) -{ - return std::fseek(fh, offset, whence) == MPI_SUCCESS; -} - -int MPI_Get_count(const MPI_Status *status, MPI_Datatype, int *count) -{ - *count = static_cast(*status); - RETURN_CHECK(MPI_SUCCESS); -} - -#endif - double MPI_Wtime() { std::chrono::duration now = diff --git a/source/adios2/helper/mpidummy.h b/source/adios2/helper/mpidummy.h index 6415ada89a..ba2e8f69a7 100644 --- a/source/adios2/helper/mpidummy.h +++ b/source/adios2/helper/mpidummy.h @@ -24,10 +24,8 @@ typedef int MPI_Comm; typedef uint64_t MPI_Status; typedef uint64_t MPI_Request; -typedef FILE *MPI_File; typedef int MPI_Info; typedef int MPI_Datatype; -typedef long int MPI_Offset; typedef int MPI_Fint; typedef int MPI_Op; @@ -168,15 +166,6 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status); int MPI_Type_size(MPI_Datatype datatype, int *size); -int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, - MPI_File *fh); -int MPI_File_close(MPI_File *fh); -int MPI_File_get_size(MPI_File fh, MPI_Offset *size); -int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, - MPI_Status *status); -int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence); - -int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count); int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out); int MPI_Get_processor_name(char *name, int *resultlen);