renamed GMX_THREADS to GMX_THREAD_MPI
authorSzilard Pall <pszilard@cbr.su.se>
Fri, 3 Feb 2012 01:36:59 +0000 (02:36 +0100)
committerRoland Schulz <roland@utk.edu>
Thu, 9 Feb 2012 16:48:22 +0000 (11:48 -0500)
The aim is to better differentiate between the two types of threading:
OpenMP and thread-MPI.

Both CMake cache variable and preprocessor definitons were renamed.

Change-Id: Ie905a572cc9c02cacdcce6f80497a078131d253e

49 files changed:
CMakeLists.txt
cmake/gmxManageMPI.cmake
include/domdec.h
include/domdec_network.h
include/gmx_sort.h
include/mdrun.h
include/types/commrec.h
src/config.h.cmakein
src/contrib/pmetest.c
src/gmxlib/CMakeLists.txt
src/gmxlib/copyrite.c
src/gmxlib/filenm.c
src/gmxlib/futil.c
src/gmxlib/gmx_fatal.c
src/gmxlib/gmxfio.c
src/gmxlib/gmxfio_asc.c
src/gmxlib/gmxfio_bin.c
src/gmxlib/gmxfio_int.h
src/gmxlib/gmxfio_rw.c
src/gmxlib/gmxfio_xdr.c
src/gmxlib/libxdrf.c
src/gmxlib/main.c
src/gmxlib/network.c
src/gmxlib/oenv.c
src/gmxlib/shift_util.c
src/gmxlib/smalloc.c
src/gmxlib/statutil.c
src/gmxlib/tcontrol.c
src/gmxlib/tpxio.c
src/gmxlib/txtdump.c
src/gmxlib/typedefs.c
src/kernel/fflibutil.c
src/kernel/md.c
src/kernel/md_openmm.c
src/kernel/mdrun.c
src/kernel/runner.c
src/mdlib/domdec.c
src/mdlib/domdec_network.c
src/mdlib/fft5d.c
src/mdlib/genborn.c
src/mdlib/genborn_sse2_double.c
src/mdlib/genborn_sse2_single.c
src/mdlib/gmx_fft_fftw3.c
src/mdlib/gmx_parallel_3dfft.c
src/mdlib/gmx_wallcycle.c
src/mdlib/pme.c
src/mdlib/pme_pp.c
src/mdlib/sim_util.c
src/tools/gmx_membed.c

index 623a325dab8bbb691eccd1c902ae3935dfd38479..5c359f5a94f71692edb1b45d2600c7c73a7a20ba 100644 (file)
@@ -109,7 +109,7 @@ gmx_c_flags()
 ########################################################################
 option(GMX_DOUBLE "Use double precision (much slower, use only if you really need it)" OFF)
 option(GMX_MPI    "Build a parallel (message-passing) version of GROMACS" OFF)
-option(GMX_THREADS    "Build a parallel (thread-based) version of GROMACS (cannot be combined with MPI yet)" ON)
+option(GMX_THREAD_MPI  "Build a thread-MPI-based multithreaded version of GROMACS (not compatible with MPI)" ON)
 option(GMX_SOFTWARE_INVSQRT "Use GROMACS software 1/sqrt" ON)
 mark_as_advanced(GMX_SOFTWARE_INVSQRT)
 option(GMX_POWERPC_INVSQRT "Use PowerPC hardware 1/sqrt" OFF)
@@ -219,15 +219,15 @@ if(GMX_OPENMM)
     if(GMX_MPI)
         message(FATAL_ERROR "The OpenMM build is not compatible with MPI!")
     endif(GMX_MPI)
-    if(GMX_THREADS)
-        message(STATUS "Threads are  not compatible with OpenMM build, disabled!")
-        set(GMX_THREADS OFF CACHE BOOL 
-               "Threads are not compatible with OpenMM build, disabled!" FORCE)
-    endif(GMX_THREADS)
+    if(GMX_THREAD_MPI)
+        message(STATUS "Thread-MPI not compatible with OpenMM, disabled!")
+        set(GMX_THREAD_MPI OFF CACHE BOOL
+               "Thread-MPI not compatible with OpenMM build, disabled!" FORCE)
+    endif(GMX_THREAD_MPI)
     if(GMX_OPENMP)
-        message(STATUS "OpenMP multithreading is not compatible with OpenMM, disabled")
+        message(STATUS "OpenMP multithreading not compatible with OpenMM, disabled")
         set(GMX_OPENMP OFF CACHE BOOL
-            "OpenMP multithreading is not compatible with OpenMM, disabled!" FORCE)
+            "OpenMP multithreading not compatible with OpenMM, disabled!" FORCE)
     endif()
     if(GMX_SOFTWARE_INVSQRT)
         set(GMX_SOFTWARE_INVSQRT OFF CACHE STRING 
@@ -247,10 +247,10 @@ if(GMX_OPENMM)
     endif()
     # mark as advanced the unused variables
     mark_as_advanced(FORCE GMX_ACCELERATION GMX_MPI GMX_FFT_LIBRARY 
-        GMX_QMMM_PROGRAM GMX_THREADS GMX_DOUBLE)
+        GMX_QMMM_PROGRAM GMX_THREAD_MPI GMX_DOUBLE)
 else(GMX_OPENMM)
      mark_as_advanced(CLEAR GMX_ACCELERATION GMX_MPI GMX_FFT_LIBRARY 
-        GMX_QMMM_PROGRAM GMX_THREADS GMX_DOUBLE)   
+        GMX_QMMM_PROGRAM GMX_THREAD_MPI GMX_DOUBLE)
 endif(GMX_OPENMM)
 
 
@@ -400,16 +400,16 @@ if (GMX_X11)
        endif(X11_FOUND)
 endif(GMX_X11)
 
-if(GMX_THREADS)
-    set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_THREADS")
+if(GMX_THREAD_MPI)
+    set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_THREAD_MPI")
     include(ThreadMPI)
     set(THREAD_MPI_LIB thread_mpi)
     set(GMX_MPI 1)
     string(TOUPPER ${GMX_FFT_LIBRARY} ${GMX_FFT_LIBRARY})
     if(${GMX_FFT_LIBRARY} STREQUAL "FFTW2")
-        message(FATAL_ERROR "FFTW2 can't be used with threads. Try fftw3 or mkl.")
+        message(FATAL_ERROR "FFTW2 can't be used with thread-MPI. Try fftw3 or mkl.")
     endif()
-endif(GMX_THREADS)
+endif(GMX_THREAD_MPI)
 
 if(GMX_OPENMM)
     set(CUDA_BUILD_EMULATION OFF)
