From: Teemu Murtola Date: Fri, 5 Sep 2014 18:55:55 +0000 (+0300) Subject: Move some defines to gmxpre.h for thread-MPI X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?p=alexxy%2Fgromacs.git;a=commitdiff_plain;h=c10a038ffc471ca47f65ef844e31b8ba26535344 Move some defines to gmxpre.h for thread-MPI 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 --- diff --git a/src/config.h.cmakein b/src/config.h.cmakein index 4fdf9d7369..4dffa2952a 100644 --- a/src/config.h.cmakein +++ b/src/config.h.cmakein @@ -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 */ @@ -199,7 +200,10 @@ #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 @@ -339,6 +343,6 @@ /* Define if we have zlib */ #cmakedefine HAVE_ZLIB -#endif - /*! \endcond */ + +#endif diff --git a/src/gmxpre-config.h.cmakein b/src/gmxpre-config.h.cmakein index 3317938db0..2f840259d0 100644 --- a/src/gmxpre-config.h.cmakein +++ b/src/gmxpre-config.h.cmakein @@ -54,3 +54,14 @@ /* 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 +