Define MPI_INT64_T if not defined by mpi
authorRoland Schulz <roland@utk.edu>
Wed, 15 Jan 2014 19:15:33 +0000 (14:15 -0500)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 17 Jan 2014 14:20:34 +0000 (15:20 +0100)
Change-Id: Ie3332ce85a5ef538d57b272ebe3e4326fb7a31ff

src/gromacs/utility/gmxmpi.h

index 1b0dbe682328e9dd834ebfacb85f241bc18d5ef1..3b36a87db22f3bfff10030d1c8497617ee8eacc7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
 #define MPICH_SKIP_MPICXX 1
 #define OMPI_SKIP_MPICXX 1
 #include <mpi.h>
+/* Starting with 2.2 MPI_INT64_T is required. Earlier version still might have it.
+   In theory MPI_Datatype doesn't have to be a #define, but current available MPI
+   implementations (OpenMPI + MPICH (+derivates)) use #define and future versions
+   should support 2.2. */
+#if (MPI_VERSION == 1 || (MPI_VERSION == 2 && MPI_SUBVERSION < 2)) && !defined MPI_INT64_T
+#include <limits.h>
+#if LONG_MAX == 9223372036854775807L
+#define MPI_INT64_T MPI_LONG
+#elif LONG_LONG_MAX == 9223372036854775807L
+#define MPI_INT64_T MPI_LONG_LONG
+#else
+#error No MPI_INT64_T and no 64 bit integer found.
+#endif
+#endif /*MPI_INT64_T*/
 #else
 #ifdef GMX_THREAD_MPI
 #include "../legacyheaders/thread_mpi/tmpi.h"