@@ -597,7 +597,7 @@ elseif(${GMX_ACCELERATION} STREQUAL "BLUEGENE")
     set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Do not use software reciprocal square root on BlueGene" FORCE)
     set(GMX_POWERPC_INVSQRT ON CACHE BOOL "Use hardware reciprocal square root on BlueGene" FORCE)
     set(GMX_X11 OFF CACHE BOOL "X11 not compatible with BlueGene, disabled!" FORCE)
-    set(GMX_THREADS OFF CACHE BOOL "Threads not compatible with BlueGene, disabled!" FORCE)
+    set(GMX_THREAD_MPI OFF CACHE BOOL "Thread-MPI not compatible with BlueGene, disabled!" FORCE)
     set(GMX_MPI ON CACHE BOOL "Use MPI on BlueGene" FORCE)
 elseif(${GMX_ACCELERATION} STREQUAL "POWER6")
     set(GMX_POWER6 1)
@@ -617,9 +617,9 @@ else(${GMX_ACCELERATION} STREQUAL "NONE")
 endif(${GMX_ACCELERATION} STREQUAL "NONE")
 
 if(GMX_FORTRAN OR GMX_POWER6)
-    if (GMX_THREADS)
-        message(FATAL_ERROR "FORTRAN/POWER6 is incompatible with threads and only provides a speed-up on certain IBM compilers. Disable FORTRAN (or threads if you really want to use FORTRAN kernels).")
-    endif(GMX_THREADS)
+    if (GMX_THREAD_MPI)
+        message(FATAL_ERROR "FORTRAN/POWER6 is incompatible with thread-MPI and only provides a speed-up on certain IBM compilers. Disable FORTRAN (or threads if you really want to use FORTRAN kernels).")
+    endif(GMX_THREAD_MPI)
     enable_language(Fortran)
     include(FortranCInterface)
     discover_fortran_mangling(prefix isupper suffix extra_under_score found)
index 5129baeed29cbf0a49f2339d7a499f07b913e73f..5b73ec6eee5e14804f196835cd502c9a35e31435 100644 (file)
@@ -1,10 +1,11 @@
 # Manage the MPI setup, assuming that CMAKE_C_COMPILER is an MPI
 # (wrapper) compiler.
 if(GMX_MPI)
-  if(GMX_THREADS)
-    set(GMX_THREADS OFF CACHE BOOL
-      "Thread-based parallelization conflicts with MPI." FORCE)
-  endif(GMX_THREADS)
+  if(GMX_THREAD_MPI)
+    message(STATUS "MPI is not compatible with thread-MPI. Disabling thread-MPI.")
+    set(GMX_THREAD_MPI OFF CACHE BOOL
+        "Build a thread-MPI-based multithreaded version of GROMACS (not compatible with MPI)" FORCE)
+  endif(GMX_THREAD_MPI)
 
   # Test the CMAKE_C_COMPILER for being an MPI (wrapper) compiler
   TRY_COMPILE(MPI_FOUND ${CMAKE_BINARY_DIR}
index 64b4d20a249af2bf3ea100233885cdf8cd0f8fb9..aec111f190760633b149bb7ae8979d6ffa0cde32 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 3f8506cb4e2dbe08de42a4fbfe03a839cfbf90e0..3d2a55c8f932256294772fc900cb8565430b0062 100644 (file)
@@ -24,7 +24,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index e58fae75f5cdacb39b66fcc59339c3592c255eb8..c1ef471b90232f32ce6d6914befc6101258ff773 100644 (file)
@@ -56,7 +56,7 @@ gmx_qsort(void *           base,
           int            (*compar)(const void *, const void *));
 
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* Some implementations of qsort are not threadsafe.
  * For instance qsort in glibc contains a bug which makes it non-threadsafe:
  * http://sources.redhat.com/bugzilla/show_bug.cgi?id=11655
index d30fb0c952ce819e71853191778f9c1ffd4aea62..33136be92090bb3c5c13b39bac0a00dab38bc429 100644 (file)
@@ -139,7 +139,7 @@ typedef struct {
  */
 extern gmx_large_int_t     deform_init_init_step_tpx;
 extern matrix              deform_init_box_tpx;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 extern tMPI_Thread_mutex_t deform_init_box_mutex;
 
 /* The minimum number of atoms per thread. With fewer atoms than this,
index 2baa5844fe448f8a1d3af3457cbd08113b64a89d..62136607be2d26030b2f984f5c4c8881c6283c15 100644 (file)
@@ -38,7 +38,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #else
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "../tmpi.h"
 #else
 typedef void* MPI_Comm;
index 84436417ad91d3cd30e439d2f9d1f0938c696bd1..a2e953a4b35189f2eabd73f1de70842b9eb4382a 100644 (file)
 #cmakedefine GMX_MPI
 
 /* Use threads for parallelization */
-#cmakedefine GMX_THREADS
+#cmakedefine GMX_THREAD_MPI
 
 /* Use old threading (domain decomp force calc) code */
 #cmakedefine GMX_THREAD_SHM_FDECOMP 
index c5dd4a59b8e7137080741b492c853b10b6e42291..55f1d17350e0a9d81c828d962df18b2676e07b5f 100644 (file)
@@ -60,7 +60,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index fda62346fae9535e1ecb45427f3e8616edc88ccd..708ede1f7e099e60d745005437b3df82efdaa520 100644 (file)
@@ -97,9 +97,9 @@ endif(NOT GMX_EXTERNAL_LAPACK)
 
 # This would be the standard way to include thread_mpi, but we want libgmx
 # to link the functions directly
-#if(GMX_THREADS)
+#if(GMX_THREAD_MPI)
 #    add_subdirectory(thread_mpi)
-#endif(GMX_THREADS)
+#endif(GMX_THREAD_MPI)
 #target_link_libraries(gmx ${GMX_EXTRA_LIBRARIES} ${THREAD_MPI_LIB})
 
 # Files called xxx_test.c are test drivers with a main() function for module xxx.c,
index 71a2b63457f0e75d2fc6394a701787ee61607012..ba5c40eab4460ce664355f544430ca0ae819502d 100644 (file)
@@ -36,7 +36,7 @@
 #include <config.h>
 #endif
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include <thread_mpi.h>
 #endif
 
@@ -622,7 +622,7 @@ void gmx_print_version_info(FILE *fp)
     fprintf(fp, "Precision:        single\n");
 #endif
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     fprintf(fp, "Parallellization: thread_mpi\n");
 #elif defined(GMX_MPI)
     fprintf(fp, "Parallellization: MPI\n");
index 8ba1ed914fc82fb86693d1f5069859ed25ee1e2c..d42f37e11c273556f1423cdc50b5ec6437208b5d 100644 (file)
@@ -48,7 +48,7 @@
 #include "xdrf.h"
 #include "macros.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -203,7 +203,7 @@ static const t_deffile
 
 static char *default_file_name = NULL;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 static tMPI_Thread_mutex_t filenm_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -214,11 +214,11 @@ const char *z_ext[NZEXT] =
 void set_default_file_name(const char *name)
 {
     int i;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&filenm_mutex);
 #endif
     default_file_name = strdup(name);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&filenm_mutex);
 #endif
 
@@ -296,7 +296,7 @@ const char *ftp2defnm(int ftp)
 {
     const char *buf = NULL;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&filenm_mutex);
 #endif
 
@@ -311,7 +311,7 @@ const char *ftp2defnm(int ftp)
             buf = deffile[ftp].defnm;
         }
     }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&filenm_mutex);
 #endif
 
