Fix warnings for no-mpi build
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 13 Apr 2020 05:23:00 +0000 (07:23 +0200)
committerPaul Bauer <paul.bauer.q@gmail.com>
Thu, 23 Apr 2020 07:20:32 +0000 (09:20 +0200)
This build configuration gave warnings when combined with
clang-7 in the docs build.

Change-Id: Ic874769bcd627710798633be742dbbe80d78b791

src/gromacs/ewald/pme_only.cpp
src/gromacs/fft/fft5d.cpp
src/gromacs/gmxlib/network.cpp
src/gromacs/mdrunutility/multisim.cpp

index 4e66664ae22663f3c2afa15cd2bfaae033dc1a7b..658b7f45343f5662a78c2d30bfa531d18662c3c2 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,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019,2020, 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.
@@ -584,7 +584,7 @@ static void gmx_pme_send_force_vir_ener(const gmx_pme_t& pme,
     /* Wait for the forces to arrive */
     MPI_Waitall(messages, pme_pp->req.data(), pme_pp->stat.data());
 #else
-    gmx_call("MPI not enabled");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_pme_send_force_vir_ener");
     GMX_UNUSED_VALUE(pme);
     GMX_UNUSED_VALUE(pme_pp);
     GMX_UNUSED_VALUE(output);
index 430c1b9abd2a75d7a13498586f32938805c58760..29618ee086aadf4bd269dec351bdc0542fa9f892 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2009-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, 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.
@@ -54,6 +54,7 @@
 #include "gromacs/utility/alignedallocator.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/smalloc.h"
 
@@ -123,7 +124,7 @@ static int lfactor(int z)
 double MPI_Wtime()
 {
     struct timeval tv;
-    gettimeofday(&tv, 0);
+    gettimeofday(&tv, nullptr);
     return tv.tv_sec + tv.tv_usec * 1e-6;
 }
 #    else
@@ -1277,7 +1278,7 @@ void fft5d_execute(fft5d_plan plan, int thread, fft5d_time times)
                                  GMX_MPI_REAL, cart[s]);
                 }
 #    else
-                gmx_incons("fft5d MPI call without MPI configuration");
+                GMX_RELEASE_ASSERT(false, "Invalid call to fft5d_execute");
 #    endif /*GMX_MPI*/
 #endif     /*FFT5D_MPI_TRANSPOSE*/
 #ifdef NOGMX
index b0b9e0d986adf9c629c6d6c37b22068dfdad359e..6d09557dcf4464a0c89c5b4f1b5247fdd944e645 100644 (file)
@@ -52,6 +52,7 @@
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/mpiinplacebuffers.h"
 #include "gromacs/utility/real.h"
