From: Szilard Pall Date: Fri, 3 Feb 2012 01:36:59 +0000 (+0100) Subject: renamed GMX_THREADS to GMX_THREAD_MPI X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=9a15633e2b3852413758bd4d215a638422cc9c0f;p=alexxy%2Fgromacs.git renamed GMX_THREADS to GMX_THREAD_MPI 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 623a325dab..5c359f5a94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/gmxManageMPI.cmake b/cmake/gmxManageMPI.cmake index 5129baeed2..5b73ec6eee 100644 --- a/cmake/gmxManageMPI.cmake +++ b/cmake/gmxManageMPI.cmake @@ -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} diff --git a/include/domdec.h b/include/domdec.h index 64b4d20a24..aec111f190 100644 --- a/include/domdec.h +++ b/include/domdec.h @@ -26,7 +26,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/include/domdec_network.h b/include/domdec_network.h index 3f8506cb4e..3d2a55c8f9 100644 --- a/include/domdec_network.h +++ b/include/domdec_network.h @@ -24,7 +24,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/include/gmx_sort.h b/include/gmx_sort.h index e58fae75f5..c1ef471b90 100644 --- a/include/gmx_sort.h +++ b/include/gmx_sort.h @@ -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 diff --git a/include/mdrun.h b/include/mdrun.h index d30fb0c952..33136be920 100644 --- a/include/mdrun.h +++ b/include/mdrun.h @@ -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, diff --git a/include/types/commrec.h b/include/types/commrec.h index 2baa5844fe..62136607be 100644 --- a/include/types/commrec.h +++ b/include/types/commrec.h @@ -38,7 +38,7 @@ #ifdef GMX_LIB_MPI #include #else -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "../tmpi.h" #else typedef void* MPI_Comm; diff --git a/src/config.h.cmakein b/src/config.h.cmakein index 84436417ad..a2e953a4b3 100644 --- a/src/config.h.cmakein +++ b/src/config.h.cmakein @@ -123,7 +123,7 @@ #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 diff --git a/src/contrib/pmetest.c b/src/contrib/pmetest.c index c5dd4a59b8..55f1d17350 100644 --- a/src/contrib/pmetest.c +++ b/src/contrib/pmetest.c @@ -60,7 +60,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/gmxlib/CMakeLists.txt b/src/gmxlib/CMakeLists.txt index fda62346fa..708ede1f7e 100644 --- a/src/gmxlib/CMakeLists.txt +++ b/src/gmxlib/CMakeLists.txt @@ -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, diff --git a/src/gmxlib/copyrite.c b/src/gmxlib/copyrite.c index 71a2b63457..ba5c40eab4 100644 --- a/src/gmxlib/copyrite.c +++ b/src/gmxlib/copyrite.c @@ -36,7 +36,7 @@ #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include #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"); diff --git a/src/gmxlib/filenm.c b/src/gmxlib/filenm.c index 8ba1ed914f..d42f37e11c 100644 --- a/src/gmxlib/filenm.c +++ b/src/gmxlib/filenm.c @@ -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 diff --git a/src/gmxlib/futil.c b/src/gmxlib/futil.c index 08d84997ad..21cf4c0077 100644 --- a/src/gmxlib/futil.c +++ b/src/gmxlib/futil.c @@ -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; diff --git a/src/gmxlib/gmx_fatal.c b/src/gmxlib/gmx_fatal.c index 62dabd5eb9..a743a515f8 100644 --- a/src/gmxlib/gmx_fatal.c +++ b/src/gmxlib/gmx_fatal.c @@ -56,7 +56,7 @@ #ifdef GMX_LIB_MPI #include #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_THREADS +#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; (imtx)); #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 diff --git a/src/gmxlib/gmxfio_asc.c b/src/gmxlib/gmxfio_asc.c index 4cab9df69d..42245f6933 100644 --- a/src/gmxlib/gmxfio_asc.c +++ b/src/gmxlib/gmxfio_asc.c @@ -55,7 +55,7 @@ #include "gmxfio.h" #include "md5.h" -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif diff --git a/src/gmxlib/gmxfio_bin.c b/src/gmxlib/gmxfio_bin.c index a072d4fd60..307704f736 100644 --- a/src/gmxlib/gmxfio_bin.c +++ b/src/gmxlib/gmxfio_bin.c @@ -53,7 +53,7 @@ #include "gmxfio.h" #include "md5.h" -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif diff --git a/src/gmxlib/gmxfio_int.h b/src/gmxlib/gmxfio_int.h index d6bb34a996..a43091f024 100644 --- a/src/gmxlib/gmxfio_int.h +++ b/src/gmxlib/gmxfio_int.h @@ -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 diff --git a/src/gmxlib/gmxfio_rw.c b/src/gmxlib/gmxfio_rw.c index d40ebf5a71..5185472863 100644 --- a/src/gmxlib/gmxfio_rw.c +++ b/src/gmxlib/gmxfio_rw.c @@ -53,7 +53,7 @@ #include "gmxfio.h" #include "md5.h" -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif diff --git a/src/gmxlib/gmxfio_xdr.c b/src/gmxlib/gmxfio_xdr.c index 05893fdd48..88ba918c0f 100644 --- a/src/gmxlib/gmxfio_xdr.c +++ b/src/gmxlib/gmxfio_xdr.c @@ -53,7 +53,7 @@ #include "gmxfio.h" #include "md5.h" -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif diff --git a/src/gmxlib/libxdrf.c b/src/gmxlib/libxdrf.c index 947a41fe3b..f279deb517 100644 --- a/src/gmxlib/libxdrf.c +++ b/src/gmxlib/libxdrf.c @@ -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 ); diff --git a/src/gmxlib/main.c b/src/gmxlib/main.c index 4b335c2a1e..e6ad33c1e2 100644 --- a/src/gmxlib/main.c +++ b/src/gmxlib/main.c @@ -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(¶llel_env_mutex); #endif ret=parallel_env_val; -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI tMPI_Thread_mutex_unlock(¶llel_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(¶llel_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(¶llel_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; diff --git a/src/gmxlib/network.c b/src/gmxlib/network.c index 580474e7df..f711b32f7b 100644 --- a/src/gmxlib/network.c +++ b/src/gmxlib/network.c @@ -50,7 +50,7 @@ #include #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 diff --git a/src/gmxlib/oenv.c b/src/gmxlib/oenv.c index 335d6c10ad..4e01d25ffe 100644 --- a/src/gmxlib/oenv.c +++ b/src/gmxlib/oenv.c @@ -57,7 +57,7 @@ #include "gmxfio.h" #include "oenv.h" -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif diff --git a/src/gmxlib/shift_util.c b/src/gmxlib/shift_util.c index 201b432e87..3b1465498b 100644 --- a/src/gmxlib/shift_util.c +++ b/src/gmxlib/shift_util.c @@ -59,14 +59,14 @@ #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 } diff --git a/src/gmxlib/smalloc.c b/src/gmxlib/smalloc.c index 55b7b8e307..77069ab5da 100644 --- a/src/gmxlib/smalloc.c +++ b/src/gmxlib/smalloc.c @@ -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 } diff --git a/src/gmxlib/statutil.c b/src/gmxlib/statutil.c index fe5a161fdd..5284428df7 100644 --- a/src/gmxlib/statutil.c +++ b/src/gmxlib/statutil.c @@ -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); diff --git a/src/gmxlib/tcontrol.c b/src/gmxlib/tcontrol.c index f4c2a39e30..c807bddea3 100644 --- a/src/gmxlib/tcontrol.c +++ b/src/gmxlib/tcontrol.c @@ -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 } diff --git a/src/gmxlib/tpxio.c b/src/gmxlib/tpxio.c index 2edea91884..1d4ff24e49 100644 --- a/src/gmxlib/tpxio.c +++ b/src/gmxlib/tpxio.c @@ -38,7 +38,7 @@ #endif /* This file is completely threadsafe - keep it that way! */ -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include #endif diff --git a/src/gmxlib/txtdump.c b/src/gmxlib/txtdump.c index ba1ce00e95..d26d0f61e5 100644 --- a/src/gmxlib/txtdump.c +++ b/src/gmxlib/txtdump.c @@ -38,7 +38,7 @@ #endif /* This file is completely threadsafe - please keep it that way! */ -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include #endif diff --git a/src/gmxlib/typedefs.c b/src/gmxlib/typedefs.c index 15fcbdc8ec..96a6ccf32a 100644 --- a/src/gmxlib/typedefs.c +++ b/src/gmxlib/typedefs.c @@ -44,7 +44,7 @@ #include "pbc.h" #include -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif @@ -54,20 +54,20 @@ 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 } diff --git a/src/kernel/fflibutil.c b/src/kernel/fflibutil.c index 0254f12bea..13bc12bbe7 100644 --- a/src/kernel/fflibutil.c +++ b/src/kernel/fflibutil.c @@ -60,7 +60,7 @@ #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "thread_mpi.h" #endif diff --git a/src/kernel/md.c b/src/kernel/md.c index 0ca2dc97a0..fb379d5590 100644 --- a/src/kernel/md.c +++ b/src/kernel/md.c @@ -91,7 +91,7 @@ #ifdef GMX_LIB_MPI #include #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 ) diff --git a/src/kernel/md_openmm.c b/src/kernel/md_openmm.c index bbc9d1d2db..810c2b7ba5 100644 --- a/src/kernel/md_openmm.c +++ b/src/kernel/md_openmm.c @@ -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 ) diff --git a/src/kernel/mdrun.c b/src/kernel/mdrun.c index 3fd7ac10cb..e4446767b7 100644 --- a/src/kernel/mdrun.c +++ b/src/kernel/mdrun.c @@ -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 diff --git a/src/kernel/runner.c b/src/kernel/runner.c index 43cca09078..59a8ea5c3d 100644 --- a/src/kernel/runner.c +++ b/src/kernel/runner.c @@ -82,7 +82,7 @@ #ifdef GMX_LIB_MPI #include #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. */ diff --git a/src/mdlib/domdec.c b/src/mdlib/domdec.c index ec9775d4fc..961ad66596 100644 --- a/src/mdlib/domdec.c +++ b/src/mdlib/domdec.c @@ -54,7 +54,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/domdec_network.c b/src/mdlib/domdec_network.c index 6348bcf7c7..c835cba064 100644 --- a/src/mdlib/domdec_network.c +++ b/src/mdlib/domdec_network.c @@ -26,7 +26,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/fft5d.c b/src/mdlib/fft5d.c index 5d2acdfe3b..50e2abad6f 100644 --- a/src/mdlib/fft5d.c +++ b/src/mdlib/fft5d.c @@ -50,7 +50,7 @@ #ifdef GMX_LIB_MPI #include #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){ diff --git a/src/mdlib/genborn.c b/src/mdlib/genborn.c index f314bc30c3..50a8c1b53b 100644 --- a/src/mdlib/genborn.c +++ b/src/mdlib/genborn.c @@ -60,7 +60,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/genborn_sse2_double.c b/src/mdlib/genborn_sse2_double.c index 5dbbbe6dad..21c3267789 100644 --- a/src/mdlib/genborn_sse2_double.c +++ b/src/mdlib/genborn_sse2_double.c @@ -57,7 +57,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/genborn_sse2_single.c b/src/mdlib/genborn_sse2_single.c index 9ff8bfc362..179ed40a7e 100644 --- a/src/mdlib/genborn_sse2_single.c +++ b/src/mdlib/genborn_sse2_single.c @@ -56,7 +56,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/gmx_fft_fftw3.c b/src/mdlib/gmx_fft_fftw3.c index 8dc463a667..c7b8c4c2f3 100644 --- a/src/mdlib/gmx_fft_fftw3.c +++ b/src/mdlib/gmx_fft_fftw3.c @@ -37,17 +37,17 @@ -#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: diff --git a/src/mdlib/gmx_parallel_3dfft.c b/src/mdlib/gmx_parallel_3dfft.c index 449a91766e..9773ff4b43 100644 --- a/src/mdlib/gmx_parallel_3dfft.c +++ b/src/mdlib/gmx_parallel_3dfft.c @@ -26,7 +26,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/gmx_wallcycle.c b/src/mdlib/gmx_wallcycle.c index 964de1a582..9c7068c378 100644 --- a/src/mdlib/gmx_wallcycle.c +++ b/src/mdlib/gmx_wallcycle.c @@ -47,7 +47,7 @@ #ifdef GMX_LIB_MPI #include #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"); diff --git a/src/mdlib/pme.c b/src/mdlib/pme.c index bf57c3f1a1..13d2dec569 100644 --- a/src/mdlib/pme.c +++ b/src/mdlib/pme.c @@ -63,7 +63,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/pme_pp.c b/src/mdlib/pme_pp.c index 4d0e3d3453..03ab7c0786 100644 --- a/src/mdlib/pme_pp.c +++ b/src/mdlib/pme_pp.c @@ -53,7 +53,7 @@ #ifdef GMX_LIB_MPI #include #endif -#ifdef GMX_THREADS +#ifdef GMX_THREAD_MPI #include "tmpi.h" #endif diff --git a/src/mdlib/sim_util.c b/src/mdlib/sim_util.c index 5551247590..830ff9538b 100644 --- a/src/mdlib/sim_util.c +++ b/src/mdlib/sim_util.c @@ -90,7 +90,7 @@ #ifdef GMX_LIB_MPI #include #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"); diff --git a/src/tools/gmx_membed.c b/src/tools/gmx_membed.c index 8c2c89cd94..fa2f81653e 100644 --- a/src/tools/gmx_membed.c +++ b/src/tools/gmx_membed.c @@ -97,7 +97,7 @@ #ifdef GMX_LIB_MPI #include #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