index 08d84997add49d76213e4307262f2b19b135eacd..21cf4c00774a79e4040540374407f8ac8bd00dc3 100644 (file)
@@ -64,7 +64,7 @@
 #include "statutil.h"
 
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -85,7 +85,7 @@ typedef struct t_pstack {
 static t_pstack *pstack=NULL;
 static gmx_bool     bUnbuffered=FALSE;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* this linked list is an intrinsically globally shared object, so we have
    to protect it with mutexes */
 static tMPI_Thread_mutex_t pstack_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
@@ -100,7 +100,7 @@ void push_ps(FILE *fp)
 {
     t_pstack *ps;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&pstack_mutex);
 #endif
 
@@ -108,7 +108,7 @@ void push_ps(FILE *fp)
     ps->fp   = fp;
     ps->prev = pstack;
     pstack   = ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&pstack_mutex);
 #endif
 }
@@ -149,7 +149,7 @@ int ffclose(FILE *fp)
 #else
     t_pstack *ps,*tmp;
     int ret=0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&pstack_mutex);
 #endif
 
@@ -179,7 +179,7 @@ int ffclose(FILE *fp)
                 ret = fclose(fp);
         }
     }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&pstack_mutex);
 #endif
     return ret;
@@ -194,7 +194,7 @@ int ffclose(FILE *fp)
 void frewind(FILE *fp)
 {
     t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&pstack_mutex);
 #endif
 
@@ -202,7 +202,7 @@ void frewind(FILE *fp)
     while (ps != NULL) {
         if (ps->fp == fp) {
             fprintf(stderr,"Cannot rewind compressed file!\n");
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
             tMPI_Thread_mutex_unlock(&pstack_mutex);
 #endif
             return;
@@ -210,7 +210,7 @@ void frewind(FILE *fp)
         ps=ps->prev;
     }
     rewind(fp);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&pstack_mutex);
 #endif
 }
@@ -245,21 +245,21 @@ gmx_off_t gmx_ftell(FILE *stream)
 gmx_bool is_pipe(FILE *fp)
 {
     t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&pstack_mutex);
 #endif
 
     ps=pstack;
     while (ps != NULL) {
         if (ps->fp == fp) {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
             tMPI_Thread_mutex_unlock(&pstack_mutex);
 #endif
             return TRUE;
         }
         ps=ps->prev;
     }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&pstack_mutex);
 #endif
     return FALSE;
index 62dabd5eb9e0ac92f1865527ff22fd747e466958..a743a515f8cdf266d414edc6110dcee3f68e814d 100644 (file)
@@ -56,7 +56,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -64,7 +64,7 @@ static gmx_bool bDebug = FALSE;
 static char *fatal_tmp_file = NULL;
 static FILE *log_file = NULL;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 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;
@@ -74,12 +74,12 @@ static tMPI_Thread_mutex_t fatal_tmp_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 gmx_bool bDebugMode(void)
 {
     gmx_bool ret;
-/*#ifdef GMX_THREADS*/
+/*#ifdef GMX_THREAD_MPI*/
 #if 0
     tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
     ret=bDebug;
-/*#ifdef GMX_THREADS*/
+/*#ifdef GMX_THREAD_MPI*/
 #if 0
     tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
@@ -100,7 +100,7 @@ void _where(const char *file,int line)
   char *temp; 
   
   if ( bFirst ) {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&where_mutex);
     if (bFirst) /* we repeat the check in the locked section because things
                    might have changed */
@@ -109,7 +109,7 @@ void _where(const char *file,int line)
         if ((temp=getenv("WHERE")) != NULL)
             nskip = strtol(temp, NULL, 10); 
         bFirst = FALSE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     }
     tMPI_Thread_mutex_unlock(&where_mutex);
 #endif
@@ -192,7 +192,7 @@ static int fatal_errno = 0;
 
 static void quit_gmx(const char *msg)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
     if (fatal_errno == 0) 
@@ -215,7 +215,7 @@ static void quit_gmx(const char *msg)
         perror(msg);
     }
 
-#ifndef GMX_THREAD
+#ifndef GMX_THREAD_MPI
     if (gmx_parallel_env_initialized())
     {
         int  nnodes;
@@ -243,7 +243,7 @@ static void quit_gmx(const char *msg)
     }
 
     exit(fatal_errno);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 }
@@ -253,7 +253,7 @@ static void quit_gmx(const char *msg)
  */
 static void quit_gmx_noquit(const char *msg)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
     if (!fatal_errno) 
@@ -284,14 +284,14 @@ static void quit_gmx_noquit(const char *msg)
         }
     }
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 }
 
 void _set_fatal_tmp_file(const char *fn, const char *file, int line)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
 #endif
   if (fatal_tmp_file == NULL)
@@ -299,14 +299,14 @@ void _set_fatal_tmp_file(const char *fn, const char *file, int line)
   else
     fprintf(stderr,"BUGWARNING: fatal_tmp_file already set at %s:%d",
            file,line);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
 #endif
 }
 
 void _unset_fatal_tmp_file(const char *fn, const char *file, int line)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
 #endif
   if (strcmp(fn,fatal_tmp_file) == 0) {
@@ -315,14 +315,14 @@ void _unset_fatal_tmp_file(const char *fn, const char *file, int line)
   } else
     fprintf(stderr,"BUGWARNING: file %s not set as fatal_tmp_file at %s:%d",
            fn,file,line);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
 #endif
 }
 
 static void clean_fatal_tmp_file()
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
 #endif
   if (fatal_tmp_file) {
@@ -331,7 +331,7 @@ static void clean_fatal_tmp_file()
     sfree(fatal_tmp_file);
     fatal_tmp_file = NULL;
   }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
 #endif
 }
@@ -427,13 +427,13 @@ void gmx_fatal(int f_errno,const char *file,int line,const char *fmt,...)
   
   va_end(ap);
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
 
   fatal_errno = f_errno;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 
