Merge "added support for graphs not starting at 0" into release-4-6
authorDavid van der Spoel <davidvanderspoel@gmail.com>
Sun, 29 Apr 2012 07:06:19 +0000 (09:06 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 29 Apr 2012 07:06:19 +0000 (09:06 +0200)
CMakeLists.txt
src/config.h.cmakein
src/gmxlib/genversion.sh
src/gmxlib/sighandler.c
src/mdlib/fft5d.c
src/mdlib/minimize.c
src/mdlib/pme.c

index b4af587c314fe96b63f0be9fbc8c67d1cb9ee54b..e5ebf9a10d9c334dbc4fea1fcd1a4991f2d9aca4 100644 (file)
@@ -75,7 +75,7 @@ endif()
 # Fix stupid flags on Windows
 ########################################################################
 SET(SHARED_LIBS_DEFAULT ON) 
-IF( (CMAKE_GENERATOR MATCHES "Visual Studio" OR CMAKE_GENERATOR MATCHES "NMake") AND MSVC )
+IF( MSVC )
     STRING(REPLACE /MD /MT CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
     SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
     STRING(REPLACE /MD /MT CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
@@ -83,7 +83,7 @@ IF( (CMAKE_GENERATOR MATCHES "Visual Studio" OR CMAKE_GENERATOR MATCHES "NMake")
     SET(SHARED_LIBS_DEFAULT OFF)       
 ENDIF()
 
-IF(CMAKE_GENERATOR MATCHES "NMake" AND CMAKE_C_COMPILER_ID MATCHES "Intel")
+IF( WIN32 AND NOT CYGWIN AND CMAKE_C_COMPILER_ID MATCHES "Intel" )
     STRING(REPLACE /GZ /RTC1 CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
     SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
     STRING(REPLACE /GZ /RTC1 CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
@@ -551,7 +551,7 @@ elseif(${GMX_ACCELERATION} STREQUAL "SSE")
       set(GMX_IA32_ASM ON CACHE BOOL "Add SSE assembly files for i386" FORCE)
     endif (GMX_64_BIT)
 
-    if(CMAKE_GENERATOR MATCHES "Visual Studio" OR CMAKE_GENERATOR MATCHES NMake )
+    if( WIN32 AND NOT CYGWIN )
       option(GMX_ASM_USEASM_NASM "Use Nasm for assembly instead of compiler (necessary on windows)" ON)
     else()
       option(GMX_ASM_USEASM_NASM "Use Nasm for assembly instead of compiler (necessary on windows)" OFF)
index dc02217adb9e6ddc359de3d5c92a73f68f7a506f..a2af355c6db2d9ac0ec1b3a08089fb1fd6ad88e7 100644 (file)
 /* Define to 1 if you have the lstat() function. */
 #cmakedefine HAVE_LSTAT
 
+/* Define to 1 if you have the sigaction() function. */
+#cmakedefine HAVE_SIGACTION
+
 /* Define to 1 if you have the <string.h> header file. */
 #cmakedefine HAVE_STRING_H
 
index ec412b686d2cf437b8b60f2a6369a8c736a8be61..cf3e7bcd506d3201f3435d1cb5901cda8766c2e0 100755 (executable)
@@ -30,16 +30,21 @@ if which git >/dev/null && test -d $GITDIR ; then
     # If PKGVERSION ends in a date, replace it with the head commit.
     version=`echo $PKGVERSION | sed -e 's/-dev-[0-9]*$/-dev/'`-$date-$shorthash$dirtystr
     #version=$PKGVERSION-$date-$shorthash$dirtystr
-    # Find the name of the remote which has the git.gromacs.org:gromacs in its url.
+    # Find the names of remotes that come from the official git/gerrit repos.
     # If not found, just set baserev to "unknown".
-    gmxremote=`git --git-dir=$GITDIR config --get-regexp 'remote\..*\.url' 'git\.gromacs\.org[:|/]gromacs' | sed -e 's/remote\.\(.*\)\.url.*/\1/'`
-    if test "x$gmxremote" = "x" ; then
+    gmxremotes=`git --git-dir=$GITDIR config --get-regexp 'remote\..*\.url' '\.gromacs\.org[:/].*gromacs(\.git)?$' | sed -e 's/remote\.\(.*\)\.url.*/\1/'`
+    if test "x$gmxremotes" = "x" ; then
         baserev="unknown"
     else
-        # Find the most recent ancestral commit that appears in $gmxremote.
-        # Gets the hash and the number of local commits that are newer than
-        # the found commit.
-        baserev=`git --git-dir=$GITDIR rev-list HEAD | git --git-dir=$GITDIR name-rev --stdin --refs=refs/remotes/$gmxremote/* | awk 'NF > 1 {print $1 " (" NR-1 " newer local commits)"; exit 0}'`
+        # Construct a command that produces a reverse-time-ordered list of
+        # commits and their annotated names in $gmxremotes.
+        revcommand="git --git-dir=$GITDIR rev-list HEAD"
+        for remote in $gmxremotes ; do
+            revcommand="$revcommand | git --git-dir=$GITDIR name-rev --stdin --refs='refs/remotes/$remote/*'"
+        done
+        # Get the hash of the first commit that is found in $gmxremotes and
+        # the number of local commits that are newer than the found commit.
+        baserev=`eval $revcommand | awk 'NF > 1 {print $1 " (" NR-1 " newer local commits)"; exit 0}'`
         # Extract the base hash
         basehash=`expr "$baserev" : '\([0123456789abcdef]*\) '`
         # Do not report the base revision if it is the same as the most recent commit
index 71115b7478dfd6eaf2b6d7a692e904b9b959abae..7c9496a78c5e9b485d00467260fd222f5dfae203 100644 (file)
@@ -102,8 +102,8 @@ static void gmx_signal(int signum)
 #ifdef HAVE_SIGACTION
     struct sigaction act;
     act.sa_handler = signal_handler;
-    act.flags = SA_RESTART;
-    sigaction(signum,act);
+    act.sa_flags = SA_RESTART;
+    sigaction(signum,&act,NULL);
 #else
     signal(signum,signal_handler);
 #endif
index f070e6de3ccee67737edfd2efe3c8c992a7f5fdb..7f99a6598b9de8e5febb59ffdd1f5eba80076774 100644 (file)
@@ -882,7 +882,7 @@ void fft5d_execute(fft5d_plan plan,int thread,fft5d_time times) {
         for (s=0;s<2;s++) {  /*loop over first two FFT steps (corner rotations)*/
 
 #ifdef GMX_MPI
-        if (GMX_PARALLEL_ENV_INITIALIZED && cart[s] !=0 && P[s]>1 )
+        if (GMX_PARALLEL_ENV_INITIALIZED && cart[s]!=MPI_COMM_NULL && P[s]>1)
         {
             bParallelDim = 1;
         }
index c4ff969ccb2a6b774a9f222297886c2b84b068b5..6261b5b61c08d7d6c5c41750869f3a827530dbe4 100644 (file)
@@ -653,16 +653,6 @@ static void evaluate_energy(FILE *fplog,gmx_bool bVerbose,t_commrec *cr,
   clear_mat(shake_vir);
   clear_mat(pres);
 
-  /* Calculate long range corrections to pressure and energy */
-  calc_dispcorr(fplog,inputrec,fr,count,top_global->natoms,ems->s.box,ems->s.lambda,
-                pres,force_vir,&prescorr,&enercorr,&dvdlcorr);
-  /* don't think these next 4 lines  can be moved in for now, because we 
-     don't always want to write it -- figure out how to clean this up MRS 8/4/2009 */
-  enerd->term[F_DISPCORR] = enercorr;
-  enerd->term[F_EPOT] += enercorr;
-  enerd->term[F_PRES] += prescorr;
-  enerd->term[F_DVDL] += dvdlcorr;
-
     /* Communicate stuff when parallel */
     if (PAR(cr) && inputrec->eI != eiNM)
     {
@@ -679,6 +669,14 @@ static void evaluate_energy(FILE *fplog,gmx_bool bVerbose,t_commrec *cr,
         wallcycle_stop(wcycle,ewcMoveE);
     }
 
+    /* Calculate long range corrections to pressure and energy */
+    calc_dispcorr(fplog,inputrec,fr,count,top_global->natoms,ems->s.box,ems->s.lambda,
+                  pres,force_vir,&prescorr,&enercorr,&dvdlcorr);
+    enerd->term[F_DISPCORR] = enercorr;
+    enerd->term[F_EPOT] += enercorr;
+    enerd->term[F_PRES] += prescorr;
+    enerd->term[F_DVDL] += dvdlcorr;
+
   ems->epot = enerd->term[F_EPOT];
   
   if (constr) {
index 91753f25377a1e0967d7ea6917b417158f99143e..02cea6e459f911ca99b665b8aa37c8ecb374e9ce 100644 (file)
@@ -1780,7 +1780,6 @@ static void realloc_work(pme_work_t *work,int nkx)
         srenew(work->mhy  ,work->nalloc);
         srenew(work->mhz  ,work->nalloc);
         srenew(work->m2   ,work->nalloc);
-        srenew(work->denom,work->nalloc);
         /* Allocate an aligned pointer for SSE operations, including 3 extra
          * elements at the end since SSE operates on 4 elements at a time.
          */
@@ -2148,10 +2147,10 @@ for(ithx=0; (ithx<order); ithx++)              \
 }
 
 
-void gather_f_bsplines(gmx_pme_t pme,real *grid,
-                       gmx_bool bClearF,pme_atomcomm_t *atc,
-                       splinedata_t *spline,
-                       real scale)
+static void gather_f_bsplines(gmx_pme_t pme,real *grid,
+                              gmx_bool bClearF,pme_atomcomm_t *atc,
+                              splinedata_t *spline,
+                              real scale)
 {
     /* sum forces for local particles */
     int     nn,n,ithx,ithy,ithz,i0,j0,k0;
@@ -2194,7 +2193,7 @@ void gather_f_bsplines(gmx_pme_t pme,real *grid,
     for(nn=0; nn<spline->n; nn++)
     {
         n  = spline->ind[nn];
-        qn = atc->q[n];
+        qn = scale*atc->q[n];
 
         if (bClearF)
         {
@@ -2945,12 +2944,20 @@ int gmx_pme_init(gmx_pme_t *         pmedata,
     pme->nnodes_minor        = nnodes_minor;
 
 #ifdef GMX_MPI
-    if (PAR(cr))
+    if (nnodes_major*nnodes_minor > 1)
     {
-        pme->mpi_comm        = cr->mpi_comm_mygroup;
+        pme->mpi_comm = cr->mpi_comm_mygroup;
 
         MPI_Comm_rank(pme->mpi_comm,&pme->nodeid);
         MPI_Comm_size(pme->mpi_comm,&pme->nnodes);
+        if (pme->nnodes != nnodes_major*nnodes_minor)
+        {
+            gmx_incons("PME node count mismatch");
+        }
+    }
+    else
+    {
+        pme->mpi_comm = MPI_COMM_NULL;
     }
 #endif
 
@@ -3749,7 +3756,7 @@ static void spread_on_grid(gmx_pme_t pme,
         pmegrid_t *grid;
 
         /* make local bsplines  */
-        if (grids->nthread == 1)
+        if (grids == NULL || grids->nthread == 1)
         {
             spline = &atc->spline[0];
 
@@ -3795,7 +3802,7 @@ static void spread_on_grid(gmx_pme_t pme,
     cs2 += (double)c2;
 #endif
 
-    if (grids->nthread > 1)
+    if (bSpread && grids->nthread > 1)
     {
 #ifdef PME_TIME_THREADS
         c3 = omp_cyc_start();
@@ -3895,6 +3902,11 @@ void gmx_pme_calc_energy(gmx_pme_t pme,int n,rvec *x,real *q,real *V)
     }
 
     atc = &pme->atc_energy;
+    atc->nthread   = 1;
+    if (atc->spline == NULL)
+    {
+        snew(atc->spline,atc->nthread);
+    }
     atc->nslab     = 1;
     atc->bSpread   = TRUE;
     atc->pme_order = pme->pme_order;