Convert more config.h defines to 0/1
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 10 Jan 2016 07:43:06 +0000 (09:43 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 11 Jan 2016 20:58:44 +0000 (21:58 +0100)
Also, fix one incorrect use of GMX_GPU.

Change-Id: I2409dada6c05e00163de3783781a6e85acadbdda

33 files changed:
src/config.h.cmakein
src/gromacs/ewald/pme-load-balancing.cpp
src/gromacs/fft/fft5d.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/gmxana/gmx_pme_error.cpp
src/gromacs/gmxana/gmx_sans.cpp
src/gromacs/gmxana/gmx_wham.cpp
src/gromacs/gmxana/nsfactor.cpp
src/gromacs/gmxlib/network.cpp
src/gromacs/hardware/detecthardware.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/gmx_omp_nthreads.cpp
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel_utils.cuh
src/gromacs/mdlib/nbnxn_grid.cpp
src/gromacs/mdlib/nbnxn_search.cpp
src/gromacs/mdlib/sim_util.cpp
src/gromacs/mdrunutility/threadaffinity.cpp
src/gromacs/utility/basenetwork.cpp
src/gromacs/utility/binaryinformation.cpp
src/gromacs/utility/fatalerror.cpp
src/gromacs/utility/gmxmpi.h
src/gromacs/utility/gmxomp.cpp
src/gromacs/utility/init.cpp
src/gromacs/utility/qsort_threadsafe.h
src/programs/mdrun/md.cpp
src/programs/mdrun/mdrun.cpp
src/programs/mdrun/resource-division.cpp
src/programs/mdrun/runner.cpp
src/programs/mdrun/tests/moduletest.cpp
src/programs/mdrun/tests/multisim.cpp
src/programs/mdrun/tests/replicaexchange.cpp
src/testutils/mpi-printer.cpp

index 142af5ef680d135019fc858a30b9fd29ed531754..f078c4d74adf2e9cc32712b937271ad26574ce92 100644 (file)
 #cmakedefine01 HAVE_EXTRAE
 
 /* Use MPI (with mpicc) for parallelization */
-#cmakedefine GMX_LIB_MPI
+#cmakedefine01 GMX_LIB_MPI
 
 /* Use threads_mpi for parallelization */
-#cmakedefine GMX_THREAD_MPI
+#cmakedefine01 GMX_THREAD_MPI
 
-#if defined GMX_LIB_MPI || defined GMX_THREAD_MPI
+#if GMX_LIB_MPI || GMX_THREAD_MPI
 /* Make a parallel version of GROMACS using message passing
    (MPI or thread_mpi) */
 #define GMX_MPI
 #cmakedefine01 MPI_IN_PLACE_EXISTS
 
 /* Use OpenMP multithreading */
-#cmakedefine GMX_OPENMP
+#cmakedefine01 GMX_OPENMP
 
 /* Can and should use nice(3) to set priority */
 #cmakedefine01 GMX_USE_NICE
 #cmakedefine GMX_CUDA_VERSION @GMX_CUDA_VERSION@
 
 /* Use a single compilation unit when compiling the CUDA (non-bonded) kernels.  */
-#cmakedefine GMX_CUDA_NB_SINGLE_COMPILATION_UNIT
+#cmakedefine01 GMX_CUDA_NB_SINGLE_COMPILATION_UNIT
 
 /* Use NVML */
 #cmakedefine01 HAVE_NVML
index e47a048c1d6ef77d442982d04cc715a1becf1b83..7bad8e244ec3a04b0233d766efa3961bb13c86b4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -788,7 +788,7 @@ pme_load_balance(pme_load_balancing_t      *pme_lb,
      * texture objects are used), but as this is initialization code, there
      * is not point in complicating things.
      */
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     if (PAR(cr) && use_GPU(nbv))
     {
         gmx_barrier(cr);
index 01bdffea43ba5efbcb79f91d5ab6ef3da1215d71..c89959d8ac882f31dc671320971dc22e72ae1698 100644 (file)
@@ -62,7 +62,7 @@
 #endif
 #endif
 
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
 /* TODO: Do we still need this? Are we still planning ot use fftw + OpenMP? */
 #define FFT5D_THREADS
 /* requires fftw compiled with openmp */
index cd7a259b987f01604057f4c761821d880e9f208b..86d5ee2d9105b224f4e0bfba1481b8eaf88c77ff 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -84,12 +84,6 @@ const char *hxtypenames[NRHXTYPES] =
 
 static const int NOTSET = -49297;
 
-#ifdef GMX_OPENMP
-#define MASTER_THREAD_ONLY(threadNr) ((threadNr) == 0)
-#else
-#define MASTER_THREAD_ONLY(threadNr) ((threadNr) == (threadNr))
-#endif
-
 /* -----------------------------------------*/
 
 enum {
@@ -1927,7 +1921,7 @@ static void do_hbac(const char *fn, t_hbdata *hb,
         "Cc\\scontact,hb\\v{}\\z{}(t)",
         "-dAc\\sfs\\v{}\\z{}/dt"
     };
-    gmx_bool       bNorm = FALSE, bOMP = FALSE;
+    gmx_bool       bNorm = FALSE;
     double         nhb   = 0;
     real          *rhbex = NULL, *ht, *gt, *ght, *dght, *kt;
     real          *ct, tail, tail2, dtail, *cct;
@@ -1943,11 +1937,7 @@ static void do_hbac(const char *fn, t_hbdata *hb,
         AC_NONE, AC_NN, AC_GEM, AC_LUZAR
     };
 
-#ifdef GMX_OPENMP
-    bOMP = TRUE;
-#else
-    bOMP = FALSE;
-#endif
+    const bool bOMP = GMX_OPENMP;
 
     printf("Doing autocorrelation ");
 
@@ -2482,7 +2472,7 @@ int gmx_hbond(int argc, char *argv[])
           "Theoretical maximum number of hydrogen bonds used for normalizing HB autocorrelation function. Can be useful in case the program estimates it wrongly" },
         { "-merge", FALSE, etBOOL, {&bMerge},
           "H-bonds between the same donor and acceptor, but with different hydrogen are treated as a single H-bond. Mainly important for the ACF." },
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
         { "-nthreads", FALSE, etINT, {&nThreads},
           "Number of threads used for the parallel loop over autocorrelations. nThreads <= 0 means maximum number of threads. Requires linking with OpenMP. The number of threads is limited by the number of cores (before OpenMP v.3 ) or environment variable OMP_THREAD_LIMIT (OpenMP v.3)"},
 #endif
@@ -2545,16 +2535,12 @@ int gmx_hbond(int argc, char *argv[])
     int                   ii, hh, actual_nThreads;
     int                   threadNr = 0;
     gmx_bool              bParallel;
-    gmx_bool              bEdge_yjj, bEdge_xjj, bOMP;
+    gmx_bool              bEdge_yjj, bEdge_xjj;
 
     t_hbdata            **p_hb    = NULL;                   /* one per thread, then merge after the frame loop */
     int                 **p_adist = NULL, **p_rdist = NULL; /* a histogram for each thread. */
 
-#ifdef GMX_OPENMP
-    bOMP = TRUE;
-#else
-    bOMP = FALSE;
-#endif
+    const bool            bOMP = GMX_OPENMP;
 
     npargs = asize(pa);
     ppa    = add_acf_pargs(&npargs, pa);
@@ -2790,7 +2776,7 @@ int gmx_hbond(int argc, char *argv[])
     snew(adist, nabin+1);
     snew(rdist, nrbin+1);
 
-#ifndef GMX_OPENMP
+#if !GMX_OPENMP
 #define __ADIST adist
 #define __RDIST rdist
 #define __HBDATA hb
@@ -2865,8 +2851,10 @@ int gmx_hbond(int argc, char *argv[])
     k, bTric, \
     bEdge_xjj, bEdge_yjj) \
     default(shared)
-    {    /* Start of parallel region */
+    {                           /* Start of parallel region */
+#if !defined __clang_analyzer__ // clang complains about unused value.
         threadNr = gmx_omp_get_thread_num();
+#endif
 
         do
         {
index bb0eda1b0502f79e23238419cb15c8a2c795fa5e..4a9a4bff8440dceafbd666044b56185daa8ea45c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -505,13 +505,8 @@ static real estimate_reciprocal(
         stoplocal  = stopglobal;
         x_per_core = xtot;
     }
-/*
-   #ifdef GMX_LIB_MPI
-    MPI_Barrier(MPI_COMM_WORLD);
-   #endif
- */
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 #ifdef TAKETIME
     if (MASTER(cr))
     {
@@ -753,7 +748,7 @@ static real estimate_reciprocal(
         fprintf(stderr, "\n");
     }
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 #ifdef TAKETIME
     if (MASTER(cr))
     {
index 2d3bb3408cde68d7c791fb1af03cedb014b0a579..b5df5e4e34b8d449c78a4ed7786673c4b83f1958 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -113,7 +113,7 @@ int gmx_sans(int argc, char *argv[])
           "Stepping in q (1/nm)"},
         { "-seed",     FALSE, etINT,  {&seed},
           "Random seed for Monte-Carlo"},
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
         { "-nt",  FALSE, etINT, {&nthreads},
           "Number of threads to start"},
 #endif
index 35c8ab922b8012e70e93b3f7607915d923713e25..d501ba19f7c5f80c3dfe9feda6e85d39563d65af 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -3393,7 +3393,7 @@ int gmx_wham(int argc, char *argv[])
     static int               nthreads = -1;
 
     t_pargs                  pa[] = {
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
         { "-nt", FALSE, etINT, {&nthreads},
           "Number of threads used by gmx wham (if -1, all threads will be used or what is specified by the environment variable OMP_NUM_THREADS)"},
 #endif
index d1fbcd197bc14886ed907ae524d297cf95a90afe..150012845dcbcdddd1d3b8292c5d6d530763c018 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -204,7 +204,7 @@ gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram (
     rvec              dist;
     double            rmax;
     int               i, j;
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     double          **tgr;
     int               tid;
     int               nthreads;
@@ -243,7 +243,7 @@ gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram (
             mc_max = static_cast<gmx_int64_t>(std::floor(0.5*mcover*isize*(isize-1)));
         }
         rng = gmx_rng_init(seed);
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
         nthreads = gmx_omp_get_max_threads();
         snew(tgr, nthreads);
         snew(trng, nthreads);
@@ -302,7 +302,7 @@ gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram (
     }
     else
     {
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
         nthreads = gmx_omp_get_max_threads();
         /* Allocating memory for tgr arrays */
         snew(tgr, nthreads);
index 485bfe8154dad330868cdda3db2b517423b3e50f..03bd0c1ead94cab4ae39dba90140274ef34954b2 100644 (file)
@@ -82,7 +82,7 @@ t_commrec *init_commrec()
 
     snew(cr, 1);
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     gmx_fill_commrec_from_mpi(cr);
 #else
     cr->mpi_comm_mysim   = NULL;
@@ -113,7 +113,7 @@ t_commrec *init_commrec()
 
 t_commrec *reinitialize_commrec_for_this_thread(const t_commrec gmx_unused *cro)
 {
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     t_commrec *cr;
 
     /* make a thread-specific commrec */
@@ -152,7 +152,7 @@ void gmx_setup_nodecomm(FILE gmx_unused *fplog, t_commrec *cr)
     nc = &cr->nc;
 
     nc->bUse = FALSE;
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
 #ifdef GMX_MPI
     int n, rank;
 
@@ -228,7 +228,7 @@ void gmx_init_intranode_counters(t_commrec *cr)
     int nrank_intranode, rank_intranode;
     int nrank_pp_intranode, rank_pp_intranode;
     /* thread-MPI is not initialized when not running in parallel */
-#if defined GMX_MPI && !defined GMX_THREAD_MPI
+#if defined GMX_MPI && !GMX_THREAD_MPI
     int nrank_world, rank_world;
     int i, myhash, *hash, *hash_s, *hash_pp, *hash_pp_s;
 
index 2297acfe8bb6c78791279f4918b812195833c61d..6411d5d38dfdcd886ff77e3abfd320c7149f23e5 100644 (file)
@@ -98,12 +98,7 @@ static const bool bGpuSharingSupported = gpuSharingSupport[GMX_GPU];
  * one real MPI rank on the same node (it segfaults when you try).
  */
 static const bool multiGpuSupport[] = {
-    false, true,
-#ifdef GMX_THREAD_MPI
-    true,
-#else
-    false, /* Real MPI and no MPI */
-#endif
+    false, true, GMX_THREAD_MPI
 };
 static const bool bMultiGpuPerNodeSupported = multiGpuSupport[GMX_GPU];
 
@@ -175,7 +170,7 @@ static void print_gpu_detection_stats(FILE                 *fplog,
 
     ngpu = gpu_info->n_dev;
 
-#if defined GMX_MPI && !defined GMX_THREAD_MPI
+#if defined GMX_MPI && !GMX_THREAD_MPI
     /* We only print the detection on one, of possibly multiple, nodes */
     std::strncpy(onhost, " on host ", 10);
     gmx_gethostname(onhost + 9, HOSTNAMELEN);
@@ -348,11 +343,11 @@ void gmx_check_hw_runconf_consistency(FILE                *fplog,
         return;
     }
 
-#if defined(GMX_THREAD_MPI)
+#if GMX_THREAD_MPI
     bMPI          = FALSE;
     btMPI         = TRUE;
     bNthreadsAuto = (hw_opt->nthreads_tmpi < 1);
-#elif defined(GMX_LIB_MPI)
+#elif GMX_LIB_MPI
     bMPI          = TRUE;
     btMPI         = FALSE;
     bNthreadsAuto = FALSE;
@@ -687,7 +682,7 @@ static int get_nthreads_hw_avail(FILE gmx_unused *fplog, const t_commrec gmx_unu
         fprintf(debug, "Detected %d hardware threads to use.\n", ret);
     }
 
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     if (ret != gmx_omp_get_num_procs())
     {
         md_print_warn(cr, fplog,
@@ -702,7 +697,7 @@ static int get_nthreads_hw_avail(FILE gmx_unused *fplog, const t_commrec gmx_unu
 
 static void gmx_detect_gpus(FILE *fplog, const t_commrec *cr)
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     int              rank_world;
     MPI_Comm         physicalnode_comm;
 #endif
@@ -716,7 +711,7 @@ static void gmx_detect_gpus(FILE *fplog, const t_commrec *cr)
      * TODO: We should also do CPU hardware detection only once on each
      * physical node and broadcast it, instead of do it on every MPI rank.
      */
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     /* A split of MPI_COMM_WORLD over physical nodes is only required here,
      * so we create and destroy it locally.
      */
@@ -752,7 +747,7 @@ static void gmx_detect_gpus(FILE *fplog, const t_commrec *cr)
         }
     }
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     /* Broadcast the GPU info to the other ranks within this node */
     MPI_Bcast(&hwinfo_g->gpu_info.n_dev, 1, MPI_INT, 0, physicalnode_comm);
 
@@ -779,7 +774,7 @@ static void gmx_detect_gpus(FILE *fplog, const t_commrec *cr)
 
 static void gmx_collect_hardware_mpi(const gmx::CpuInfo &cpuInfo)
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     int  rank_id;
     int  nrank, rank, ncore, nhwthread, ngpu, i;
     int  gpu_hash;
@@ -1037,7 +1032,7 @@ static std::string detected_hardware_string(const gmx_hw_info_t *hwinfo,
         }
     }
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     char host[HOSTNAMELEN];
     int  rank;
 
index cc5a1505fe29a2186d4557e1ab19ff0387c9c559..6d3b0c873c02f18bb4f51892f5256c7d03a45e1e 100644 (file)
@@ -2218,7 +2218,7 @@ static void init_nb_verlet(FILE                *fp,
          * texture objects are used), but as this is initialization code, there
          * is no point in complicating things.
          */
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
         if (PAR(cr))
         {
             gmx_barrier(cr);
@@ -3259,7 +3259,7 @@ void free_gpu_resources(const t_forcerec     *fr,
          * Note: as only PP ranks need to free GPU resources, so it is safe to
          * not call the barrier on PME ranks.
          */
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
         if (PAR(cr))
         {
             gmx_barrier(cr);
index f403e6d8e0d4474280056ce66e6b769ce63a80b0..6a4e411ce23b8ea62f94496d003154a405861f61 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -112,16 +112,11 @@ static void pick_module_nthreads(FILE *fplog, int m,
                                  gmx_bool bFullOmpSupport,
                                  gmx_bool bSepPME)
 {
-    char    *env;
-    int      nth;
-    char     sbuf[STRLEN];
-    gmx_bool bOMP;
+    char      *env;
+    int        nth;
+    char       sbuf[STRLEN];
 
-#ifdef GMX_OPENMP
-    bOMP = TRUE;
-#else
-    bOMP = FALSE;
-#endif /* GMX_OPENMP */
+    const bool bOMP = GMX_OPENMP;
 
     /* The default should never be set through a GMX_*_NUM_THREADS env var
      * as it's always equal with gnth. */
@@ -242,7 +237,7 @@ void gmx_omp_nthreads_read_env(int     *nthreads_omp,
     do about it. */
 static void manage_number_of_openmp_threads(FILE               *fplog,
                                             const t_commrec    *cr,
-                                            gmx_bool            bOMP,
+                                            bool                bOMP,
                                             int                 nthreads_hw_avail,
                                             int                 omp_nthreads_req,
                                             int                 omp_nthreads_pme_req,
@@ -254,7 +249,7 @@ static void manage_number_of_openmp_threads(FILE               *fplog,
     int      nth;
     char    *env;
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     /* modth is shared among tMPI threads, so for thread safety, the
      * detection is done on the master only. It is not thread-safe
      * with multiple simulations, but that's anyway not supported by
@@ -370,7 +365,7 @@ static void manage_number_of_openmp_threads(FILE               *fplog,
     /* set the number of threads globally */
     if (bOMP)
     {
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
         if (bThisNodePMEOnly)
         {
             gmx_omp_set_num_threads(modth.gnth_pme);
@@ -400,7 +395,7 @@ reportOpenmpSettings(FILE            *fplog,
                      gmx_bool         bFullOmpSupport,
                      gmx_bool         bSepPME)
 {
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     const char *mpi_str = "per tMPI thread";
 #else
     const char *mpi_str = "per MPI process";
@@ -500,7 +495,7 @@ issueOversubscriptionWarning(FILE            *fplog,
 #ifdef GMX_MPI
         if (modth.gnth == 1)
         {
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
             sprintf(sbuf, "thread-MPI threads");
 #else
             sprintf(sbuf, "MPI processes");
@@ -523,14 +518,10 @@ void gmx_omp_nthreads_init(FILE *fplog, t_commrec *cr,
                            gmx_bool bThisNodePMEOnly,
                            gmx_bool bFullOmpSupport)
 {
-    int      nppn;
-    gmx_bool bSepPME, bOMP;
+    int        nppn;
+    gmx_bool   bSepPME;
 
-#ifdef GMX_OPENMP
-    bOMP = TRUE;
-#else
-    bOMP = FALSE;
-#endif /* GMX_OPENMP */
+    const bool bOMP = GMX_OPENMP;
 
     /* number of MPI processes/threads per physical node */
     nppn = cr->nrank_intranode;
@@ -543,7 +534,7 @@ void gmx_omp_nthreads_init(FILE *fplog, t_commrec *cr,
                                     omp_nthreads_req, omp_nthreads_pme_req,
                                     bThisNodePMEOnly, bFullOmpSupport,
                                     nppn, bSepPME);
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     /* Non-master threads have to wait for the OpenMP management to be
      * done, so that code elsewhere that uses OpenMP can be certain
      * the setup is complete. */
index fcb50eb83403fd98133d2403aba288336308487d..770578034ec00541c8557f93b4a35f7c088e368c 100644 (file)
@@ -100,7 +100,7 @@ texture<float, 1, cudaReadModeElementType> coulomb_tab_texref;
 #undef FUNCTION_DECLARATION_ONLY
 
 /* Now generate the function definitions if we are using a single compilation unit. */
-#ifdef GMX_CUDA_NB_SINGLE_COMPILATION_UNIT
+#if GMX_CUDA_NB_SINGLE_COMPILATION_UNIT
 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel_F_noprune.cu"
 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel_F_prune.cu"
 #include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel_VF_noprune.cu"
index 6cb2a51852b9efac919c28db13b71cba06107ab8..d61f47dbafe08c4d3d136f589013d385cb91dc95 100644 (file)
@@ -73,7 +73,7 @@
 
 /* With multiple compilation units this ensures that texture refs are available
    in the the kernels' compilation units. */
-#ifndef GMX_CUDA_NB_SINGLE_COMPILATION_UNIT
+#if !GMX_CUDA_NB_SINGLE_COMPILATION_UNIT
 /*! Texture reference for LJ C6/C12 parameters; bound to cu_nbparam_t.nbfp */
 extern texture<float, 1, cudaReadModeElementType> nbfp_texref;
 
index 92c56573b1dd68e87bb0a699f4be0e67b28d71e1..bfee2d81d5e11710d3ebdc55cd0bdeb6ecb08218 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -1616,7 +1616,7 @@ void nbnxn_grid_add_simple(nbnxn_search_t    nbs,
     bbcz = grid->bbcz_simple;
     bb   = grid->bb_simple;
 
-#if (defined GMX_OPENMP) && !(defined __clang_analyzer__)
+#if GMX_OPENMP && !(defined __clang_analyzer__)
     // cppcheck-suppress unreadVariable
     int nthreads = gmx_omp_nthreads_get(emntPairsearch);
 #endif
index 145b6618dda9c332f5d0e0f274da8b2b5701e8d3..714ed501a0fc376e61ef2164cdc9b33497a015ea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -2779,7 +2779,7 @@ static void combine_nblists(int nnbl, nbnxn_pairlist_t **nbl,
     /* Each thread should copy its own data to the combined arrays,
      * as otherwise data will go back and forth between different caches.
      */
-#if (defined GMX_OPENMP) && !(defined __clang_analyzer__)
+#if GMX_OPENMP && !(defined __clang_analyzer__)
     // cppcheck-suppress unreadVariable
     int nthreads = gmx_omp_nthreads_get(emntPairsearch);
 #endif
index 909ca199b3ae07ee19414bf2be4fc113e9410631..e21e1588ab2d56ef88d45767695219bc7a96c0bc 100644 (file)
@@ -122,7 +122,7 @@ void print_time(FILE                     *out,
     double dt, elapsed_seconds, time_per_step;
     char   buf[48];
 
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
     if (!PAR(cr))
 #endif
     {
@@ -157,7 +157,7 @@ void print_time(FILE                     *out,
                     ir->delta_t/1000*24*60*60/time_per_step);
         }
     }
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
     if (PAR(cr))
     {
         fprintf(out, "\n");
index 6d13ab57310e71b8b0e3340aacab7c35c9f5f7e3..1437c165e1c92c368d3407eb148d9432a7c80b04 100644 (file)
@@ -368,7 +368,7 @@ gmx_set_thread_affinity(FILE                *fplog,
             if (cr->nnodes > 1)
             {
 #ifdef GMX_MPI
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
                 sprintf(sbuf1, "In tMPI thread #%d: ", cr->nodeid);
 #else           /* GMX_LIB_MPI */
                 sprintf(sbuf1, "In MPI process #%d: ", cr->nodeid);
@@ -433,7 +433,7 @@ gmx_check_thread_affinity_set(FILE            *fplog,
         {
             return;
         }
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
         return;
 #endif
     }
@@ -480,7 +480,7 @@ gmx_check_thread_affinity_set(FILE            *fplog,
         bAllSet = bAllSet && (CPU_ISSET(i, &mask_current) != 0);
     }
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     gmx_bool  bAllSet_All;
 
     MPI_Allreduce(&bAllSet, &bAllSet_All, 1, MPI_INT, MPI_LAND, MPI_COMM_WORLD);
index 7e79a548bde39b0596b7303a2850a65143832d27..061c37b763a3d0f71c9a2ba69c58a6ded50267c9 100644 (file)
@@ -66,7 +66,7 @@ int gmx_node_num()
 #ifndef GMX_MPI
     return 1;
 #else
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     if (!gmx_mpi_initialized())
     {
         return 1;
@@ -83,7 +83,7 @@ int gmx_node_rank()
 #ifndef GMX_MPI
     return 0;
 #else
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     if (!gmx_mpi_initialized())
     {
         return 0;
@@ -95,7 +95,7 @@ int gmx_node_rank()
 #endif
 }
 
-#if defined GMX_LIB_MPI && GMX_TARGET_BGQ
+#if GMX_LIB_MPI && GMX_TARGET_BGQ
 #ifdef __clang__
 /* IBM's declaration of this function in
  * /bgsys/drivers/V1R2M2/ppc64/spi/include/kernel/process.h
@@ -163,7 +163,7 @@ static int mpi_hostname_hash()
 
 #if GMX_TARGET_BGQ
     hash_int = bgq_nodenum();
-#elif defined GMX_LIB_MPI
+#elif GMX_LIB_MPI
     int  resultlen;
     char mpi_hostname[MPI_MAX_PROCESSOR_NAME];
 
@@ -224,7 +224,7 @@ void gmx_broadcast_world(int size, void *buffer)
 #endif
 }
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 void gmx_abort(int errorno)
 {
     MPI_Abort(MPI_COMM_WORLD, errorno);
index 4e4b6ebe0bdaac29f24f0f892423605c3456b00e..96147861b827a3f7068adb192759d2e905372ba8 100644 (file)
@@ -230,14 +230,14 @@ void gmx_print_version_info(FILE *fp)
 #endif
     fprintf(fp, "Memory model:       %u bit\n", (unsigned)(8*sizeof(void *)));
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     fprintf(fp, "MPI library:        thread_mpi\n");
 #elif defined(GMX_MPI)
     fprintf(fp, "MPI library:        MPI\n");
 #else
     fprintf(fp, "MPI library:        none\n");
 #endif
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     fprintf(fp, "OpenMP support:     enabled (GMX_OPENMP_MAX_THREADS = %d)\n", GMX_OPENMP_MAX_THREADS);
 #else
     fprintf(fp, "OpenMP support:     disabled\n");
index 75c2f6b5b6ca602a553dbcadebec032fce682924..9f612fdc243158d3f16996f6e38f56ebf67e1bf2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -227,7 +227,7 @@ void gmx_exit_on_fatal_error(ExitType exitType, int returnValue)
                 MPI_Finalize();
                 break;
             case ExitType_Abort:
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
                 gmx_abort(returnValue);
 #endif
                 break;
index dc94d9680151ef5600d8de90472062a7c74ee3e7..e093b3692a2fcd674a30610f257cfe4a80913aaa 100644 (file)
@@ -52,7 +52,7 @@
 #include "config.h"
 
 /*! \cond */
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 /* MPI C++ binding is deprecated and can cause name conflicts (e.g. stdio/mpi seek) */
 #define MPICH_SKIP_MPICXX 1
 #define OMPI_SKIP_MPICXX 1
@@ -74,7 +74,7 @@
 #endif
 #endif /*MPI_INT64_T*/
 #else
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
 #include "thread_mpi/mpi_bindings.h" /* IWYU pragma: export */
 #include "thread_mpi/tmpi.h"         /* IWYU pragma: export */
 #else
index eb9607d01ed09399457ee01d90e4a1e33a487daa..a1f92b3fc5e1d19d1bb23e47b6a4d9d8c7d0ef74 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -47,7 +47,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
 #include <omp.h>
 #endif
 
@@ -60,7 +60,7 @@
 
 int gmx_omp_get_max_threads(void)
 {
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     return omp_get_max_threads();
 #else
     return 1;
@@ -69,7 +69,7 @@ int gmx_omp_get_max_threads(void)
 
 int gmx_omp_get_num_procs(void)
 {
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     return omp_get_num_procs();
 #else
     return 1;
@@ -78,7 +78,7 @@ int gmx_omp_get_num_procs(void)
 
 int gmx_omp_get_thread_num(void)
 {
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     return omp_get_thread_num();
 #else
     return 0;
@@ -87,7 +87,7 @@ int gmx_omp_get_thread_num(void)
 
 void gmx_omp_set_num_threads(int num_threads)
 {
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     omp_set_num_threads(num_threads);
 #else
     GMX_UNUSED_VALUE(num_threads);
@@ -99,7 +99,7 @@ gmx_bool gmx_omp_check_thread_affinity(char **message)
     bool shouldSetAffinity = true;
 
     *message = NULL;
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     /* We assume that the affinity setting is available on all platforms
      * gcc supports. Even if this is not the case (e.g. Mac OS) the user
      * will only get a warning. */
index c8d3f0f4963e135a8e92424879a874933405c4a2..795e37110d0e982958027e03dce33b71870a2f27 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -48,7 +48,7 @@
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxassert.h"
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 #include "gromacs/utility/gmxmpi.h"
 #endif
 
@@ -57,7 +57,7 @@ namespace gmx
 
 namespace
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 //! Maintains global counter of attempts to initialize MPI
 int g_initializationCounter = 0;
 #endif
@@ -65,7 +65,7 @@ int g_initializationCounter = 0;
 
 void init(int *argc, char ***argv)
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     int isInitialized = 0, isFinalized = 0;
     MPI_Finalized(&isFinalized);
     GMX_RELEASE_ASSERT(!isFinalized, "Invalid attempt to initialize MPI after finalization");
@@ -84,7 +84,7 @@ void init(int *argc, char ***argv)
 #ifdef GMX_FAHCORE
         fah_MPI_Init(argc, argv);
 #else
-#    ifdef GMX_OPENMP
+#    if GMX_OPENMP
         /* Formally we need to use MPI_Init_thread and ask for MPI_THREAD_FUNNELED
          * level of thread support when using OpenMP. However, in practice we
          * have never seen any problems with just using MPI_Init(), and some MPI
@@ -127,7 +127,7 @@ void init(int *argc, char ***argv)
 
 void finalize()
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     GMX_RELEASE_ASSERT(0 < g_initializationCounter, "Excess attempt to finalize MPI");
     // Bump the counter to record this finalization event
     g_initializationCounter--;
index b842bb12c08d457b6ba2b5f7c1c997e1d2cff6f8..b2bd1f7ec682360ba2b255883c181f3690627296 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,2014,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -94,7 +94,7 @@ gmx_qsort(void            *base,
  * Expands to gmx_qsort() if Gromacs is built with threading, or system qsort()
  * otherwise.
  */
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
 #define gmx_qsort_threadsafe gmx_qsort
 #else
 #define gmx_qsort_threadsafe qsort
index 9e9baa869357c4aebea01c0e9d5e0dd00f4d2688..a9312ff7cf6730ac288fc6154b200242a3fc197f 100644 (file)
@@ -1254,7 +1254,7 @@ double gmx::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_THREAD_MPI
+#if GMX_THREAD_MPI
             && MASTER(cr)
 #endif
             )
index d98910c7fbf06ca53db3a2d3cb59fa1c17754dab..0eb49bf1b6dfc0b452493fa05992c85c66f85467 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -478,7 +478,7 @@ int gmx_mdrun(int argc, char *argv[])
 
     if (nmultisim >= 1)
     {
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
         gmx_bool bParFn = (multidir == NULL);
         init_multisystem(cr, nmultisim, multidir, NFILE, fnm, bParFn);
 #else
index 93acfa87f24b3a63c7bff88973fdccf6ff52393f..10498f7eca2dea63deda91e57d1417ed0b7cbee4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
  * and after a switch point doesn't change too much.
  */
 
-#ifdef GMX_OPENMP
-static const bool bHasOmpSupport = true;
-#else
-static const bool bHasOmpSupport = false;
-#endif
+static const bool bHasOmpSupport = GMX_OPENMP;
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
 /* The minimum number of atoms per tMPI thread. With fewer atoms than this,
  * the number of threads will get lowered.
  */
@@ -118,7 +114,7 @@ const int nthreads_omp_faster_gpu_fac   =  2;
  * we first try 6 OpenMP threads and then less until the number of MPI ranks
  * is divisible by the number of GPUs.
  */
-#if defined GMX_OPENMP && defined GMX_MPI
+#if GMX_OPENMP && defined GMX_MPI
 const int nthreads_omp_mpi_ok_max              =  8;
 const int nthreads_omp_mpi_ok_min_cpu          =  1;
 #endif
@@ -163,7 +159,7 @@ static int nthreads_omp_efficient_max(int gmx_unused       nrank,
                                       const gmx::CpuInfo  &cpuInfo,
                                       gmx_bool             bUseGPU)
 {
-#if defined GMX_OPENMP && defined GMX_MPI
+#if GMX_OPENMP && defined GMX_MPI
     if (nrank > 1)
     {
         return nthreads_omp_mpi_ok_max;
@@ -278,8 +274,7 @@ static int getMaxGpuUsable(FILE *fplog, const t_commrec *cr, const gmx_hw_info_t
 }
 
 
-#ifdef GMX_THREAD_MPI
-
+#if GMX_THREAD_MPI
 
 static bool
 gmxSmtIsEnabled(const gmx::HardwareTopology &hwTop)
@@ -469,10 +464,10 @@ void check_resource_division_efficiency(const gmx_hw_info_t *hwinfo,
                                         t_commrec           *cr,
                                         FILE                *fplog)
 {
-#if defined GMX_OPENMP && defined GMX_MPI
+#if GMX_OPENMP && defined GMX_MPI
     int         nth_omp_min, nth_omp_max, ngpu;
     char        buf[1000];
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     const char *mpi_option = " (option -ntmpi)";
 #else
     const char *mpi_option = "";
@@ -481,7 +476,7 @@ void check_resource_division_efficiency(const gmx_hw_info_t *hwinfo,
     /* This function should be called after thread-MPI (when configured) and
      * OpenMP have been initialized. Check that here.
      */
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     GMX_RELEASE_ASSERT(nthreads_omp_faster_default >= nthreads_omp_mpi_ok_max, "Inconsistent OpenMP thread count default values");
     GMX_RELEASE_ASSERT(hw_opt->nthreads_tmpi >= 1, "Must have at least one thread-MPI rank");
 #endif
@@ -599,7 +594,7 @@ void check_resource_division_efficiency(const gmx_hw_info_t *hwinfo,
     /* Check if we have more than 1 physical core, if detected,
      * or more than 1 hardware thread if physical cores were not detected.
      */
-#if !(defined GMX_OPENMP) && !(defined GMX_MPI)
+#if !GMX_OPENMP && !(defined GMX_MPI)
     if ((hwinfo->ncore > 1) ||
         (hwinfo->ncore == 0 && hwinfo->nthreads_hw_avail > 1))
     {
@@ -639,7 +634,7 @@ void check_and_update_hw_opt_1(gmx_hw_opt_t    *hw_opt,
     /* Check restrictions on the user supplied options before modifying them.
      * TODO: Put the user values in a const struct and preserve them.
      */
-#ifndef GMX_THREAD_MPI
+#if !GMX_THREAD_MPI
     if (hw_opt->nthreads_tot > 0)
     {
         gmx_fatal(FARGS, "Setting the total number of threads is only supported with thread-MPI and GROMACS was compiled without thread-MPI");
@@ -728,7 +723,7 @@ void check_and_update_hw_opt_1(gmx_hw_opt_t    *hw_opt,
      */
     gmx_parse_gpu_ids(&hw_opt->gpu_opt);
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     if (hw_opt->gpu_opt.n_dev_use > 0 && hw_opt->nthreads_tmpi == 0)
     {
         /* Set the number of MPI threads equal to the number of GPUs */
@@ -777,7 +772,7 @@ void check_and_update_hw_opt_2(gmx_hw_opt_t *hw_opt,
 /* Checks we can do when we know the thread-MPI rank count */
 void check_and_update_hw_opt_3(gmx_hw_opt_t gmx_unused *hw_opt)
 {
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     GMX_RELEASE_ASSERT(hw_opt->nthreads_tmpi >= 1, "Must have at least one thread-MPI rank");
 
     /* If the user set the total number of threads on the command line
index 63dc1ff3ede6bdf99a041d0f4f96d71711c10eec..cccd475a774c7ee8545f6f526d59252d45d8c106 100644 (file)
@@ -124,7 +124,7 @@ matrix              deform_init_box_tpx;
 //! MPI variable for use in pressure scaling
 tMPI_Thread_mutex_t deform_init_box_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
 /* The minimum number of atoms per tMPI thread. With fewer atoms than this,
  * the number of threads will get lowered.
  */
@@ -800,7 +800,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
     gmx_check_thread_affinity_set(fplog, cr,
                                   hw_opt, hwinfo->nthreads_hw_avail, FALSE);
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     if (SIMMASTER(cr))
     {
         if (npme > 0 && hw_opt->nthreads_tmpi <= 0)
@@ -886,7 +886,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
 #ifndef GMX_MPI
                   "but %s was compiled without threads or MPI enabled"
 #else
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
                   "but the number of threads (option -nt) is 1"
 #else
                   "but %s was not started through mpirun/mpiexec or only one rank was requested through mpirun/mpiexec"
@@ -1065,7 +1065,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
     }
     md_print_info(cr, fplog, "Using %d MPI %s\n",
                   cr->nnodes,
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
                   cr->nnodes == 1 ? "thread" : "threads"
 #else
                   cr->nnodes == 1 ? "process" : "processes"
@@ -1380,7 +1380,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
 
     done_ed(&ed);
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     /* we need to join all threads. The sub-threads join when they
        exit this function, but the master thread needs to be told to
        wait for that. */
index 56dfa17725a922c24a5e71dd294755fd45718a60..4a21ee3ed19b5ec2359f71cbbf88fb55bd746877 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -73,11 +73,11 @@ namespace test
 namespace
 {
 
-#if defined(GMX_THREAD_MPI) || defined(DOXYGEN)
+#if GMX_THREAD_MPI || defined(DOXYGEN)
 //! Number of tMPI threads for child mdrun call.
 int g_numThreads = 1;
 #endif
-#if defined(GMX_OPENMP) || defined(DOXYGEN)
+#if GMX_OPENMP || defined(DOXYGEN)
 //! Number of OpenMP threads for child mdrun call.
 int g_numOpenMPThreads = 1;
 #endif
@@ -85,11 +85,11 @@ int g_numOpenMPThreads = 1;
 GMX_TEST_OPTIONS(MdrunTestOptions, options)
 {
     GMX_UNUSED_VALUE(options);
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     options->addOption(IntegerOption("nt").store(&g_numThreads)
                            .description("Number of thread-MPI threads/ranks for child mdrun calls"));
 #endif
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     options->addOption(IntegerOption("nt_omp").store(&g_numOpenMPThreads)
                            .description("Number of OpenMP threads for child mdrun calls"));
 #endif
@@ -111,7 +111,7 @@ SimulationRunner::SimulationRunner(IntegrationTestFixture *fixture) :
     edrFileName_(fixture_->fileManager_.getTemporaryFilePath(".edr")),
     nsteps_(-2)
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     GMX_RELEASE_ASSERT(gmx_mpi_initialized(), "MPI system not initialized for mdrun tests");
 #endif
 }
@@ -179,7 +179,7 @@ int
 SimulationRunner::callGrompp()
 {
     int returnValue = 0;
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     // When compiled with external MPI, we're trying to run mdrun with
     // MPI, but we need to make sure that we only do grompp on one
     // rank
@@ -188,7 +188,7 @@ SimulationRunner::callGrompp()
     {
         returnValue = callGromppOnThisRank();
     }
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     // Make sure rank zero has written the .tpr file before other
     // ranks try to read it. Thread-MPI and serial do this just fine
     // on their own.
@@ -222,7 +222,7 @@ SimulationRunner::callMdrun(const CommandLine &callerRef)
 
 #ifdef GMX_MPI
 #  if GMX_GPU != GMX_GPU_NONE
-#    ifdef GMX_THREAD_MPI
+#    if GMX_THREAD_MPI
     int         numGpusNeeded = g_numThreads;
 #    else   /* Must be real MPI */
     int         numGpusNeeded = gmx_node_num();
@@ -232,25 +232,25 @@ SimulationRunner::callMdrun(const CommandLine &callerRef)
 #  endif
 #endif
 
-#ifdef GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     caller.addOption("-ntmpi", g_numThreads);
 #endif
 
-#ifdef GMX_OPENMP
+#if GMX_OPENMP
     caller.addOption("-ntomp", g_numOpenMPThreads);
 #endif
 
-#if defined GMX_GPU
+#if GMX_GPU != GMX_GPU_NONE
     /* TODO Ideally, with real MPI, we could call
      * gmx_collect_hardware_mpi() here and find out how many nodes
      * mdrun will run on. For now, we assume that we're running on one
      * node regardless of the number of ranks, because that's true in
      * Jenkins and for most developers running the tests. */
     int numberOfNodes = 1;
-#if defined GMX_THREAD_MPI
+#if GMX_THREAD_MPI
     /* Can't use gmx_node_num() because it is only valid after spawn of thread-MPI threads */
     int numberOfRanks = g_numThreads;
-#elif defined GMX_LIB_MPI
+#elif GMX_LIB_MPI
     int numberOfRanks = gmx_node_num();
 #else
     int numberOfRanks = 1;
@@ -279,7 +279,7 @@ SimulationRunner::callMdrun()
 
 MdrunTestFixtureBase::MdrunTestFixtureBase()
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     GMX_RELEASE_ASSERT(gmx_mpi_initialized(), "MPI system not initialized for mdrun tests");
 #endif
 }
index 7d0811121001b2c3428c567c5fe708e92a49c5ab..835f1fa075835d3d34c728188901934827a84713 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -91,7 +91,7 @@ TEST_P(MultiSimTest, ExitsNormally)
 
 /* Note, not all preprocessor implementations nest macro expansions
    the same way / at all, if we would try to duplicate less code. */
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 INSTANTIATE_TEST_CASE_P(InNvt, MultiSimTest,
                             ::testing::Values("pcoupl = no"));
 #else
index 061c9a186db919960eba00e80226c07e54afe559..632637bde3253e83ce6d345dead7a34ac9755233 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -82,7 +82,7 @@ TEST_P(ReplicaExchangeTest, ExitsNormally)
 
 /* Note, not all preprocessor implementations nest macro expansions
    the same way / at all, if we would try to duplicate less code. */
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 INSTANTIATE_TEST_CASE_P(WithDifferentControlVariables, ReplicaExchangeTest,
                             ::testing::Values("pcoupl = no", "pcoupl = Berendsen"));
 #else
index b449182f980ee30cc4364770c8a2638156b46151..1d09b365b2073ecbbfe854d1989a04290ed72886 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -40,7 +40,7 @@
 
 #include "gromacs/utility/gmxmpi.h"
 
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
 
 #include <memory>
 #include <sstream>
@@ -184,7 +184,7 @@ void MPIEventForward::OnTestEnd(const ::testing::TestInfo &test_info)
 //! \cond internal
 void gmx::test::initMPIOutput()
 {
-#ifdef GMX_LIB_MPI
+#if GMX_LIB_MPI
     int size, rank;
 
     MPI_Comm_size(MPI_COMM_WORLD, &size);