@@ -481,13 +481,13 @@ void gmx_fatal_collective(int f_errno,const char *file,int line,
         
         va_end(ap);
         
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
         
         fatal_errno = f_errno;
         
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 
@@ -553,7 +553,7 @@ gmx_bool gmx_debug_at=FALSE;
 
 void init_debug (const int dbglevel,const char *dbgfile)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
     if (!bDebug) /* another thread hasn't already run this*/
@@ -564,7 +564,7 @@ void init_debug (const int dbglevel,const char *dbgfile)
         if (dbglevel >= 2)
             gmx_debug_at = TRUE;
     }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 }
@@ -599,7 +599,7 @@ void doexceptions(void)
   
   int onoff,en_mask,abort_action,i;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
   onoff   = _DEBUG;
@@ -610,7 +610,7 @@ void doexceptions(void)
   
   for(i=0; (i<asize(hs)); i++)
     signal(hs[i],handle_signals);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 }
@@ -622,11 +622,11 @@ static void (*gmx_error_handler)(const char *msg) = quit_gmx;
 
 void set_gmx_error_handler(void (*func)(const char *msg))
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&debug_mutex);
 #endif
     gmx_error_handler = func;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&debug_mutex);
 #endif
 }
index d80d864d436b5892511e8a77ec3bade74fc53191..4fc20cc416f1c9b7e93cf1fceca45b6777e4507c 100644 (file)
@@ -53,7 +53,7 @@
 #include "gmxfio.h"
 #include "md5.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -68,7 +68,7 @@
 static t_fileio *open_files = NULL;
 
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* this mutex locks the open_files structure so that no two threads can 
    modify it.        
 
@@ -248,14 +248,14 @@ static void gmx_fio_set_iotype(t_fileio *fio)
    type of access to the fio's elements. */
 void gmx_fio_lock(t_fileio *fio)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Lock_lock(&(fio->mtx));
 #endif
 }
 /* unlock the mutex associated with this fio.  */
 void gmx_fio_unlock(t_fileio *fio)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Lock_unlock(&(fio->mtx));
 #endif
 }
@@ -270,7 +270,7 @@ static void gmx_fio_make_dummy(void)
         open_files->fn=NULL;
         open_files->next=open_files;
         open_files->prev=open_files;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Lock_init(&(open_files->mtx));
 #endif
     }
@@ -293,7 +293,7 @@ static void gmx_fio_make_dummy(void)
 static void gmx_fio_insert(t_fileio *fio)
 {
     t_fileio *prev;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     /* first lock the big open_files mutex. */
     tMPI_Thread_mutex_lock(&open_file_mutex);
 #endif
@@ -325,7 +325,7 @@ static void gmx_fio_insert(t_fileio *fio)
     gmx_fio_unlock(open_files);
     gmx_fio_unlock(fio);
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     /* now unlock the big open_files mutex.  */
     tMPI_Thread_mutex_unlock(&open_file_mutex);
 #endif
@@ -362,7 +362,7 @@ static t_fileio *gmx_fio_get_first(void)
     t_fileio *ret;
     /* first lock the big open_files mutex and the dummy's mutex */
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     /* first lock the big open_files mutex. */
     tMPI_Thread_mutex_lock(&open_file_mutex);
 #endif
@@ -399,7 +399,7 @@ static t_fileio *gmx_fio_get_next(t_fileio *fio)
     if (fio->next==open_files)
     {
         ret=NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_unlock(&open_file_mutex);
 #endif
     }
@@ -416,7 +416,7 @@ static t_fileio *gmx_fio_get_next(t_fileio *fio)
 static void gmx_fio_stop_getting_next(t_fileio *fio)
 {
     gmx_fio_unlock(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&open_file_mutex);
 #endif
 }
@@ -485,7 +485,7 @@ t_fileio *gmx_fio_open(const char *fn, const char *mode)
     }
 
     snew(fio, 1);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Lock_init(&(fio->mtx));
 #endif
     bRead = (newmode[0]=='r' && newmode[1]!='+');
@@ -599,7 +599,7 @@ int gmx_fio_close(t_fileio *fio)
 {
     int rc = 0;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     /* first lock the big open_files mutex. */
     /* We don't want two processes operating on the list at the same time */
     tMPI_Thread_mutex_lock(&open_file_mutex);
@@ -613,7 +613,7 @@ int gmx_fio_close(t_fileio *fio)
 
     sfree(fio);
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&open_file_mutex);
 #endif
 
index 4cab9df69dd37d5e04b03fd45585eebec24fe347..42245f6933d23d7315af992edf33a62732ac9c6c 100644 (file)
@@ -55,7 +55,7 @@
 #include "gmxfio.h"
 #include "md5.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
index a072d4fd60e1bb3e32331eaa7efdd41d44424d3e..307704f736b9375aa6f808a114d367a239af28d4 100644 (file)
@@ -53,7 +53,7 @@
 #include "gmxfio.h"
 #include "md5.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
index d6bb34a9960593c1fb2cbc2d1bd58ff0c06928dc..a43091f02437c85c8199bf8e9a22fe51abb37f63 100644 (file)
@@ -94,7 +94,7 @@ struct t_fileio
 
     t_fileio *next, *prev; /* next and previous file pointers in the
                               linked list */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Lock_t  mtx;  /* content locking mutex. This is a fast lock
                           for performance reasons: in some cases every
                           single byte that gets read/written requires
index d40ebf5a7103c1db7d6c0a3dd876f00759caa39b..518547286314c65c645738645290aa9059ab6277 100644 (file)
@@ -53,7 +53,7 @@
 #include "gmxfio.h"
 #include "md5.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
index 05893fdd48cb75539cedb0927d70031167c3de81..88ba918c0f26398e7a7e8c35471a4da5803c79d0 100644 (file)
@@ -53,7 +53,7 @@
 #include "gmxfio.h"
 #include "md5.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
index 947a41fe3bdce9cb050fb09bced026b9a0ba532a..f279deb517b4c69ac1cb54edb60ee0cccf8ebc4d 100644 (file)
@@ -86,7 +86,7 @@ static FILE *xdrfiles[MAXID];
 static XDR *xdridptr[MAXID];
 static char xdrmodes[MAXID];
 static unsigned int cnt;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* we need this because of the global variables above for FORTRAN binding. 
    The I/O operations are going to be slow. */
 static tMPI_Thread_mutex_t xdr_fortran_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
@@ -94,13 +94,13 @@ static tMPI_Thread_mutex_t xdr_fortran_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 
 static void xdr_fortran_lock(void)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&xdr_fortran_mutex);
 #endif
 }
 static void xdr_fortran_unlock(void)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&xdr_fortran_mutex);
 #endif
 }
