add workaround for compilation error with MPIIO on windows due to old ROMIO API

This commit is contained in:
Axel Kohlmeyer 2020-06-05 11:03:17 -04:00
parent ad76f5267b
commit 9ba84f37d7
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
1 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,14 @@
using namespace LAMMPS_NS;
// the (rather old) version of ROMIO in MPICH for Windows
// uses "char *" instead of "const char *". This works around it.
#if defined(_WIN32)
#define ROMIO_COMPAT_CAST (char *)
#else
#define ROMIO_COMPAT_CAST
#endif
/* ---------------------------------------------------------------------- */
RestartMPIIO::RestartMPIIO(LAMMPS *lmp) : Pointers(lmp)
@ -38,7 +46,7 @@ RestartMPIIO::RestartMPIIO(LAMMPS *lmp) : Pointers(lmp)
void RestartMPIIO::openForRead(const char *filename)
{
int err = MPI_File_open(world, filename, MPI_MODE_RDONLY ,
int err = MPI_File_open(world, ROMIO_COMPAT_CAST filename, MPI_MODE_RDONLY,
MPI_INFO_NULL, &mpifh);
if (err != MPI_SUCCESS) {
char str[MPI_MAX_ERROR_STRING+128];
@ -58,7 +66,7 @@ void RestartMPIIO::openForRead(const char *filename)
void RestartMPIIO::openForWrite(const char *filename)
{
int err = MPI_File_open(world, filename, MPI_MODE_WRONLY,
int err = MPI_File_open(world, ROMIO_COMPAT_CAST filename, MPI_MODE_WRONLY,
MPI_INFO_NULL, &mpifh);
if (err != MPI_SUCCESS) {
char str[MPI_MAX_ERROR_STRING+128];