Move some defines to gmxpre.h for thread-MPI
authorTeemu Murtola <teemu.murtola@gmail.com>
Fri, 5 Sep 2014 18:55:55 +0000 (21:55 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Fri, 5 Sep 2014 18:55:55 +0000 (21:55 +0300)
Thread-MPI requires TMPI_WAIT_FOR_NO_ONE to be defined consistently in
all code that may use structs that use TMPI_YIELD_WAIT_DATA, and there
are several of those structs.  Moved the definition for this macro to
gmxpre.h, so that it should be defined everywhere and not cause
surprises.  Rationale for not moving any other defines (some are used by
thread_mpi/include/*) is given in comments, and if/when thread-MPI is
going to disappear sooner or later, there hopefully will not be much
more code introduced that would depend on it and would require a more
robust mechanism, or warrant changing thread-MPI itself.

Change-Id: Ic9f1c2c63fee183e65506f06fdc84d10cc5f97b9

src/config.h.cmakein
src/gmxpre-config.h.cmakein

index 4fdf9d7369a3755e0fa73ef3a751dd3a2590dc6b..4dffa2952a5f61382eb1f66d7fc155b671c62bc0 100644 (file)
@@ -43,6 +43,7 @@
  */
 #ifndef GMX_CONFIG_H
 #define GMX_CONFIG_H
+
 #include "gromacs/utility/gmx_header_config.h"
 
 /* TODO: For now, disable Doxygen warnings from here */
 #cmakedefine TMPI_ATOMICS
 
 /* Define for busy wait option  */
+/* See gmxpre-config.h.cmakein for explanation for the #ifdef */
+#ifndef TMPI_WAIT_FOR_NO_ONE
 #cmakedefine TMPI_WAIT_FOR_NO_ONE
+#endif
 
 /* Define for copy buffer option */
 #cmakedefine TMPI_COPY_BUFFER
 /* Define if we have zlib */
 #cmakedefine HAVE_ZLIB
 
-#endif
-
 /*! \endcond */
+
+#endif
index 3317938db01cd94690c6c99d3a8d8afae61c204d..2f840259d01080427afd3a322a9dfdc4b83577cb 100644 (file)
 /* Build special-purpose mdrun library */
 #cmakedefine GMX_FAHCORE
 
+/* This is here for simplicity, since the layout for some thread-MPI structs
+ * declared in headers depend on this being consistently defined.
+ * But thread-MPI itself does not include gmxpre.h, so the same define is also
+ * set in config.h (which gets included by thread-MPI, but only in the source
+ * files). There are some other config.h defines that appear in thread-MPI
+ * headers, but currently Gromacs does not use any code that would depend on
+ * those, and for thread-MPI, config.h provides the definitions wherever
+ * required. */
+/* Define for busy wait option  */
+#cmakedefine TMPI_WAIT_FOR_NO_ONE
+