@@ -376,7 +376,7 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) {
     char newtype[5];
 
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     if (!tMPI_Thread_mutex_trylock( &xdr_fortran_mutex ))  
     {
         tMPI_Thread_mutex_unlock( &xdr_fortran_mutex );
@@ -461,7 +461,7 @@ int xdrclose(XDR *xdrs) {
     int xdrid;
     int rc = 0;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     if (!tMPI_Thread_mutex_trylock( &xdr_fortran_mutex ))  
     {
         tMPI_Thread_mutex_unlock( &xdr_fortran_mutex );
index 4b335c2a1eb34305a9c974ec8de3f58b6af720b2..e6ad33c1e264fda582021f72e0410cac9bbf661a 100644 (file)
@@ -64,7 +64,7 @@
 #include "gmxfio.h"
 #include "string2.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -92,7 +92,7 @@ gmx_ctime_r(const time_t *clock,char *buf, int n);
    of the simulation, once by each thread with the same value. We assume
    that writing to an int is atomic.*/
 static gmx_bool parallel_env_val;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 tMPI_Thread_mutex_t parallel_env_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -107,11 +107,11 @@ tMPI_Thread_mutex_t parallel_env_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 gmx_bool gmx_parallel_env_initialized(void)
 {
     gmx_bool ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&parallel_env_mutex);
 #endif
     ret=parallel_env_val;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&parallel_env_mutex);
 #endif
     return ret;
@@ -119,7 +119,7 @@ gmx_bool gmx_parallel_env_initialized(void)
 
 static void set_parallel_env(gmx_bool val)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&parallel_env_mutex);
 #endif
     if (!parallel_env_val)
@@ -127,7 +127,7 @@ static void set_parallel_env(gmx_bool val)
         /* we only allow it to be set, not unset */
         parallel_env_val=val;
     }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&parallel_env_mutex);
 #endif
 }
@@ -269,7 +269,7 @@ void gmx_log_open(const char *lognm,const t_commrec *cr,gmx_bool bMasterOnly,
   
     /* Communicate the filename for logfile */
     if (cr->nnodes > 1 && !bMasterOnly
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         /* With thread MPI the non-master log files are opened later
          * when the files names are already known on all nodes.
          */
@@ -445,7 +445,7 @@ void init_multisystem(t_commrec *cr,int nsim, char **multidirs,
     MPI_Comm_create(MPI_COMM_WORLD,ms->mpi_group_masters,
                     &ms->mpi_comm_masters);
 
-#if !defined(GMX_THREADS) && !defined(MPI_IN_PLACE_EXISTS)
+#if !defined(GMX_THREAD_MPI) && !defined(MPI_IN_PLACE_EXISTS)
     /* initialize the MPI_IN_PLACE replacement buffers */
     snew(ms->mpb, 1);
     ms->mpb->ibuf=NULL;
@@ -564,13 +564,13 @@ t_commrec *init_par(int *argc,char ***argv_ptr)
     cr->duty = (DUTY_PP | DUTY_PME);
 
     /* Communicate arguments if parallel */
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
     if (PAR(cr))
         comm_args(cr,argc,argv_ptr);
-#endif /* GMX_THREADS */
+#endif /* GMX_THREAD_MPI */
 
 #ifdef GMX_MPI
-#if !defined(GMX_THREADS) && !defined(MPI_IN_PLACE_EXISTS)
+#if !defined(GMX_THREAD_MPI) && !defined(MPI_IN_PLACE_EXISTS)
   /* initialize the MPI_IN_PLACE replacement buffers */
   snew(cr->mpb, 1);
   cr->mpb->ibuf=NULL;
@@ -589,7 +589,7 @@ t_commrec *init_par(int *argc,char ***argv_ptr)
 
 t_commrec *init_par_threads(const t_commrec *cro)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     int initialized;
     t_commrec *cr;
 
index 580474e7df53679b15683fc174b7354fa904aca4..f711b32f7b8c5b8ad711b6b964d0cdcd87fb9c78 100644 (file)
@@ -50,7 +50,7 @@
 #include <mpi.h>
 #endif
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -311,7 +311,7 @@ void gmx_setup_nodecomm(FILE *fplog,t_commrec *cr)
   nc = &cr->nc;
 
   nc->bUse = FALSE;
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
   if (getenv("GMX_NO_NODECOMM") == NULL) {
 #ifdef GMX_MPI
     MPI_Comm_size(cr->mpi_comm_mygroup,&n);
@@ -375,7 +375,7 @@ void gmx_abort(int noderank,int nnodes,int errorno)
 #ifndef GMX_MPI
   gmx_call("gmx_abort");
 #else
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   fprintf(stderr,"Halting program %s\n",ShortProgram());
   thanx(stderr);
   exit(1);
@@ -420,7 +420,7 @@ void gmx_sumd(int nr,double r[],const t_commrec *cr)
 #ifndef GMX_MPI
     gmx_call("gmx_sumd");
 #else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     if (cr->nc.bUse) {
         if (cr->nc.rank_intra == 0)
         {
@@ -475,7 +475,7 @@ void gmx_sumf(int nr,float r[],const t_commrec *cr)
 #ifndef GMX_MPI
     gmx_call("gmx_sumf");
 #else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     if (cr->nc.bUse) {
         /* Use two step summing.  */
         if (cr->nc.rank_intra == 0)
@@ -529,7 +529,7 @@ void gmx_sumi(int nr,int r[],const t_commrec *cr)
 #ifndef GMX_MPI
     gmx_call("gmx_sumi");
 #else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     if (cr->nc.bUse) {
         /* Use two step summing */
         if (cr->nc.rank_intra == 0) 
@@ -579,7 +579,7 @@ void gmx_sumli(int nr,gmx_large_int_t r[],const t_commrec *cr)
 #ifndef GMX_MPI
     gmx_call("gmx_sumli");
 #else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     if (cr->nc.bUse) {
         /* Use two step summing */
         if (cr->nc.rank_intra == 0) 
@@ -634,7 +634,7 @@ void gmx_sumli(int nr,gmx_large_int_t r[],const t_commrec *cr)
 #ifdef GMX_MPI
 void gmx_sumd_comm(int nr,double r[],MPI_Comm mpi_comm)
 {
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     MPI_Allreduce(MPI_IN_PLACE,r,nr,MPI_DOUBLE,MPI_SUM,mpi_comm);
 #else
     /* this function is only used in code that is not performance critical,
@@ -655,7 +655,7 @@ void gmx_sumd_comm(int nr,double r[],MPI_Comm mpi_comm)
 #ifdef GMX_MPI
 void gmx_sumf_comm(int nr,float r[],MPI_Comm mpi_comm)
 {
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     MPI_Allreduce(MPI_IN_PLACE,r,nr,MPI_FLOAT,MPI_SUM,mpi_comm);
 #else
     /* this function is only used in code that is not performance critical,
@@ -696,7 +696,7 @@ void gmx_sumi_sim(int nr,int r[], const gmx_multisim_t *ms)
 #ifndef GMX_MPI
     gmx_call("gmx_sumi_sim");
 #else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     MPI_Allreduce(MPI_IN_PLACE,r,nr,MPI_INT,MPI_SUM,ms->mpi_comm_masters);
 #else
     /* this is thread-unsafe, but it will do for now: */
@@ -718,7 +718,7 @@ void gmx_sumli_sim(int nr,gmx_large_int_t r[], const gmx_multisim_t *ms)
 #ifndef GMX_MPI
     gmx_call("gmx_sumli_sim");
 #else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
     MPI_Allreduce(MPI_IN_PLACE,r,nr,GMX_MPI_LARGE_INT,MPI_SUM,
                   ms->mpi_comm_masters);
 #else
index 335d6c10ad069c998fb79ed3068465ba0a041e92..4e01d25ffe8c2dd763eac20eca837c6ae7885ca2 100644 (file)
@@ -57,7 +57,7 @@
 #include "gmxfio.h"
 #include "oenv.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
index 201b432e87a20d0ab4cfd3966f50977cea416573..3b1465498bca0389c7aef6700d44ede7aed52cd7 100644 (file)
 #define p4(x) ((x)*(x)*(x)*(x)) 
 
 static real A,A_3,B,B_4,C,c1,c2,c3,c4,c5,c6,One_4pi,FourPi_V,Vol,N0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 static tMPI_Thread_mutex_t shift_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
 
 void set_shift_consts(FILE *log,real r1,real rc,rvec box,t_forcerec *fr)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   /* at the very least we shouldn't allow multiple threads to set these 
      simulataneously */
   tMPI_Thread_mutex_lock(&shift_mutex);
@@ -111,7 +111,7 @@ void set_shift_consts(FILE *log,real r1,real rc,rvec box,t_forcerec *fr)
   }
     
   One_4pi = 1.0/(4.0*M_PI);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   tMPI_Thread_mutex_unlock(&shift_mutex);
 #endif
 }
index 55b7b8e307be022db263b6ded57cd57f6bb418f8..77069ab5da8009b709057f86c711567920c5f2af 100644 (file)
@@ -38,7 +38,7 @@
 
 /* This file is completely threadsafe - keep it that way! */
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi/threads.h"
 #endif 
 
@@ -65,7 +65,7 @@ static void log_action(int bMal,const char *what,const char *file,int line,
   if (!bMal)
     bytes=-bytes;
   
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   tMPI_Thread_mutex_lock(&gmx_logfile_mtx);
 #endif
 
@@ -96,7 +96,7 @@ static void log_action(int bMal,const char *what,const char *file,int line,
           what ? what  : NN,bytes/1024.0,
           file ? fname : NN,line,nelem,size);
   }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
   tMPI_Thread_mutex_unlock(&gmx_logfile_mtx);
 #endif
 }
index fe5a161fdd0b39dc85a80e89644814123306f59a..5284428df77ae2b70191c61a8a86192b3f3b84aa 100644 (file)
@@ -57,7 +57,7 @@
 #include "mtop_util.h"
 #include "gmxfio.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -80,7 +80,7 @@
 static const char *program_name=NULL;
 static char *cmd_line=NULL;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* For now, some things here are simply not re-entrant, so
    we have to actively lock them. */
 static tMPI_Thread_mutex_t init_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
@@ -99,11 +99,11 @@ static tMPI_Thread_mutex_t init_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 const char *ShortProgram(void)
 {
     const char *pr,*ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&init_mutex);
 #endif
     pr=ret=program_name; 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&init_mutex);
 #endif
     if ((pr=strrchr(ret,DIR_SEPARATOR)) != NULL)
@@ -117,11 +117,11 @@ const char *ShortProgram(void)
 const char *Program(void)
 {
     const char *ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&init_mutex);
 #endif
     ret=program_name; 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&init_mutex);
 #endif
     return ret;
@@ -130,11 +130,11 @@ const char *Program(void)
 const char *command_line(void)
 {
     const char *ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&init_mutex);
 #endif
     ret=cmd_line; 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&init_mutex);
 #endif
     return ret;