@@ -241,7 +242,7 @@ void gmx_setup_nodecomm(FILE gmx_unused* fplog, t_commrec* cr)
 void gmx_barrier(const t_commrec gmx_unused* cr)
 {
 #if !GMX_MPI
-    gmx_call("gmx_barrier");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_barrier");
 #else
     MPI_Barrier(cr->mpi_comm_mygroup);
 #endif
@@ -250,7 +251,7 @@ void gmx_barrier(const t_commrec gmx_unused* cr)
 void gmx_bcast(int gmx_unused nbytes, void gmx_unused* b, const t_commrec gmx_unused* cr)
 {
 #if !GMX_MPI
-    gmx_call("gmx_bast");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_bcast");
 #else
     MPI_Bcast(b, nbytes, MPI_BYTE, MASTERRANK(cr), cr->mpi_comm_mygroup);
 #endif
@@ -268,7 +269,7 @@ void gmx_bcast_sim(int gmx_unused nbytes, void gmx_unused* b, const t_commrec gm
 void gmx_sumd(int gmx_unused nr, double gmx_unused r[], const t_commrec gmx_unused* cr)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumd");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumd");
 #else
 #    if MPI_IN_PLACE_EXISTS
     if (cr->nc.bUse)
@@ -326,7 +327,7 @@ void gmx_sumd(int gmx_unused nr, double gmx_unused r[], const t_commrec gmx_unus
 void gmx_sumf(int gmx_unused nr, float gmx_unused r[], const t_commrec gmx_unused* cr)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumf");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumf");
 #else
 #    if MPI_IN_PLACE_EXISTS
     if (cr->nc.bUse)
@@ -384,7 +385,7 @@ void gmx_sumf(int gmx_unused nr, float gmx_unused r[], const t_commrec gmx_unuse
 void gmx_sumi(int gmx_unused nr, int gmx_unused r[], const t_commrec gmx_unused* cr)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumi");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumi");
 #else
 #    if MPI_IN_PLACE_EXISTS
     if (cr->nc.bUse)
@@ -442,7 +443,7 @@ void gmx_sumi(int gmx_unused nr, int gmx_unused r[], const t_commrec gmx_unused*
 void gmx_sumli(int gmx_unused nr, int64_t gmx_unused r[], const t_commrec gmx_unused* cr)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumli");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumli");
 #else
 #    if MPI_IN_PLACE_EXISTS
     if (cr->nc.bUse)
index b1a3eb2a49a6f1abf1032dc1b2b96c025341954d..290a1003a3f77a6e6abc570afd7d37f7514c823d 100644 (file)
@@ -196,7 +196,7 @@ static void gmx_sumf_comm(int nr, float r[], MPI_Comm mpi_comm)
 void gmx_sumd_sim(int gmx_unused nr, double gmx_unused r[], const gmx_multisim_t gmx_unused* ms)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumd_sim");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumd_sim");
 #else
     gmx_sumd_comm(nr, r, ms->mpi_comm_masters);
 #endif
@@ -205,7 +205,7 @@ void gmx_sumd_sim(int gmx_unused nr, double gmx_unused r[], const gmx_multisim_t
 void gmx_sumf_sim(int gmx_unused nr, float gmx_unused r[], const gmx_multisim_t gmx_unused* ms)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumf_sim");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumf_sim");
 #else
     gmx_sumf_comm(nr, r, ms->mpi_comm_masters);
 #endif
@@ -214,7 +214,7 @@ void gmx_sumf_sim(int gmx_unused nr, float gmx_unused r[], const gmx_multisim_t
 void gmx_sumi_sim(int gmx_unused nr, int gmx_unused r[], const gmx_multisim_t gmx_unused* ms)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumi_sim");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumi_sim");
 #else
 #    if MPI_IN_PLACE_EXISTS
     MPI_Allreduce(MPI_IN_PLACE, r, nr, MPI_INT, MPI_SUM, ms->mpi_comm_masters);
@@ -239,7 +239,7 @@ void gmx_sumi_sim(int gmx_unused nr, int gmx_unused r[], const gmx_multisim_t gm
 void gmx_sumli_sim(int gmx_unused nr, int64_t gmx_unused r[], const gmx_multisim_t gmx_unused* ms)
 {
 #if !GMX_MPI
-    gmx_call("gmx_sumli_sim");
+    GMX_RELEASE_ASSERT(false, "Invalid call to gmx_sumli_sim");
 #else
 #    if MPI_IN_PLACE_EXISTS
     MPI_Allreduce(MPI_IN_PLACE, r, nr, MPI_INT64_T, MPI_SUM, ms->mpi_comm_masters);
@@ -264,7 +264,8 @@ void gmx_sumli_sim(int gmx_unused nr, int64_t gmx_unused r[], const gmx_multisim
 std::vector<int> gatherIntFromMultiSimulation(const gmx_multisim_t* ms, const int localValue)
 {
     std::vector<int> valuesFromAllRanks;
-    if (GMX_MPI && ms != nullptr)
+#if GMX_MPI
+    if (ms != nullptr)
     {
         valuesFromAllRanks.resize(ms->nsim);
         valuesFromAllRanks[ms->sim] = localValue;
@@ -274,6 +275,10 @@ std::vector<int> gatherIntFromMultiSimulation(const gmx_multisim_t* ms, const in
     {
         valuesFromAllRanks.emplace_back(localValue);
     }
+#else
+    GMX_UNUSED_VALUE(ms);
+    valuesFromAllRanks.emplace_back(localValue);
+#endif
     return valuesFromAllRanks;
 }