project(Gromacs)
include(Dart)
+mark_as_advanced(DART_ROOT)
# PROJECT_VERSION should have the following structure:
# VERSION[-dev-SUFFIX] where the VERSION can have any form and the suffix
-set(PROJECT_VERSION "4.5.1"
- CACHE STRING "Gromacs version string")
+set(PROJECT_VERSION "4.5.1")
+set(CUSTOM_VERSION_STRING ""
+ CACHE STRING "Custom version string (if empty, use hard-coded default)")
+mark_as_advanced(CUSTOM_VERSION_STRING)
+if (CUSTOM_VERSION_STRING)
+ set(PROJECT_VERSION ${CUSTOM_VERSION_STRING})
+endif (CUSTOM_VERSION_STRING)
set(SOVERSION 6)
# It is a bit irritating, but this has to be set separately for now!
SET(CPACK_PACKAGE_VERSION_MAJOR "4")
SET(CPACK_PACKAGE_VERSION_MINOR "5")
-SET(CPACK_PACKAGE_VERSION_PATCH "0")
+SET(CPACK_PACKAGE_VERSION_PATCH "1")
# Cmake modules/macros are in a subdirectory to keep this file cleaner
########################################################################
# User input options #
########################################################################
-option(GMX_DOUBLE "Use double precision" OFF)
+option(GMX_DOUBLE "Use double precision. Much slower, use only if needed!)" OFF)
option(GMX_MPI "Build a parallel (message-passing) version of GROMACS" OFF)
option(GMX_THREADS "Build a parallel (thread-based) version of GROMACS)" ON)
option(GMX_SOFTWARE_INVSQRT "Use GROMACS software 1/sqrt" ON)
+mark_as_advanced(GMX_SOFTWARE_INVSQRT)
option(GMX_FAHCORE "Build a library with mdrun functionality" OFF)
+mark_as_advanced(GMX_FAHCORE)
option(GMX_OPENMM "Accelerated execution on GPUs through the OpenMM library" OFF)
set(GMX_ACCELERATION "auto"
- CACHE STRING "Accelerated kernels. Pick one of: none, SSE, BlueGene, Power6, ia64, altivec")
+ CACHE STRING "Accelerated kernels. Pick one of: auto, none, SSE, BlueGene, Power6, ia64, altivec")
set(GMX_FFT_LIBRARY "fftw3"
CACHE STRING "FFT library choices: fftw3,fftw2,mkl,fftpack[built-in]")
option(GMX_DISABLE_FFTW_MEASURE
"Do not optimize FFTW setups (not needed with SSE)" OFF)
+mark_as_advanced(GMX_DISABLE_FFTW_MEASURE)
set(GMX_QMMM_PROGRAM "none"
CACHE STRING "QM package choices: none,gaussian,mopac,gamess,orca")
option(GMX_BROKEN_CALLOC "Work around broken calloc()" OFF)
+mark_as_advanced(GMX_BROKEN_CALLOC)
option(BUILD_SHARED_LIBS "Enable shared libraries (can be problematic with MPI, Windows)" ${SHARED_LIBS_DEFAULT})
option(GMX_MPI_IN_PLACE "Enable MPI_IN_PLACE for MPIs that have it defined" ON)
-option(GMX_DLOPEN "Compile with dlopen, needed to read VMD supported file formats" ON)
mark_as_advanced(GMX_MPI_IN_PLACE)
+option(GMX_DLOPEN "Compile with dlopen, needed to read VMD supported file formats" ON)
+mark_as_advanced(GMX_DLOPEN)
option(GMX_IA32_ASM "Add SSE assembly files for IA32" OFF)
+mark_as_advanced(GMX_IA32_ASM)
option(GMX_X86_64_ASM "Add SSE assembly files for X86_64" OFF)
+mark_as_advanced(GMX_X86_64_ASM)
option(USE_VERSION_H "Generate development version string/information" ON)
+mark_as_advanced(USE_VERSION_H)
option(GMX_DEFAULT_SUFFIX "Use default GROMACS suffixes" ON)
set(GMX_BINARY_SUFFIX "" CACHE STRING "Suffix for GROMACS binaries (default: _d for double).")
set (GMX_BINARY_SUFFIX "_d")
set (GMX_LIBS_SUFFIX "${GMX_LIBS_SUFFIX}_d")
endif(GMX_DOUBLE)
+ mark_as_advanced(FORCE GMX_BINARY_SUFFIX GMX_LIBS_SUFFIX)
+else(GMX_DEFAULT_SUFFIX)
+ mark_as_advanced(CLEAR GMX_BINARY_SUFFIX GMX_LIBS_SUFFIX)
endif(GMX_DEFAULT_SUFFIX)
set(PKG_CFLAGS "")
if(GMX_FAHCORE)
message(FATAL_ERROR "The OpenMM build does not support FAH build!")
endif(GMX_FAHCORE)
+ set(GMX_DOUBLE OFF FORCE )
+ # mark as advanced the unused variables
+ mark_as_advanced(FORCE GMX_ACCELERATION GMX_MPI GMX_FFT_LIBRARY
+ GMX_QMMM_PROGRAM GMX_THREADS GMX_DOUBLE)
+else(GMX_OPENMM)
+ mark_as_advanced(CLEAR GMX_ACCELERATION GMX_MPI GMX_FFT_LIBRARY
+ GMX_QMMM_PROGRAM GMX_THREADS GMX_DOUBLE)
endif(GMX_OPENMM)
if (${GMX_ACCELERATION} STREQUAL "auto" AND NOT GMX_OPENMM)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x64|x86_64|AMD64|amd64)")
- set(GMX_ACCELERATION "SSE" CACHE STRING "Accelerated kernels. Pick one of: none, SSE, BlueGene, Power6, ia64, altivec" FORCE)
+ set(GMX_ACCELERATION "SSE" CACHE STRING "Accelerated kernels. Pick one of: auto, none, SSE, BlueGene, Power6, ia64, altivec" FORCE)
if (GMX_64_BIT)
set(GMX_X86_64_ASM ON CACHE BOOL "Add SSE assembly files for x86_64" FORCE)
# Determine the assembler/compiler to use
else()
- set(GMX_ACCELERATION "none" CACHE STRING "Accelerated kernels. Pick one of: none, SSE, BlueGene, Power6, ia64, altivec" FORCE)
+ set(GMX_ACCELERATION "none" CACHE STRING "Accelerated kernels. Pick one of: auto, none, SSE, BlueGene, Power6, ia64, altivec" FORCE)
endif()
endif (${GMX_ACCELERATION} STREQUAL "auto" AND NOT GMX_OPENMM)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
option(GMX_ASM_USEASM-NASM "Use Nasm for assembly instead of compiler (necessary on windows)" ON)
- else(CMAKE_GENERATOR MATCHES "Visual Studio")
+ else()
option(GMX_ASM_USEASM-NASM "Use Nasm for assembly instead of compiler (necessary on windows)" OFF)
- endif(CMAKE_GENERATOR MATCHES "Visual Studio")
+ endif()
+ mark_as_advanced(GMX_ASM_USEASM-NASM)
+
if (NOT GMX_64_BIT)
# for 32-bit compiles, we might need to turn on sse
CHECK_C_COMPILER_FLAG("-msse2" XFLAGS_SSE)
set(GMX_PPC_ALTIVEC 1)
endif(HAVE_ALTIVEC_H)
else(${GMX_ACCELERATION} STREQUAL "NONE")
- MESSAGE(FATAL_ERROR "Unrecognized option for accelerated kernels: ${GMX_ACCELERATION}. Pick one of none, SSE, Fortran, BlueGene, Power6, ia64, altivec")
+ MESSAGE(FATAL_ERROR "Unrecognized option for accelerated kernels: ${GMX_ACCELERATION}. Pick one of auto, none, SSE, Fortran, BlueGene, Power6, ia64, altivec")
endif(${GMX_ACCELERATION} STREQUAL "NONE")
set(GMX_EXTERNAL_BLAS FALSE CACHE BOOL "Use external LAPACK instead of built-in")
set(GMX_EXTERNAL_LAPACK FALSE CACHE BOOL "Use external LAPACK instead of built-in")
endif(HAVE_MKL OR ACCELERATE_FRAMEWORK)
+mark_as_advanced(GMX_EXTERNAL_LAPACK)
+mark_as_advanced(GMX_EXTERNAL_BLAS)
# Math and thread libraries must often come after all others when linking...
if(HAVE_LIBM)
# Tests #
########################################################################
-enable_testing()
-add_test(TestBuildAll make)
+include(CTest)
+mark_as_advanced(BUILD_TESTING)
+IF(BUILD_TESTING)
+ enable_testing()
+ add_test(TestBuildAll make)
+ add_subdirectory(tests)
+ENDIF()
-add_subdirectory(tests)
# Don't edit - this file is generated automatically from Makefile.am
#
+pkgincludethread_mpidir = ${pkgincludedir}/thread_mpi/atomic
-pkgincludethread_mpiatomicdir = ${pkgincludedir}/thread_mpi/atomic
-
-pkgincludethread_mpiatomic_HEADERS = \
- gcc.h gcc_ppc.h hpux.h \
- gcc_ia64.h gcc_spinlock.h msvc.h xlc_ppc.h \
- gcc_intrinsics.h gcc_x86.h
+pkgincludethread_mpi_HEADERS = \
+ cycles.h gcc_intrinsics.h gcc_x86.h\
+ gcc.h gcc_ppc.h msvc.h\
+ gcc_ia64.h gcc_spinlock.h xlc_ppc.h
*/
-/* this file is not used any more. gcc intrinsics take care of it */
+/* NOTE:
+ ***************************************************************************
+ this file is not used any more. gcc intrinsics take care of the atomics
+***************************************************************************
-/* PowerPC using proper GCC inline assembly.
- * Recent versions of xlC (>=7.0) _partially_ support this, but since it is
- * not 100% compatible we provide a separate implementation for xlC in
- * the next section.
- */
+*/
+
+#error included gcc_ppc.h. This file is outdated
+++ /dev/null
-/*
-This source code file is part of thread_mpi.
-Written by Sander Pronk, Erik Lindahl, and possibly others.
-
-Copyright (c) 2009, Sander Pronk, Erik Lindahl.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1) Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2) Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3) Neither the name of the copyright holders nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-If you want to redistribute modifications, please consider that
-scientific software is very special. Version control is crucial -
-bugs must be traceable. We will be happy to consider code for
-inclusion in the official distribution, but derived work should not
-be called official thread_mpi. Details are found in the README & COPYING
-files.
-*/
-
-
-/* HP compiler on ia64 */
-#include <machine/sys/inline.h>
-
-#define tMPI_Atomic_memory_barrier() _Asm_mf()
-
-#define tMPI_hpia64_fetchadd(a, i) \
- _Asm_fetchadd((_Asm_fasz)_FASZ_W,(_Asm_sem)_SEM_REL, \
- (UInt32*)a,(unsigned int) i, \
- (_Asm_ldhint)LDHINT_NONE)
-
-
-typedef struct tMPI_Atomic
-{
- volatile int value; /*!< Volatile, to avoid compiler aliasing */
-}
-tMPI_Atomic_t;
-
-typedef struct tMPI_Atomic_ptr
-{
- void* volatile* value; /*!< Volatile, to avoid compiler aliasing */
-}
-tMPI_Atomic_ptr_t;
-
-
-
-typedef struct tMPI_Spinlock
-{
- volatile unsigned int lock; /*!< Volatile, to avoid compiler aliasing */
-}
-tMPI_Spinlock_t;
-
-
-static inline int tMPI_Atomic_cas(tMPI_Atomic_t * a,
- int oldval,
- int newval)
-{
- int ret;
-
- _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV,(Uint32)oldval,
- (_Asm_fence)(_UP_CALL_FENCE | _UP_SYS_FENCE |
- _DOWN_CALL_FENCE | _DOWN_SYS_FENCE));
-
- ret = _Asm_cmpxchg((_Asm_sz)SZ_W,(_Asm_sem)_SEM_ACQ,(Uint32*)a,
- (Uint32)newval,(_Asm_ldhint)_LDHINT_NONE);
-
- return ret==oldval;
-}
-
-
-
-static inline void* tMPI_Atomic_ptr_cas(tMPI_Atomic_ptr_t * a,
- void* oldval,
- void* newval)
-{
- void *ret;
-
- /* todo: fix this */
-
- _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV,(Uint64)oldval,
- (_Asm_fence)(_UP_CALL_FENCE | _UP_SYS_FENCE |
- _DOWN_CALL_FENCE | _DOWN_SYS_FENCE));
-
- ret = _Asm_cmpxchg((_Asm_sz)SZ_W,(_Asm_sem)_SEM_ACQ,(Uint64)a,
- (Uint64)newval,(_Asm_ldhint)_LDHINT_NONE);
-
- return ret==oldval;
-}
-
-
-
-
-#define TMPI_SPINLOCK_INITIALIZER { 0 }
-
-
-#define tMPI_Atomic_get(a) ((a)->value)
-#define tMPI_Atomic_set(a,i) (((a)->value) = (i))
-
-
-static inline void tMPI_Atomic_add_return(tMPI_Atomic_t * a,
- int i)
-{
- int old,new;
- int __i = i;
-
- /* On HP-UX we don't know any macro to determine whether the increment
- * is known at compile time, but hopefully the call uses something simple
- * like a constant, and then the optimizer should be able to do the job.
- */
- if ( (__i == 1) || (__i == 4) || (__i == 8) || (__i == 16) ||
- (__i == -1) || (__i == -4) || (__i == -8) || (__i == -16) )
- {
- oldval = tMPI_hpia64_fetchadd(a,__i);
- newval = oldval + i;
- }
- else
- {
- /* Use compare-exchange addition that works with any value */
- do
- {
- oldval = tMPI_Atomic_get(a);
- newval = oldval + i;
- }
- while(!tMPI_Atomic_cas(a,oldval,newval));
- }
- return newval;
-}
-
-
-
-static inline int tMPI_Atomic_fetch_add(tMPI_Atomic_t * a,
- int i)
-{
- int oldval,newval;
- int __i = i;
-
- /* On HP-UX we don't know any macro to determine whether the increment
- * is known at compile time, but hopefully the call uses something simple
- * like a constant, and then the optimizer should be able to do the job.
- */
- if ( (__i == 1) || (__i == 4) || (__i == 8) || (__i == 16) ||
- (__i == -1) || (__i == -4) || (__i == -8) || (__i == -16) )
- {
- oldval = tMPI_hpia64_fetchadd(a,__i);
- newval = oldval + i;
- }
- else
- {
- /* Use compare-exchange addition that works with any value */
- do
- {
- oldval = tMPI_Atomic_get(a);
- newval = oldval + i;
- }
- while(!tMPI_Atomic_cas(a,oldval,newval));
- }
- return oldval;
-}
-
-
-static inline void tMPI_Spinlock_init(tMPI_Spinlock_t *x)
-{
- x->lock = 0;
-}
-
-
-
-
-
-static inline void tMPI_Spinlock_trylock(tMPI_Spinlock_t *x)
-{
- int rc;
-
- rc = _Asm_xchg((_Asm_sz)_SZ_W, (unsigned int *)x, 1
- (_Asm_ldhit)_LDHINT_NONE);
-
- return ( (rc>0) ? 1 : 0);
-}
-
-
-static inline void tMPI_Spinlock_lock(tMPI_Spinlock_t *x)
-{
- int status = 1;
-
- do
- {
- if( *((unsigned int *)x->lock) == 0 )
- {
- status = tMPI_Spinlock_trylock(x);
- }
- } while( status != 0);
-}
-
-
-static inline void tMPI_Spinlock_unlock(tMPI_Spinlock_t * x)
-{
- _Asm_fetchadd((_Asm_fasz)_SZ_W,(_Asm_sem)_SEM_REL,
- (unsigned int *)x,-1,(_Asm_ldhint)_LDHINT_NONE);
-}
-
-
-
-static inline void tMPI_Spinlock_islocked(const tMPI_Spinlock_t * x)
-{
- return ( x->lock != 0 );
-}
-
-
-
-static inline void tMPI_Spinlock_wait(tMPI_Spinlock_t * x)
-{
- do
- {
- tMPI_Atomic_memory_barrier();
- }
- while(spin_islocked(x));
-}
-
-
-#undef tMPI_hpia64_fetchadd
-
-
-
int ret;
__fence(); /* this one needs to be here to avoid ptr. aliasing issues */
- __eieio(); /* these memory barriers are neccesary */
+ __eieio();
ret=(__compare_and_swap(&(a->value), &oldval, newval));
__isync();
__fence(); /* and this one needs to be here to avoid aliasing issues */
volatile char* volatile* newv=newval;
__fence(); /* this one needs to be here to avoid ptr. aliasing issues */
- __eieio(); /* these memory barriers are neccesary */
+ __eieio();
#if (!defined (__LP64__) ) && (!defined(__powerpc64__) )
ret=__compare_and_swap((int *)&(a->value), (int*)&oldv, (int)newv);
#else
static inline void tMPI_Spinlock_init(tMPI_Spinlock_t *x)
{
+ __fence();
__clear_lock_mp((const int*)x,0);
+ __fence();
}
static inline void tMPI_Spinlock_lock(tMPI_Spinlock_t *x)
{
+ __fence();
do
{
- tMPI_Atomic_memory_barrier();
}
while(__check_lock_mp((int*)&(x->lock), 0, 1));
+ tMPI_Atomic_memory_barrier_acq();
}
static inline int tMPI_Spinlock_trylock(tMPI_Spinlock_t *x)
{
+ int ret;
/* Return 0 if we got the lock */
- return (__check_lock_mp((int*)&(x->lock), 0, 1) != 0);
+ __fence();
+ ret=__check_lock_mp((int*)&(x->lock), 0, 1) != 0;
+ tMPI_Atomic_memory_barrier_acq();
+ return ret;
}
static inline void tMPI_Spinlock_unlock(tMPI_Spinlock_t *x)
{
+ tMPI_Atomic_memory_barrier_rel();
__clear_lock_mp((int*)&(x->lock),0);
}
static inline int tMPI_Spinlock_islocked(const tMPI_Spinlock_t *x)
{
- tMPI_Atomic_memory_barrier();
- return ((x->lock) != 0);
+ int ret;
+ __fence();
+ ret=((x->lock) != 0);
+ tMPI_Atomic_memory_acq();
+ return ret;
}
{
do
{
- tMPI_Atomic_memory_barrier();
}
while(spin_islocked(x));
}
else
template_DATA = template.c README Makefile.@host@ Makefile.pkg
endif
-EXTRA_DIST = template.c template_doc.c README Template.mak Makefile.pkg
+EXTRA_DIST = template.c template_doc.c README Template.mak Makefile.pkg CMakeLists.txt.template
BUILT_SOURCES = gromacs
noinst_LTLIBRARIES = libthread_mpi.la
# again, we assume that we're using pthreads if we're using autotools.
-libthread_mpi_la_SOURCES = alltoall.c lock.c reduce_fast.c \
- barrier.c scatter.c bcast.c \
- once.c settings.h collective.c \
- p2p.h collective.h \
+libthread_mpi_la_SOURCES = alltoall.c impl.h pthreads.h \
+ barrier.c list.c reduce.c \
+ bcast.c lock.c reduce_fast.c \
+ collective.c once.c scatter.c \
+ collective.h p2p.h settings.h \
comm.c p2p_protocol.c tmpi_init.c \
errhandler.c p2p_send_recv.c tmpi_ops.h \
event.c p2p_wait.c topology.c \
gather.c profile.c type.c \
- group.c profile.h hwinfo.c \
- pthreads.c impl.h pthreads.h \
- list.c reduce.c
+ group.c profile.h winthreads.c \
+ hwinfo.c pthreads.c winthreads.h
+
CLEANFILES = *.la *~ \\\#*
return rc;
}
+#else
+
+/* just to have some symbols */
+int tMPI_Thread_pthreads=0;
#endif /* THREAD_PTHREADS */
+
return ret;
}
+#else
+
+/* just to have some symbols */
+int tMPI_Thread_winthreads=0;
+
#endif /* THREAD_WINDOWS */
+
int i;
printf("\nWriting histogram to %s\n", filename);
- sprintf(label_x, "[\\Delta]H (%s)", unit_energy);
+ sprintf(label_x, "\\DeltaH (%s)", unit_energy);
fp=xvgropen_type(filename, title, label_x, label_y, exvggtXNY, oenv);
lambda_t *lc;
int j;
- if (begin<=0 && end<0)
+ if (begin<=0 && end<0)
{
return;
}
}
/* calculate the actual times */
- if (begin > 0)
+ if (begin > 0 )
{
- begin_t = (last_t - first_t)*begin + first_t;
+ begin_t = begin;
}
else
{
if (end >0 )
{
- end_t = (last_t - first_t)*end + first_t;
+ end_t = end;
}
else
{
end_t = last_t;
}
printf("\n Samples in time interval: %.3f - %.3f\n", first_t, last_t);
+
+ if (begin_t > end_t)
+ {
+ return;
+ }
printf("Removing samples outside of: %.3f - %.3f\n", begin_t, end_t);
/* then impose them */
/* Read lambda from the legend */
ba->lambda[i] = legend2lambda(fn,legend[i], &is_dhdl);
- if (is_dhdl && native_lambda_read)
+ if (is_dhdl && !native_lambda_read)
{
ba->native_lambda = ba->lambda[i];
native_lambda_read=TRUE;