@@ -142,7 +142,7 @@ const char *command_line(void)
 
 void set_program_name(const char *argvzero)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&init_mutex);
 #endif
     /* When you run a dynamically linked program before installing
@@ -158,7 +158,7 @@ void set_program_name(const char *argvzero)
     }
     if (program_name == NULL)
         program_name="GROMACS";
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&init_mutex);
 #endif
 }
@@ -169,7 +169,7 @@ void set_command_line(int argc, char *argv[])
     int i;
     size_t cmdlength;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&init_mutex);
 #endif
     if (cmd_line==NULL)
@@ -188,7 +188,7 @@ void set_command_line(int argc, char *argv[])
             strcat(cmd_line," ");
         }
     }
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&init_mutex);
 #endif
 
@@ -737,14 +737,14 @@ void parse_common_args(int *argc,char *argv[],unsigned long Flags,
     /* The some system, e.g. the catamount kernel on cray xt3 do not have nice(2). */
     if (nicelevel != 0 && !bExit)
     {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         static gmx_bool nice_set=FALSE; /* only set it once */
         tMPI_Thread_mutex_lock(&init_mutex);
         if (!nice_set)
         {
 #endif
             i=nice(nicelevel); /* assign ret value to avoid warnings */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
             nice_set=TRUE;
         }
         tMPI_Thread_mutex_unlock(&init_mutex);
index f4c2a39e30761ac1ce18b77d965b9f3fd350da65..c807bddea3915063cce23e161c7901d3504232a9 100644 (file)
@@ -40,7 +40,7 @@
 #include "statutil.h"
 #include "gmx_fatal.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -59,7 +59,7 @@ static t_timecontrol timecontrol[TNR] = {
   { 0, FALSE }
 };
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 static tMPI_Thread_mutex_t tc_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -67,12 +67,12 @@ gmx_bool bTimeSet(int tcontrol)
 {
     gmx_bool ret;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&tc_mutex);
 #endif
     range_check(tcontrol,0,TNR);
     ret=timecontrol[tcontrol].bSet;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&tc_mutex);
 #endif
 
@@ -83,12 +83,12 @@ real rTimeValue(int tcontrol)
 {
     real ret;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&tc_mutex);
 #endif
     range_check(tcontrol,0,TNR);
     ret=timecontrol[tcontrol].t;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&tc_mutex);
 #endif
     return ret;
