tmpi_enable()
set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_THREAD_MPI")
set(GMX_MPI 1)
+ set(MPI_IN_PLACE_EXISTS 1)
endif(GMX_THREAD_MPI)
tmpi_get_source_list(THREAD_MPI_SRC)
set(${SRC_VARIABLE}
thread_mpi/errhandler.c
thread_mpi/tmpi_malloc.c
- thread_mpi/atomic.c)
+ thread_mpi/atomic.c
+ thread_mpi/lock.c)
if (THREAD_PTHREADS)
list(APPEND ${SRC_VARIABLE} thread_mpi/pthreads.c)
elseif (THREAD_WINDOWS)
thread_mpi/gather.c thread_mpi/scatter.c
thread_mpi/group.c thread_mpi/tmpi_init.c
thread_mpi/topology.c thread_mpi/list.c
- thread_mpi/type.c thread_mpi/lock.c
- thread_mpi/numa_malloc.c thread_mpi/once.c
- thread_mpi/scan.c)
+ thread_mpi/type.c thread_mpi/scan.c
+ thread_mpi/numa_malloc.c thread_mpi/once.c)
endif()
ENDMACRO(TMPI_GET_SOURCE_LIST)
#include "xdrf.h"
#include "macros.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
/* NOTE: this was a cesspool of thread-unsafe code, has now been
properly proteced by mutexes (hopefully). */
static char *default_file_name = NULL;
-#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t filenm_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
#define NZEXT 2
static const char *z_ext[NZEXT] =
void set_default_file_name(const char *name)
{
- int i;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&filenm_mutex);
-#endif
default_file_name = strdup(name);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&filenm_mutex);
-#endif
-
}
const char *ftp2ext(int ftp)
{
const char *buf = NULL;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&filenm_mutex);
-#endif
if (default_file_name)
{
buf = deffile[ftp].defnm;
}
}
-#ifdef GMX_THREAD_MPI
+
tMPI_Thread_mutex_unlock(&filenm_mutex);
-#endif
return buf;
}
#include "gromacs/utility/programinfo.h"
#include "gromacs/utility/stringutil.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi/threads.h"
-#endif
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
/* we keep a linked list of all files opened through pipes (i.e.
compressed or .gzipped files. This way we can distinguish between them
static t_pstack *pstack = NULL;
static gmx_bool bUnbuffered = FALSE;
-#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;
-#endif
void no_buffers(void)
{
{
t_pstack *ps;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
-#endif
snew(ps, 1);
ps->fp = fp;
ps->prev = pstack;
pstack = ps;
-#ifdef GMX_THREAD_MPI
+
tMPI_Thread_mutex_unlock(&pstack_mutex);
-#endif
}
#ifdef GMX_FAHCORE
#else
t_pstack *ps, *tmp;
int ret = 0;
-#ifdef GMX_THREAD_MPI
+
tMPI_Thread_mutex_lock(&pstack_mutex);
-#endif
ps = pstack;
if (ps == NULL)
}
}
}
-#ifdef GMX_THREAD_MPI
+
tMPI_Thread_mutex_unlock(&pstack_mutex);
-#endif
return ret;
#endif
}
void frewind(FILE *fp)
{
- t_pstack *ps;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
-#endif
- ps = pstack;
+ t_pstack *ps = pstack;
while (ps != NULL)
{
if (ps->fp == fp)
{
fprintf(stderr, "Cannot rewind compressed file!\n");
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
-#endif
return;
}
ps = ps->prev;
}
rewind(fp);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
-#endif
}
int gmx_fseek(FILE *stream, gmx_off_t offset, int whence)
gmx_bool is_pipe(FILE *fp)
{
- t_pstack *ps;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
-#endif
- ps = pstack;
+ t_pstack *ps = pstack;
while (ps != NULL)
{
if (ps->fp == fp)
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
-#endif
return TRUE;
}
ps = ps->prev;
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
-#endif
return FALSE;
}
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
#include "gmxfio_int.h"
static t_fileio *open_files = NULL;
-#ifdef GMX_THREAD_MPI
/* this mutex locks the open_files structure so that no two threads can
modify it.
iterating along all open files. All these cases should be rare
during the simulation. */
static tMPI_Thread_mutex_t open_file_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
/* These simple lists define the I/O type for these files */
type of access to the fio's elements. */
void gmx_fio_lock(t_fileio *fio)
{
-#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_THREAD_MPI
tMPI_Lock_unlock(&(fio->mtx));
-#endif
}
/* make a dummy head element, assuming we locked everything. */
open_files->fn = NULL;
open_files->next = open_files;
open_files->prev = open_files;
-#ifdef GMX_THREAD_MPI
tMPI_Lock_init(&(open_files->mtx));
-#endif
}
}
static void gmx_fio_insert(t_fileio *fio)
{
t_fileio *prev;
-#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
tMPI_Thread_mutex_lock(&open_file_mutex);
-#endif
/* now check whether the dummy element has been allocated,
and allocate it if it hasn't */
gmx_fio_make_dummy();
gmx_fio_unlock(open_files);
gmx_fio_unlock(fio);
-#ifdef GMX_THREAD_MPI
/* now unlock the big open_files mutex. */
tMPI_Thread_mutex_unlock(&open_file_mutex);
-#endif
}
/* remove a t_fileio into the list. We assume the fio is locked, and we leave
t_fileio *ret;
/* first lock the big open_files mutex and the dummy's mutex */
-#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
tMPI_Thread_mutex_lock(&open_file_mutex);
-#endif
gmx_fio_make_dummy();
gmx_fio_lock(open_files);
if (fio->next == open_files)
{
ret = NULL;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
-#endif
}
else
{
static void gmx_fio_stop_getting_next(t_fileio *fio)
{
gmx_fio_unlock(fio);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
-#endif
}
}
snew(fio, 1);
-#ifdef GMX_THREAD_MPI
tMPI_Lock_init(&(fio->mtx));
-#endif
bRead = (newmode[0] == 'r' && newmode[1] != '+');
bReadWrite = (newmode[1] == '+');
fio->fp = NULL;
{
int rc = 0;
-#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);
-#endif
gmx_fio_lock(fio);
/* first remove it from the list */
sfree(fio->fn);
sfree(fio);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
-#endif
return rc;
}
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
-
#include "gmxfio_int.h"
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
-
#include "gmxfio_int.h"
/* This is the part that reads dummy and ascii files. */
*/
#define USE_XDR
-
+#include "gromacs/legacyheaders/thread_mpi/lock.h"
/* the reader/writer functions for t_iotype */
typedef gmx_bool read_func (t_fileio *fio, void *item, int nitem, int eio,
t_fileio *next, *prev; /* next and previous file pointers in the
linked list */
-#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
a lock */
-#endif
};
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
-
#include "gmxfio_int.h"
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
-
#include "gmxfio_int.h"
/* This is the part that reads xdr files. */
#endif
/* This file is completely threadsafe - keep it that way! */
-#ifdef GMX_THREAD_MPI
-#include <thread_mpi.h>
-#endif
-
#include <ctype.h>
#include "sysstuff.h"
#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
+
static gmx_bool bDebug = FALSE;
static char *fatal_tmp_file = NULL;
static FILE *log_file = NULL;
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi/threads.h"
static tMPI_Thread_mutex_t debug_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
static tMPI_Thread_mutex_t where_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
static tMPI_Thread_mutex_t fatal_tmp_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
gmx_bool bDebugMode(void)
{
gmx_bool ret;
-/*#ifdef GMX_THREAD_MPI*/
#if 0
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
ret = bDebug;
-/*#ifdef GMX_THREAD_MPI*/
#if 0
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
if (bFirst)
{
-#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 */
{
-#endif
- if ((temp = getenv("WHERE")) != NULL)
- {
- nskip = strtol(temp, NULL, 10);
+ if ((temp = getenv("WHERE")) != NULL)
+ {
+ nskip = strtol(temp, NULL, 10);
+ }
+ bFirst = FALSE;
}
- bFirst = FALSE;
-#ifdef GMX_THREAD_MPI
- }
- tMPI_Thread_mutex_unlock(&where_mutex);
-#endif
-
+ tMPI_Thread_mutex_unlock(&where_mutex);
}
if (nskip >= 0)
static void quit_gmx(const char *msg)
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
if (fatal_errno == 0)
{
if (log_file)
}
exit(fatal_errno);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
-#endif
}
/* The function below should be identical to quit_gmx,
*/
static void quit_gmx_noquit(const char *msg)
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
if (!fatal_errno)
{
if (log_file)
}
#endif
-#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_THREAD_MPI
tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
-#endif
if (fatal_tmp_file == NULL)
{
fatal_tmp_file = strdup(fn);
fprintf(stderr, "BUGWARNING: fatal_tmp_file already set at %s:%d",
file, line);
}
-#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_THREAD_MPI
tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
-#endif
if (strcmp(fn, fatal_tmp_file) == 0)
{
sfree(fatal_tmp_file);
fprintf(stderr, "BUGWARNING: file %s not set as fatal_tmp_file at %s:%d",
fn, file, line);
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
-#endif
}
static void clean_fatal_tmp_file()
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
-#endif
if (fatal_tmp_file)
{
fprintf(stderr, "Cleaning up temporary file %s\n", fatal_tmp_file);
sfree(fatal_tmp_file);
fatal_tmp_file = NULL;
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
-#endif
}
static void parse_printf_args(const char *fmt, va_list *ap, char *msg)
va_end(ap);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
-
fatal_errno = f_errno;
-
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
-#endif
_gmx_error("fatal", msg, file, line);
}
va_end(ap);
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
-
fatal_errno = f_errno;
-
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
-#endif
if (bFinalize)
{
FILE *debug = NULL;
gmx_bool gmx_debug_at = FALSE;
-void init_debug (const int dbglevel, const char *dbgfile)
+void init_debug(const int dbglevel, const char *dbgfile)
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
if (!bDebug) /* another thread hasn't already run this*/
{
no_buffers();
gmx_debug_at = TRUE;
}
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
-#endif
}
#if (defined __sgi && defined USE_SGI_FPE)
int onoff, en_mask, abort_action, i;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
onoff = _DEBUG;
en_mask = _EN_UNDERFL | _EN_OVERFL | _EN_DIVZERO |
_EN_INVALID | _EN_INT_OVERFL;
{
signal(hs[i], handle_signals);
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
-#endif
}
#endif /* __sgi and FPE */
void set_gmx_error_handler(void (*func)(const char *msg))
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
-#endif
gmx_error_handler = func;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
-#endif
}
char *gmx_strerror(const char *key)
#include "string2.h"
#include "copyrite.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
-
#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/gmxmpi.h"
#include "gromacs/utility/programinfo.h"
/* The source code in this file should be thread-safe.
MPI_Comm_create(MPI_COMM_WORLD, ms->mpi_group_masters,
&ms->mpi_comm_masters);
-#if !defined(GMX_THREAD_MPI) && !defined(MPI_IN_PLACE_EXISTS)
+#if !defined(MPI_IN_PLACE_EXISTS)
/* initialize the MPI_IN_PLACE replacement buffers */
snew(ms->mpb, 1);
ms->mpb->ibuf = NULL;
// TODO cr->duty should not be initialized here
cr->duty = (DUTY_PP | DUTY_PME);
-#if defined GMX_LIB_MPI && !defined MPI_IN_PLACE_EXISTS
+#if defined GMX_MPI && !defined MPI_IN_PLACE_EXISTS
/* initialize the MPI_IN_PLACE replacement buffers */
snew(cr->mpb, 1);
cr->mpb->ibuf = NULL;
#ifndef GMX_MPI
gmx_call("gmx_sumd");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
if (cr->nc.bUse)
{
if (cr->nc.rank_intra == 0)
#ifndef GMX_MPI
gmx_call("gmx_sumf");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
if (cr->nc.bUse)
{
/* Use two step summing. */
#ifndef GMX_MPI
gmx_call("gmx_sumi");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
if (cr->nc.bUse)
{
/* Use two step summing */
#ifndef GMX_MPI
gmx_call("gmx_sumli");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
if (cr->nc.bUse)
{
/* Use two step summing */
#ifdef GMX_MPI
void gmx_sumd_comm(int nr, double r[], MPI_Comm mpi_comm)
{
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
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,
#ifdef GMX_MPI
void gmx_sumf_comm(int nr, float r[], MPI_Comm mpi_comm)
{
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
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,
#ifndef GMX_MPI
gmx_call("gmx_sumi_sim");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
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: */
#ifndef GMX_MPI
gmx_call("gmx_sumli_sim");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
+#if defined(MPI_IN_PLACE_EXISTS)
MPI_Allreduce(MPI_IN_PLACE, r, nr, GMX_MPI_LARGE_INT, MPI_SUM,
ms->mpi_comm_masters);
#else
#include <config.h>
#endif
-#ifdef GMX_THREAD_MPI
-#include <thread_mpi.h>
-#endif
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
#include <stdio.h>
#include <stdlib.h>
#endif
-#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t nonbonded_setup_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
static gmx_bool nonbonded_setup_done = FALSE;
gmx_nonbonded_setup(t_forcerec * fr,
gmx_bool bGenericKernelOnly)
{
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&nonbonded_setup_mutex);
-#endif
/* Here we are guaranteed only one thread made it. */
if (nonbonded_setup_done == FALSE)
{
nonbonded_setup_done = TRUE;
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&nonbonded_setup_mutex);
-#endif
}
#endif
#ifdef DEBUG
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
+
static void log_action(int bMal, const char *what, const char *file, int line,
int nelem, int size, void *ptr)
{
bytes = -bytes;
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&gmx_logfile_mtx);
-#endif
/* This total memory count is not correct, since with realloc
* it adds the whole size again, not just the increment.
what ? what : NN, bytes/1024.0,
file ? fname : NN, line, nelem, size);
}
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&gmx_logfile_mtx);
-#endif
}
#endif
#include "typedefs.h"
#include "gmx_fatal.h"
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
/* The source code in this file should be thread-safe.
Please keep it that way. */
{ 0, FALSE }
};
-#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t tc_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
gmx_bool bTimeSet(int tcontrol)
{
gmx_bool ret;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&tc_mutex);
-#endif
range_check(tcontrol, 0, TNR);
ret = timecontrol[tcontrol].bSet;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&tc_mutex);
-#endif
return ret;
}
{
real ret;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&tc_mutex);
-#endif
range_check(tcontrol, 0, TNR);
ret = timecontrol[tcontrol].t;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&tc_mutex);
-#endif
return ret;
}
void setTimeValue(int tcontrol, real value)
{
-#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_THREAD_MPI
tMPI_Thread_mutex_unlock(&tc_mutex);
-#endif
}
#endif
/* This file is completely threadsafe - please keep it that way! */
-#ifdef GMX_THREAD_MPI
-#include <thread_mpi.h>
-#endif
-
#include <stdio.h>
#include "smalloc.h"
#include "macros.h"
#include <string.h>
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
+#include "gromacs/legacyheaders/thread_mpi/threads.h"
/* The source code in this file should be thread-safe.
Please keep it that way. */
static gmx_bool bOverAllocDD = FALSE;
-#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_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_THREAD_MPI
tMPI_Thread_mutex_unlock(&over_alloc_mutex);
-#endif
}
int over_alloc_dd(int n)
#include <unistd.h>
#endif
-#ifdef GMX_THREAD_MPI
-#include "thread_mpi.h"
-#endif
-
#include "fflibutil.h"
const char *fflib_forcefield_dir_ext()
#include "types/membedt.h"
#include "types/globsig.h"
-
-#ifdef GMX_THREAD_MPI
#include "thread_mpi/threads.h"
-#endif
#ifdef __cplusplus
extern "C" {
*/
extern gmx_large_int_t deform_init_init_step_tpx;
extern matrix deform_init_box_tpx;
-#ifdef GMX_THREAD_MPI
extern tMPI_Thread_mutex_t deform_init_box_mutex;
+#ifdef GMX_THREAD_MPI
/* The minimum number of atoms per tMPI thread. With fewer atoms than this,
* the number of threads will get lowered.
*/
if (DEFORM(*ir))
{
-#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_THREAD_MPI
tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
-#endif
}
{
gmx_bool bParFn = (multidir == NULL);
init_multisystem(cr, nmultisim, multidir, NFILE, fnm, bParFn);
#else
- gmx_fatal(FARGS, "mdrun -multi is not supported with the thread library.Please compile GROMACS with MPI support");
+ gmx_fatal(FARGS, "mdrun -multi is not supported with the thread library. "
+ "Please compile GROMACS with MPI support");
#endif
}
gmx_large_int_t deform_init_init_step_tpx;
matrix deform_init_box_tpx;
-#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_t deform_init_box_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-#endif
#ifdef GMX_THREAD_MPI
* This should be thread safe, since they are only written once
* and with identical values.
*/
-#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_THREAD_MPI
tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
-#endif
}
if (opt2bSet("-cpi", nfile, fnm))