Fix problems with intel-mpi
authorRoland Schulz <roland@utk.edu>
Mon, 11 Mar 2013 05:19:46 +0000 (01:19 -0400)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 22 Mar 2013 12:27:52 +0000 (13:27 +0100)
The mpich version with intel-mpi has a naming conflict of SEEK_SET
between stdio and the C++ binding of MPI. It would be sufficient
to set MPICH_IGNORE_CXX_SEEK or change the include order, but
given that the C++ binding is deprecated and not used it seems
more constistent to simply disable the MPI C++ binding as a whole.

Also moves the #ifdef for lib-mpi/thread-mpi into one file
and thus simplifies the code.

Change-Id: I9702b840f1d1ac51e99b610a7c125d97cda69164

22 files changed:
src/contrib/pmetest.c
src/contrib/runner_openmm.c
src/gromacs/gmxlib/gmx_fatal.c
src/gromacs/gmxlib/network.c
src/gromacs/gmxlib/smalloc.c
src/gromacs/legacyheaders/types/commrec.h
src/gromacs/mdlib/domdec.c
src/gromacs/mdlib/domdec_network.c
src/gromacs/mdlib/expanded.c
src/gromacs/mdlib/fft5d.cpp
src/gromacs/mdlib/genborn.c
src/gromacs/mdlib/genborn_sse2_double.c
src/gromacs/mdlib/genborn_sse2_single.c
src/gromacs/mdlib/gmx_parallel_3dfft.c
src/gromacs/mdlib/gmx_wallcycle.c
src/gromacs/mdlib/pme.c
src/gromacs/mdlib/pme_pp.c
src/gromacs/mdlib/sim_util.c
src/gromacs/utility/CMakeLists.txt
src/gromacs/utility/gmxmpi.h [new file with mode: 0644]
src/programs/mdrun/md.c
src/programs/mdrun/runner.c

index 494bc32d0f05b992cc9516742f2051be4db75b68..00a7b4e352082591bbd9e1d8338ecd1cd37e0c42 100644 (file)
 #include "xvgr.h"
 #include "pbc.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #include "block_tx.h"
 
index a04b61898132532a585b144034cd6aa74dba0abd..fd3581eeee2b1469bf5326f23b85b35a989c501f 100644 (file)
 
 #include "thread_mpi/threads.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #ifdef GMX_FAHCORE
 #include "corewrap.h"
index a466a5e0d0c3057d48e47785a9bb07927c7fd120..d86e196a0dd3b294befe71b06c26f72fdf4a94f1 100644 (file)
 #include "smalloc.h"
 #include "gmxfio.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 static gmx_bool bDebug         = FALSE;
 static char    *fatal_tmp_file = NULL;
 static FILE    *log_file       = NULL;
 
 #ifdef GMX_THREAD_MPI
+#include "thread_mpi/threads.h"
 static tMPI_Thread_mutex_t debug_mutex     = TMPI_THREAD_MUTEX_INITIALIZER;
 static tMPI_Thread_mutex_t where_mutex     = TMPI_THREAD_MUTEX_INITIALIZER;
 static tMPI_Thread_mutex_t fatal_tmp_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