@@ -96,13 +96,13 @@ real rTimeValue(int tcontrol)
   
 void setTimeValue(int tcontrol,real value)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&tc_mutex);
 #endif
     range_check(tcontrol,0,TNR);
     timecontrol[tcontrol].t = value;
     timecontrol[tcontrol].bSet = TRUE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&tc_mutex);
 #endif
 }
index 2edea91884c4f1d36c6f34e01d4983a782fbd926..1d4ff24e49399e226c1a9cc5cf631a0c1ad135dc 100644 (file)
@@ -38,7 +38,7 @@
 #endif
 
 /* This file is completely threadsafe - keep it that way! */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include <thread_mpi.h>
 #endif
 
index ba1ce00e95b67f0b487dab56a160f3ef8a6aef0b..d26d0f61e5fa192b9d45f10b6e364a4f8a9998b4 100644 (file)
@@ -38,7 +38,7 @@
 #endif
 
 /* This file is completely threadsafe - please keep it that way! */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include <thread_mpi.h>
 #endif
 
index 15fcbdc8ecb4cf02c7577b1cc101cff6a66ca80c..96a6ccf32aa3557dc37c198b7d4e8c083a9f9164 100644 (file)
@@ -44,7 +44,7 @@
 #include "pbc.h"
 #include <string.h>
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
 
 
 static gmx_bool bOverAllocDD=FALSE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 static tMPI_Thread_mutex_t over_alloc_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
 
 void set_over_alloc_dd(gmx_bool set)
 {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_lock(&over_alloc_mutex);
     /* we just make sure that we don't set this at the same time. 
        We don't worry too much about reading this rarely-set variable */
 #endif    
     bOverAllocDD = set;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     tMPI_Thread_mutex_unlock(&over_alloc_mutex);
 #endif    
 }
index 0254f12bea09de3cc45c7805a4102ab63942ace8..13bc12bbe7bc342c732d5485cfa2b44e6226fe3b 100644 (file)
@@ -60,7 +60,7 @@
 #include <unistd.h>
 #endif
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
index 0ca2dc97a077c21174f505830ec60071c83b38e9..fb379d55905c52d381e3ea0feeb1e17483b2efcf 100644 (file)
@@ -91,7 +91,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -298,13 +298,13 @@ double do_md(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
 
     if (DEFORM(*ir))
     {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_lock(&deform_init_box_mutex);
 #endif
         set_deform_reference_box(upd,
                                  deform_init_init_step_tpx,
                                  deform_init_box_tpx);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
 #endif
     }
@@ -1310,7 +1310,7 @@ double do_md(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
 
         /* Check whether everything is still allright */    
         if (((int)gmx_get_stop_condition() > handled_stop_condition)
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
             && MASTER(cr)
 #endif
             )
index bbc9d1d2dbcdc8803b5527d6e4798b775f3f3eb6..810c2b7ba5431a8c05202669b1fab0b98b453ba1 100644 (file)
@@ -91,7 +91,7 @@
 #include "string2.h"
 #include "copyrite.h"
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -478,7 +478,7 @@ double do_md_openmm(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
 
         /* Check whether everything is still allright */
         if (((int)gmx_get_stop_condition() > handled_stop_condition)
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
             && MASTER(cr)
 #endif
             )
index 3fd7ac10cbc934c999cbea6d5752960aa29fc83b..e4446767b7ba4148ffeb553a419caebf8f6aea53 100644 (file)
@@ -49,7 +49,7 @@
 #include "mdrun.h"
 #include "xmdrun.h"
 #include "checkpoint.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "thread_mpi.h"
 #endif
 
@@ -430,7 +430,7 @@ int main(int argc,char *argv[])
       "Use particle decompostion" },
     { "-dd",      FALSE, etRVEC,{&realddxyz},
       "Domain decomposition grid, 0 is optimize" },
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     { "-nt",      FALSE, etINT, {&nthreads},
       "Number of threads to start (0 is guess)" },
 #endif
@@ -546,7 +546,7 @@ int main(int argc,char *argv[])
   dd_node_order = nenum(ddno_opt);
   cr->npmenodes = npme;
 
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
   nthreads=1;
 #endif
 
@@ -566,7 +566,7 @@ int main(int argc,char *argv[])
       gmx_fatal(FARGS,"Need at least two replicas for replica exchange (option -multi)");
 
   if (nmultisim > 1) {
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
     gmx_bool bParFn = (multidir == NULL);
     init_multisystem(cr, nmultisim, multidir, NFILE, fnm, bParFn);
 #else
index 43cca09078beb96b96b5e348f8f06e058b053373..59a8ea5c3d29abc46ddf9a46818e49414b872c25 100644 (file)
@@ -82,7 +82,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -112,12 +112,12 @@ const gmx_intp_t integrator[eiNR] = { {do_md}, {do_steep}, {do_cg}, {do_md}, {do
 
 gmx_large_int_t     deform_init_init_step_tpx;
 matrix              deform_init_box_tpx;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 tMPI_Thread_mutex_t deform_init_box_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 struct mdrunner_arglist
 {
     FILE *fplog;
@@ -400,7 +400,7 @@ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
         read_tpx_state(ftp2fn(efTPX,nfile,fnm),inputrec,state,NULL,mtop);
 
         /* NOW the threads will be started: */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         nthreads_mpi = get_nthreads_mpi(nthreads_requested, inputrec, mtop);
 
         if (nthreads_mpi > 1)
@@ -448,7 +448,7 @@ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
 #ifndef GMX_MPI
                   "but mdrun was compiled without threads or MPI enabled"
 #else
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
                   "but the number of threads (option -nt) is 1"
 #else
                   "but mdrun was not started through mpirun/mpiexec or only one process was requested through mpirun/mpiexec" 
@@ -521,12 +521,12 @@ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
          * This should be thread safe, since they are only written once
          * and with identical values.
          */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_lock(&deform_init_box_mutex);
 #endif
         deform_init_init_step_tpx = inputrec->init_step;
         copy_mat(box,deform_init_box_tpx);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
 #endif
     }
@@ -555,7 +555,7 @@ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
     }
 
     if (((MASTER(cr) || (Flags & MD_SEPPOT)) && (Flags & MD_APPENDFILES))
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         /* With thread MPI only the master node/thread exists in mdrun.c,
          * therefore non-master nodes need to open the "seppot" log file here.
          */
@@ -952,7 +952,7 @@ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
 
     rc=(int)gmx_get_stop_condition();
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
     /* we need to join all threads. The sub-threads join when they
        exit this function, but the master thread needs to be told to 
        wait for that. */
index ec9775d4fcd504624e5bcfa035b8c71865292507..961ad66596709d65420fca651db9294e9c129409 100644 (file)
@@ -54,7 +54,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 6348bcf7c758afc030679384e090ce2148dc5f7f..c835cba064d30458f0900b199c7e902200c9d8e6 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 5d2acdfe3b07202cba3df879dbc3d215c844c607..50e2abad6f8f5581a1b1193d692d410c65659930 100644 (file)
@@ -50,7 +50,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -81,17 +81,17 @@ FILE* debug=0;
 
 
 #ifdef GMX_FFT_FFTW3 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* none of the fftw3 calls, except execute(), are thread-safe, so 
    we need to serialize them with this mutex. */
 static tMPI_Thread_mutex_t big_fftw_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 
 #define FFTW_LOCK tMPI_Thread_mutex_lock(&big_fftw_mutex)
 #define FFTW_UNLOCK tMPI_Thread_mutex_unlock(&big_fftw_mutex)
-#else /* GMX_THREADS */
+#else /* GMX_THREAD_MPI */
 #define FFTW_LOCK 
 #define FFTW_UNLOCK 
-#endif /* GMX_THREADS */
+#endif /* GMX_THREAD_MPI */
 #endif /* GMX_FFT_FFTW3 */
 
 static double fft5d_fmax(double a, double b){
index f314bc30c3e2f709972c250b0d1ef00f37444679..50a8c1b53bafd8d4a0c695f747c30698f2f811be 100644 (file)
@@ -60,7 +60,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 5dbbbe6dadd03d5d5735404f7a6d79580fb696d6..21c32677891f2f8d09eab0e3ce9a8a238ad8aaf6 100644 (file)
@@ -57,7 +57,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 9ff8bfc362f42f58d6110ad9134281fbb059754d..179ed40a7e73eddfdb84b872288ac684f9b615b2 100644 (file)
@@ -56,7 +56,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 8dc463a667c1020b0cebf5e1afc29a191831e862..c7b8c4c2f34085f7956e20b8a31039f5a68d6436 100644 (file)
 
 
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 /* none of the fftw3 calls, except execute(), are thread-safe, so 
    we need to serialize them with this mutex. */
 static tMPI_Thread_mutex_t big_fftw_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
 static gmx_bool gmx_fft_threads_initialized=FALSE;
 #define FFTW_LOCK tMPI_Thread_mutex_lock(&big_fftw_mutex)
 #define FFTW_UNLOCK tMPI_Thread_mutex_unlock(&big_fftw_mutex)
-#else /* GMX_THREADS */
+#else /* GMX_THREAD_MPI */
 #define FFTW_LOCK 
 #define FFTW_UNLOCK 
-#endif /* GMX_THREADS */
+#endif /* GMX_THREAD_MPI */
 
 /* We assume here that aligned memory starts at multiple of 16 bytes and unaligned memory starts at multiple of 8 bytes. The later is guranteed for all malloc implementation. 
    Consequesences:
index 449a91766ef4e56a21c8d7338748d693b5706630..9773ff4b4364ce5be72c8724477f6e5c03e97f51 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef GMX_LIB_MPI 
 #include <mpi.h>
 #endif
-#ifdef GMX_THREAD
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 964de1a582d4b8ffba30751260631643eba83ed3..9c7068c378ebed032709d8c3bc4ee1c52246a850 100644 (file)
@@ -47,7 +47,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -118,7 +118,7 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog,int resetstep,t_commrec *cr, int omp_
     snew(wc->wcc,ewcNR);
     if (getenv("GMX_CYCLE_ALL") != NULL)
     {
-/*#ifndef GMX_THREADS*/
+/*#ifndef GMX_THREAD_MPI*/
         if (fplog) 
         {
             fprintf(fplog,"\nWill time all the code during the run\n\n");
index bf57c3f1a1511be41b762bf71e6fd0a6b7bfd1f8..13d2dec56956667ad1be30f7365304fce84bde3d 100644 (file)
@@ -63,7 +63,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 4d0e3d345393a37997a922fc372741fcb5f8a606..03ab7c0786eb9daa3d1e56fdf4e340a8a4d30d75 100644 (file)
@@ -53,7 +53,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
index 5551247590f421c703cd51ceedb37fd13777e208..830ff9538b3828e56bcaef8d96194d6a306fa3f4 100644 (file)
@@ -90,7 +90,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -140,7 +140,7 @@ void print_time(FILE *out,gmx_runtime_t *runtime,gmx_large_int_t step,
     double dt;
     char buf[48];
     
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
     if (!PAR(cr))
 #endif
     {
@@ -177,7 +177,7 @@ void print_time(FILE *out,gmx_runtime_t *runtime,gmx_large_int_t step,
                     ir->delta_t/1000*24*60*60/runtime->time_per_step);
         }
     }
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
     if (PAR(cr))
     {
         fprintf(out,"\n");
index 8c2c89cd9448b0355493a9e72fe45e221f5d1fde..fa2f81653e916a5a21fc8987ffa8f9ecc51d6a03 100644 (file)
@@ -97,7 +97,7 @@
 #ifdef GMX_LIB_MPI
 #include <mpi.h>
 #endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #include "tmpi.h"
 #endif
 
@@ -1148,13 +1148,13 @@ double do_md_membed(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
 
 /*    if (DEFORM(*ir))
     {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_lock(&deform_init_box_mutex);
 #endif
         set_deform_reference_box(upd,
                                  deform_init_init_step_tpx,
                                  deform_init_box_tpx);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
         tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
 #endif
     }*/
@@ -2128,7 +2128,7 @@ double do_md_membed(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
 
         /* Check whether everything is still allright */
         if (((int)gmx_get_stop_condition() > handled_stop_condition)
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
            && MASTER(cr)
 #endif
            )
@@ -2797,7 +2797,7 @@ int mdrunner_membed(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
         read_tpx_state(ftp2fn(efTPX,nfile,fnm),inputrec,state,NULL,mtop);
 
         /* NOW the threads will be started: */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
 #endif
     }
     /* END OF CAUTION: cr is now reliable */
@@ -3736,7 +3736,7 @@ int gmx_membed(int argc,char *argv[])
        dd_node_order = nenum(ddno_opt);
        cr->npmenodes = npme;
 
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
        /* now determine the number of threads automatically. The threads are
    only started at mdrunner_threads, though. */
        if (nthreads<1)
@@ -3763,7 +3763,7 @@ int gmx_membed(int argc,char *argv[])
                gmx_fatal(FARGS,"Need at least two replicas for replica exchange (option -multi)");
 
        if (nmultisim > 1) {
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
                 gmx_bool bParFn = (multidir == NULL);
                init_multisystem(cr,nmultisim,multidir,NFILE,fnm,TRUE);
 #else