index 9e3f501f828ec2bcf3d152c813978af9ff832556..4236850c26c7ee7835ba0127e43ba35cf5b305d4 100644 (file)
 #include <ctype.h>
 #include "macros.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 
 /* The source code in this file should be thread-safe.
index 014dbbdb6c409513c365234f70ba103d9eea6566..a21cd8a32ffbe309f4b6f8ab5179cf4419831c6d 100644 (file)
 
 /* This file is completely threadsafe - keep it that way! */
 
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi/threads.h"
-#endif
-
+#include "gromacs/utility/gmxmpi.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -162,7 +159,6 @@ void *save_calloc(const char *name, const char *file, int line,
         if (nelem*elsize >= PRINT_ALLOC_KB*1024)
         {
 #ifdef GMX_MPI
-#include <mpi.h>
             MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 #endif
             printf("Allocating %.1f MB for %s (called from file %s, line %d on %d)\n",
@@ -217,7 +213,6 @@ void *save_realloc(const char *name, const char *file, int line, void *ptr,
         if (size >= PRINT_ALLOC_KB*1024)
         {
 #ifdef GMX_MPI
-#include <mpi.h>
             MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 #endif
             printf("Reallocating %.1f MB for %s (called from file %s, line %d on %d)\n",
index 01629062ac1113f0e3ed5b7e55754ae5cfeb4133..c85ee655236457fd540dee2a40b94e2a54ac6b0a 100644 (file)
 #ifndef _commrec_h
 #define _commrec_h
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#else
-#ifdef GMX_THREAD_MPI
-#include "../thread_mpi/tmpi.h"
-#include "../thread_mpi/mpi_bindings.h"
-#else
-typedef void* MPI_Comm;
-typedef void* MPI_Request;
-typedef void* MPI_Group;
-#define MPI_COMM_NULL NULL
-#endif
-#endif
-
+#include "../../utility/gmxmpi.h"
 #include "idef.h"
 
 #ifdef __cplusplus
index 250d859a2a681b4a258246accc2f6c45d9d4d267..25ef8e79b034fac81cfb17b0c2d266d27029d1e5 100644 (file)
 #include "bondf.h"
 #include "gmx_omp_nthreads.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #define DDRANK(dd, rank)    (rank)
 #define DDMASTERRANK(dd)   (dd->masterrank)
index 8463e449d79e283a6ea899abcb180a33b2428a77..f2cde6b101e03bbe04763806dd7be041a03cc6da 100644 (file)
 #include <string.h>
 #include "domdec_network.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 
 #define DDMASTERRANK(dd)   (dd->masterrank)
index a14f2edbfe61efd1859171b1e7d2f05d94b25d66..617647fdb51d292d64255e43d553ebba1735b2ae 100644 (file)
 #include "gmx_wallcycle.h"
 #include "macros.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREADS
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 void GenerateGibbsProbabilities(real *ene, real *p_k, real *pks, int minfep, int maxfep)
 {
index 2682e78b4fd27b7cd3cf32eaf7723b1694161d9b..368a4ac34e45199b7080becd70a74d960c1be4dd 100644 (file)
 #endif
 #endif
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #ifdef GMX_OPENMP
 /* TODO: Do we still need this? Are we still planning ot use fftw + OpenMP? */
index a74e3490198fb1cef4b7c72dc4507dcb66e961a4..f0cf62abfa784a240be99f6617e79a60ea101976 100644 (file)
 #include "nrnb.h"
 #include "bondf.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #ifdef GMX_X86_SSE2
 #  ifdef GMX_DOUBLE
index 5748f8e69f350866436fdc3764cb68870c1e3713..8ca6b5bb0f038c8a0e4fd8851de63870d7c259c3 100644 (file)
 #include "mtop_util.h"
 #include "genborn.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 /* Only compile this file if SSE2 intrinsics are available */
 #if 0 && defined (GMX_X86_SSE2)
index e276996c47384374a8501df72ca6a0ef58f4d882..7c9740b74bc86e4e602092dea7dae22ac13fc210 100644 (file)
 #include "mtop_util.h"
 #include "genborn.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 
 /* Only compile this file if SSE intrinsics are available */
index 306ee0e0a611dc707e6e66469c6d3c13570d156c..cfcf557e69e83c52d43a8b762c5d24b6f7f395a9 100644 (file)
 #include <string.h>
 #include <errno.h>
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #include "smalloc.h"
 #include "gmx_parallel_3dfft.h"
index 241611c7ce09fd2b49bc1e7126ced73e8740baf0..ff9e49dbf6cba88d59c10a845999ab6de99b8cc8 100644 (file)
 #include "md_logging.h"
 #include "string2.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 /* DEBUG_WCYCLE adds consistency checking for the counters.
  * It checks if you stop a counter different from the last
index 6927eace8018b719b2da49435e6770c491654aa6..cd59ff79893816d5665f3a643489c04123bf2500 100644 (file)
 #include <config.h>
 #endif
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #include <stdio.h>
 #include <string.h>
index a597540351952ef5cfec4217f423905ceef14066..f84c07983ca2bc7f02b5f9e1858c116221e30417 100644 (file)
 #include "domdec.h"
 #include "sighandler.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #define PP_PME_CHARGE         (1<<0)
 #define PP_PME_CHARGEB        (1<<1)
index 012d7f547a231628f16efd735f6c578d118b2ff6..52cd0b8816660ad615ab7a1b962d6a6995af2b62 100644 (file)
 #include "nbnxn_kernels/nbnxn_kernel_simd_2xnn.h"
 #include "nbnxn_kernels/nbnxn_kernel_gpu_ref.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #include "adress.h"
 #include "qmmm.h"
index c25240a2debbee70c467b67ff281e0be81f84b1e..dc09af3c884a091e25fa4b959611fe3e7761174b 100644 (file)
@@ -48,6 +48,7 @@ set(UTILITY_PUBLIC_HEADERS
     flags.h
     gmx_header_config.h
     gmxassert.h
+    gmxmpi.h
     programinfo.h
     stringutil.h
     uniqueptr.h)
diff --git a/src/gromacs/utility/gmxmpi.h b/src/gromacs/utility/gmxmpi.h
new file mode 100644 (file)
index 0000000..292c7cd
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2013, by the GROMACS development team, led by
+ * David van der Spoel, Berk Hess, Erik Lindahl, and including many
+ * others, as listed in the AUTHORS file in the top-level source
+ * directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#ifndef GMX_UTILITY_GMXMPI_H
+#define GMX_UTILITY_GMXMPI_H
+
+#ifdef GMX_LIB_MPI
+/* MPI C++ binding is deprecated and can cause name conflicts (e.g. stdio/mpi seek) */
+#define MPICH_SKIP_MPICXX 1
+#define OMPI_SKIP_MPICXX 1
+#include <mpi.h>
+#else
+#ifdef GMX_THREAD_MPI
+#include "thread_mpi/tmpi.h"
+#include "thread_mpi/mpi_bindings.h"
+#else
+typedef void* MPI_Comm;
+typedef void* MPI_Request;
+typedef void* MPI_Group;
+#define MPI_COMM_NULL NULL
+#endif
+#endif
+
+#endif
index fd9d033b50395a90a6a3758cf924fcf4364f8611..81d9a2ba615439397c765819602062f70eaa062f 100644 (file)
 #include "types/iteratedconstraints.h"
 #include "nbnxn_cuda_data_mgmt.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #ifdef GMX_FAHCORE
 #include "corewrap.h"
index 795fb5412c7135aac4dcc09e9dbcb0eebf8954af..fb3cecf874f1b13ea60f089ac389acb4d49a57c6 100644 (file)
 #include "gmx_omp.h"
 #include "gmx_thread_affinity.h"
 
-#ifdef GMX_LIB_MPI
-#include <mpi.h>
-#endif
-#ifdef GMX_THREAD_MPI
-#include "tmpi.h"
-#endif
+#include "gromacs/utility/gmxmpi.h"
 
 #ifdef GMX_FAHCORE
 #include "corewrap.h"