#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016,2017, 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.
message(FATAL_ERROR "Using VSX SIMD in double precision with GCC requires GCC-4.9 or later.")
endif()
endif()
+ if(${CMAKE_CXX_COMPILER_ID} MATCHES "XL" OR ${CMAKE_C_COMPILER_ID} MATCHES "XL")
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.1.5" OR CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.5")
+ message(FATAL_ERROR "Using VSX SIMD requires XL compiler version 13.1.5 or later.")
+ endif()
+ endif()
endmacro()
# Issue a fatal error with an appropriate message, when the toolchain
SIMD_${GMX_SIMD}_C_FLAGS SIMD_${GMX_SIMD}_CXX_FLAGS
"-mvsx" "-maltivec -mabi=altivec" "-qarch=auto -qaltivec")
- if(NOT SIMD_${GMX_SIMD}_C_FLAGS OR NOT SIMD_${GMX_SIMD}_CXX_FLAGS)
+ # Usually we check also for the C compiler here, but a C compiler
+ # is not required for SIMD support on this platform. cmake through
+ # at least version 3.7 cannot pass this check with the C compiler
+ # in the latest xlc 13.1.5, but the C++ compiler has different
+ # behaviour and is OK. See Redmine #2102.
+ if(NOT SIMD_${GMX_SIMD}_CXX_FLAGS)
gmx_give_fatal_error_when_simd_support_not_found("IBM VSX" "disable SIMD support (slower)" "${SUGGEST_BINUTILS_UPDATE}")
endif()
# rather than actual vector data. For now we disable __vectorcall with clang
# when using the reference build.
#
+# xlc 13.1.5 does not seem recognize any attribute, and warns about invalid ones
+# so we avoid searching for any.
+#
if(NOT DEFINED GMX_SIMD_CALLING_CONVENTION)
if(GMX_TARGET_BGQ)
set(CALLCONV_LIST " ")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND GMX_SIMD STREQUAL "REFERENCE")
set(CALLCONV_LIST __regcall " ")
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL")
+ set(CALLCONV_LIST " ")
else()
set(CALLCONV_LIST __vectorcall __regcall " ")
endif()
clang static analysis
^^^^^^^^^^^^^^^^^^^^^
-The exact build sequence and the CMake configuration used is in
-:file:`admin/builds/clang-analysis.py`. This file also specifies the clang
-version used for the analysis.
+The file :file:`admin/builds/clang-analyzer.py` specifies the exact build
+sequence and the CMake cache variables used for clang static analysis. This
+file also specifies the clang version used for the analysis, as well as the C++
+compiler used (``clang-static-analyzer-<version>``).
+
+To run the analysis outside Jenkins, you should run both ``cmake`` and ``make``
+under ``scan-build`` command using the same CMake cache variables as in the
+build script. When you do the initial CMake configuration with ``scan-build``,
+it sets the C++ compiler to the analyzer. Note that using ``scan-build`` like
+this will also analyze C code, but Jenkins ignores C code for analysis. This
+can result in extra warnings, which can be suppressed by manually setting
+CMAKE_C_COMPILER to a value other than Clang static analyzer.
cppcheck
^^^^^^^^
You should strive to use the most recent version of your
compiler. Since we require full C++11 support the minimum supported
compiler versions are
+
* GNU (gcc) 4.8.1
* Intel (icc) 15.0
* LLVM (clang) 3.3
* Microsoft (MSVC) 2015
+
Other compilers may work (Cray, Pathscale, older clang) but do
not offer competitive performance. We recommend against PGI because
the performance with C++ is very bad.
-----------------------------------
The current version works with GCN-based AMD GPUs, and NVIDIA CUDA
-GPUs. Make sure that you have the latest drivers installed. The
-minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|. See
+GPUs. Make sure that you have the latest drivers installed. For AMD GPUs,
+Mesa version 17.0 or newer with LLVM 4.0 or newer is supported in addition
+to the proprietary driver. For NVIDIA GPUs, using the proprietary driver is
+required as the open source nouveau driver (available in Mesa) does not
+provide the OpenCL support.
+The minimum OpenCL version required is |REQUIRED_OPENCL_MIN_VERSION|. See
also the :ref:`known limitations <opencl-known-limitations>`.
Devices from the AMD GCN architectures (all series) and NVIDIA Fermi
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016,2017, 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.
# Support for --enable-avx2 was only added in 3.3.5, but
# configuring with it is at worst a warning, even on an earlier
# version.
+if((CMAKE_COMPILER_IS_GNUCC AND (C_COMPILER_VERSION VERSION_GREATER 4.9 OR CXX_COMPILER_VERSION VERSION_GREATER 4.9)) OR
+ (CMAKE_C_COMPILER_ID MATCHES "Clang" AND (C_COMPILER_VERSION VERSION_GREATER 3.9 OR CXX_COMPILER_VERSION VERSION_GREATER 3.9)))
set(_fftw_simd_support_level --enable-sse2;--enable-avx;--enable-avx2;--enable-avx512)
+elseif()
+ set(_fftw_simd_support_level --enable-sse2;--enable-avx;--enable-avx2)
+endif()
elseif(${GMX_SIMD} MATCHES "^(VSX)")
set(_fftw_simd_support_level --enable-vsx)
endif()
}
fprintf(fp, "\n");
- /* now print percentages */
- fprintf(fp, "%-8s %5.2f", "# SS %", total_count / static_cast<real>(mat->nx * mat->ny));
+ /* now print probabilities */
+ fprintf(fp, "%-8s %5.2f", "# SS pr.", total_count / static_cast<real>(mat->nx * mat->ny));
for (s = 0; s < static_cast<size_t>(mat->nmap); s++)
{
fprintf(fp, " %5.2f", total[s] / static_cast<real>(mat->nx * mat->ny));
sprintf(buf, "%simum Distance", bMin ? "Min" : "Max");
respertime = xvgropen(rfile, buf, output_env_get_time_label(oenv), "Distance (nm)", oenv);
xvgr_legend(respertime, ng-1, (const char**)leg, oenv);
- if (bPrintResName)
+ if (bPrintResName && output_env_get_print_xvgr_codes(oenv) )
{
fprintf(respertime, "# ");
+
+ for (j = 0; j < nres; j++)
+ {
+ fprintf(respertime, "%s%d ", *(atoms->resinfo[atoms->atom[index[0][residue[j]]].resind].name), atoms->atom[index[0][residue[j]]].resind);
+ }
+ fprintf(respertime, "\n");
}
- for (j = 0; j < nres; j++)
- {
- fprintf(respertime, "%s%d ", *(atoms->resinfo[atoms->atom[index[0][residue[j]]].resind].name), atoms->atom[index[0][residue[j]]].resind);
- }
- fprintf(respertime, "\n");
}
svmul(scale, sum[index[i]], sum[index[i]]);
}
- fp = xvgropen(xname, title, "Atom", "", oenv);
+ fp = xvgropen(xname, title, "Atom", "Spatial component", oenv);
for (i = 0; i < isize; i++)
{
fprintf(fp, "%-5d %10.3f %10.3f %10.3f\n", 1+i,
" results if you in fact have a cluster. Luckily that can be checked",
" afterwards using a trajectory viewer. Note also that if your molecules",
" are broken this will not work either.",
- "",
- " The separate option [TT]-clustercenter[tt] can be used to specify an",
- " approximate center for the cluster. This is useful e.g. if you have",
- " two big vesicles, and you want to maintain their relative positions.",
" * [TT]whole[tt] only makes broken molecules whole.",
"",
* gmx_print_version_info() in the GMX_MPI section */
const char match_mpi[] = "MPI library: MPI";
const char match_mdrun[] = "Executable: ";
- const char match_gpu[] = "GPU support: enabled";
+ const char match_nogpu[] = "GPU support: disabled";
gmx_bool bMdrun = FALSE;
gmx_bool bMPI = FALSE;
- gmx_bool bHaveGpuSupport = FALSE;
+ gmx_bool bHaveGpuSupport = TRUE;
/* Run a small test to see whether mpirun + mdrun work */
fprintf(stdout, "Making sure that mdrun can be executed. ");
if (bThreads)
{
snew(command, std::strlen(cmd_mdrun) + std::strlen(cmd_np) + std::strlen(filename) + 50);
- sprintf(command, "%s%s-version -maxh 0.001 1> %s 2>&1", cmd_mdrun, cmd_np, filename);
+ sprintf(command, "%s%s -version -maxh 0.001 1> %s 2>&1", cmd_mdrun, cmd_np, filename);
}
else
{
{
bMPI = TRUE;
}
- if (str_starts(line, match_gpu) )
+ if (str_starts(line, match_nogpu) )
{
- bHaveGpuSupport = TRUE;
+ bHaveGpuSupport = FALSE;
}
}
}
if (expand->nstTij > 0)
{
sprintf(err_buf, "nstlog must be non-zero");
- CHECK(ir->nstlog != 0);
+ CHECK(ir->nstlog == 0);
sprintf(err_buf, "nst-transition-matrix (%d) must be an integer multiple of nstlog (%d)",
expand->nstTij, ir->nstlog);
CHECK((expand->nstTij % ir->nstlog) != 0);
}
/*! \brief
- * Removes solvent molecules that overlap with the solute, and optionally also
- * those that are outside a given shell radius from the solute.
+ * Remove all solvent molecules outside a give radius from the solute.
*
- * \param[in,out] atoms Solvent atoms.
- * \param[in,out] x Solvent positions.
- * \param[in,out] v Solvent velocities (can be empty).
- * \param[in,out] r Solvent exclusion radii.
- * \param[in] pbc PBC information.
- * \param[in] x_solute Solute positions.
- * \param[in] r_solute Solute exclusion radii.
- * \param[in] rshell If >0, only keep solvent atoms within a shell of
- * this size from the solute.
+ * \param[in,out] atoms Solvent atoms.
+ * \param[in,out] x_solvent Solvent positions.
+ * \param[in,out] v_solvent Solvent velocities.
+ * \param[in,out] r Atomic exclusion radii.
+ * \param[in] pbc PBC information.
+ * \param[in] x_solute Solute positions.
+ * \param[in] rshell The radius outside the solute molecule.
*/
-static void removeSoluteOverlap(t_atoms *atoms, std::vector<RVec> *x,
- std::vector<RVec> *v, std::vector<real> *r,
- const t_pbc &pbc,
- const std::vector<RVec> &x_solute,
- const std::vector<real> &r_solute,
- real rshell)
+static void removeSolventOutsideShell(t_atoms *atoms,
+ std::vector<RVec> *x_solvent,
+ std::vector<RVec> *v_solvent,
+ std::vector<real> *r,
+ const t_pbc &pbc,
+ const std::vector<RVec> &x_solute,
+ real rshell)
{
- const real maxRadius1
- = *std::max_element(r->begin(), r->end());
- const real maxRadius2
- = *std::max_element(r_solute.begin(), r_solute.end());
-
gmx::AtomsRemover remover(*atoms);
- // If rshell is >0, the neighborhood search looks at all pairs
- // within rshell, and unmarks those that are within the cutoff.
- // This line marks everything, so that solvent outside rshell remains
- // marked after the loop.
- // Without rshell, the neighborhood search only marks the overlapping
- // solvent atoms, and all others are left alone.
- if (rshell > 0.0)
+ gmx::AnalysisNeighborhood nb;
+ nb.setCutoff(rshell);
+ gmx::AnalysisNeighborhoodPositions posSolute(x_solute);
+ gmx::AnalysisNeighborhoodSearch search = nb.initSearch(&pbc, posSolute);
+ gmx::AnalysisNeighborhoodPositions pos(*x_solvent);
+ gmx::AnalysisNeighborhoodPairSearch pairSearch = search.startPairSearch(pos);
+ gmx::AnalysisNeighborhoodPair pair;
+
+ // Remove everything
+ remover.markAll();
+ // Now put back those within the shell without checking for overlap
+ while (pairSearch.findNextPair(&pair))
{
- remover.markAll();
+ remover.markResidue(*atoms, pair.testIndex(), false);
+ pairSearch.skipRemainingPairsForTestPosition();
}
+ remover.removeMarkedElements(x_solvent);
+ if (!v_solvent->empty())
+ {
+ remover.removeMarkedElements(v_solvent);
+ }
+ remover.removeMarkedElements(r);
+ const int originalAtomCount = atoms->nr;
+ remover.removeMarkedAtoms(atoms);
+ fprintf(stderr, "Removed %d solvent atoms more than %f nm from solute.\n",
+ originalAtomCount - atoms->nr, rshell);
+}
+
+/*! \brief
+ * Removes solvent molecules that overlap with the solute.
+ *
+ * \param[in,out] atoms Solvent atoms.
+ * \param[in,out] x Solvent positions.
+ * \param[in,out] v Solvent velocities (can be empty).
+ * \param[in,out] r Solvent exclusion radii.
+ * \param[in] pbc PBC information.
+ * \param[in] x_solute Solute positions.
+ * \param[in] r_solute Solute exclusion radii.
+ */
+static void removeSolventOverlappingWithSolute(t_atoms *atoms,
+ std::vector<RVec> *x,
+ std::vector<RVec> *v,
+ std::vector<real> *r,
+ const t_pbc &pbc,
+ const std::vector<RVec> &x_solute,
+ const std::vector<real> &r_solute)
+{
+ gmx::AtomsRemover remover(*atoms);
+ const real maxRadius1
+ = *std::max_element(r->begin(), r->end());
+ const real maxRadius2
+ = *std::max_element(r_solute.begin(), r_solute.end());
+ // Now check for overlap.
gmx::AnalysisNeighborhood nb;
- nb.setCutoff(std::max(maxRadius1 + maxRadius2, rshell));
+ gmx::AnalysisNeighborhoodPair pair;
+ nb.setCutoff(maxRadius1 + maxRadius2);
gmx::AnalysisNeighborhoodPositions posSolute(x_solute);
gmx::AnalysisNeighborhoodSearch search = nb.initSearch(&pbc, posSolute);
gmx::AnalysisNeighborhoodPositions pos(*x);
gmx::AnalysisNeighborhoodPairSearch pairSearch = search.startPairSearch(pos);
- gmx::AnalysisNeighborhoodPair pair;
while (pairSearch.findNextPair(&pair))
{
if (remover.isMarked(pair.testIndex()))
}
if (top->atoms.nr > 0)
{
- removeSoluteOverlap(atoms_solvt, &x_solvt, &v_solvt, &exclusionDistances_solvt, pbc,
- *x, exclusionDistances, rshell);
+ if (rshell > 0.0)
+ {
+ removeSolventOutsideShell(atoms_solvt, &x_solvt, &v_solvt,
+ &exclusionDistances_solvt, pbc, *x, rshell);
+ }
+ removeSolventOverlappingWithSolute(atoms_solvt, &x_solvt, &v_solvt,
+ &exclusionDistances_solvt, pbc, *x,
+ exclusionDistances);
}
if (max_sol > 0 && atoms_solvt->nres > max_sol)
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <OutputFiles Name="Files">
+ <File Name="-o">
+ <GroFile Name="Header">
+ <String Name="Title">Generated by gmx solvate</String>
+ <Int Name="Number of atoms">141</Int>
+ </GroFile>
+ </File>
+ </OutputFiles>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <OutputFiles Name="Files">
+ <File Name="-o">
+ <GroFile Name="Header">
+ <String Name="Title">Test system for solvate/insert-molecules</String>
+ <Int Name="Number of atoms">2664</Int>
+ </GroFile>
+ </File>
+ </OutputFiles>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <OutputFiles Name="Files">
+ <File Name="-o">
+ <GroFile Name="Header">
+ <String Name="Title">Test system for solvate/insert-molecules</String>
+ <Int Name="Number of atoms">2664</Int>
+ </GroFile>
+ </File>
+ </OutputFiles>
+</ReferenceData>
--- /dev/null
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+ <OutputFiles Name="Files">
+ <File Name="-o">
+ <GroFile Name="Header">
+ <String Name="Title">Test system for solvate/insert-molecules</String>
+ <Int Name="Number of atoms">762</Int>
+ </GroFile>
+ </File>
+ </OutputFiles>
+</ReferenceData>
/*
* 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,2017, 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.
#include "gromacs/gmxpreprocess/solvate.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/textreader.h"
#include "testutils/cmdlinetest.h"
+#include "testutils/conftest.h"
+#include "testutils/refdata.h"
#include "testutils/testfilemanager.h"
#include "testutils/textblockmatchers.h"
{
using gmx::test::CommandLine;
-using gmx::test::NoTextMatch;
+using gmx::test::ConfMatch;
class SolvateTest : public gmx::test::CommandLineTestBase
{
public:
SolvateTest()
{
- setOutputFile("-o", "out.gro", NoTextMatch());
+ setOutputFile("-o", "out.gro", ConfMatch());
}
void runTest(const CommandLine &args)
cmdline.merge(args);
ASSERT_EQ(0, gmx_solvate(cmdline.argc(), cmdline.argv()));
+ checkOutputFiles();
}
};
runTest(CommandLine(cmdline));
}
+TEST_F(SolvateTest, shell_Works)
+{
+ // use default solvent box (-cs without argument)
+ const char *const cmdline[] = {
+ "solvate", "-cs"
+ };
+ setInputFile("-cp", "spc-and-methanol.gro");
+ commandLine().addOption("-shell", 1.0);
+
+ runTest(CommandLine(cmdline));
+}
+
} // namespace
pbc_dx_aiuc(pbc, xi, xj, dr);
T rsq = dr[XX]*dr[XX] + dr[YY]*dr[YY] + dr[ZZ]*dr[ZZ];
- T rinv = invsqrt(rsq);
+ T rinv = gmx::invsqrt(rsq);
T rinv2 = rinv*rinv;
T rinv6 = rinv2*rinv2*rinv2;
elapsed_time_over_all_ranks,
elapsed_time_over_all_threads,
elapsed_time_over_all_threads_over_all_ranks;
+ /* Control whether it is valid to print a report. Only the
+ simulation master may print, but it should not do so if the run
+ terminated e.g. before a scheduled reset step. This is
+ complicated by the fact that PME ranks are unaware of the
+ reason why they were sent a pmerecvqxFINISH. To avoid
+ communication deadlocks, we always do the communication for the
+ report, even if we've decided not to write the report, because
+ how long it takes to finish the run is not important when we've
+ decided not to report on the simulation performance. */
+ bool printReport = SIMMASTER(cr);
if (!walltime_accounting_get_valid_finish(walltime_accounting))
{
GMX_LOG(mdlog.warning).asParagraph().appendText("Simulation ended prematurely, no performance report will be written.");
- return;
+ printReport = false;
}
if (cr->nnodes > 1)
}
#endif
- if (SIMMASTER(cr))
+ if (printReport)
{
print_flop(fplog, nrnb_tot, &nbfs, &mflop);
}
wallcycle_scale_by_num_threads(wcycle, cr->duty == DUTY_PME, nthreads_pp, nthreads_pme);
auto cycle_sum(wallcycle_sum(cr, wcycle));
- if (SIMMASTER(cr))
+ if (printReport)
{
struct gmx_wallclock_gpu_t* gputimes = use_GPU(nbv) ? nbnxn_gpu_get_timings(nbv->gpu_nbv) : nullptr;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017, 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.
simdPrefetch(const void * m)
{
#if defined(__ibmxl__) || defined(__xlC__)
- __dcbt(m);
+ __dcbt((void *)m);
#elif defined __GNUC__
__builtin_prefetch(m);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017, 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.
static inline Simd4Float gmx_simdcall
load4U(const float *m)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- return {
- vec_xlw4(0, const_cast<float *>(m))
- }
-#else
return {
*reinterpret_cast<const __vector float *>(m)
};
-#endif
}
static inline void gmx_simdcall
store4U(float *m, Simd4Float a)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- vec_xstw4(a.simdInternal_, 0, m);
-#else
*reinterpret_cast<__vector float *>(m) = a.simdInternal_;
-#endif
}
static inline Simd4Float gmx_simdcall
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017, 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.
__vector vsxBool int simdInternal_;
};
-// The VSX load & store operations are a bit of a mess. The interface is different
-// for xlc version 12, xlc version 13, and gcc. Long-term IBM recommends
-// simply using pointer dereferencing both for aligned and unaligned loads.
-// That's nice, but unfortunately xlc still bugs out when the pointer is
-// not aligned. Sticking to vec_xl/vec_xst isn't a solution either, since
-// that appears to be buggy for some _aligned_ loads :-)
-//
-// For now, we use pointer dereferencing for all aligned load/stores, and
-// for unaligned ones with gcc. On xlc we use vec_xlw4/vec_xstw4 for
-// unaligned memory operations. The latest docs recommend using the overloaded
-// vec_xl/vec_xst, but that is not supported on xlc version 12. We'll
-// revisit things once xlc is a bit more stable - for now you probably want
-// to stick to gcc...
+// Note that the interfaces we use here have been a mess in xlc;
+// currently version 13.1.5 is required.
static inline SimdDouble gmx_simdcall
simdLoad(const double *m)
static inline SimdDouble gmx_simdcall
simdLoadU(const double *m)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- return {
- vec_xlw4(0, const_cast<double *>(m))
- }
-#else
return {
*reinterpret_cast<const __vector double *>(m)
};
-#endif
}
static inline void gmx_simdcall
storeU(double *m, SimdDouble a)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- vec_xstw4(a.simdInternal_, 0, m);
-#else
*reinterpret_cast<__vector double *>(m) = a.simdInternal_;
-#endif
}
static inline SimdDouble gmx_simdcall
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017, 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.
__vector vsxBool int simdInternal_;
};
-// The VSX load & store operations are a bit of a mess. The interface is different
-// for xlc version 12, xlc version 13, and gcc. Long-term IBM recommends
-// simply using pointer dereferencing both for aligned and unaligned loads.
-// That's nice, but unfortunately xlc still bugs out when the pointer is
-// not aligned. Sticking to vec_xl/vec_xst isn't a solution either, since
-// that appears to be buggy for some _aligned_ loads :-)
-//
-// For now, we use pointer dereferencing for all aligned load/stores, and
-// for unaligned ones with gcc. On xlc we use vec_xlw4/vec_xstw4 for
-// unaligned memory operations. The latest docs recommend using the overloaded
-// vec_xl/vec_xst, but that is not supported on xlc version 12. We'll
-// revisit things once xlc is a bit more stable - for now you probably want
-// to stick to gcc...
+// Note that the interfaces we use here have been a mess in xlc;
+// currently version 13.1.5 is required.
static inline SimdFloat gmx_simdcall
simdLoad(const float *m)
static inline SimdFloat gmx_simdcall
simdLoadU(const float *m)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- return {
- vec_xlw4(0, const_cast<float *>(m))
- }
-#else
return {
*reinterpret_cast<const __vector float *>(m)
};
-#endif
}
static inline void gmx_simdcall
storeU(float *m, SimdFloat a)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- vec_xstw4(a.simdInternal_, 0, m);
-#else
*reinterpret_cast<__vector float *>(m) = a.simdInternal_;
-#endif
}
static inline SimdFloat gmx_simdcall
static inline SimdFInt32 gmx_simdcall
simdLoadUFI(const std::int32_t *m)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- return {
- vec_xlw4(0, const_cast<int *>(m))
- }
-#else
return {
*reinterpret_cast<const __vector int *>(m)
};
-#endif
}
static inline void gmx_simdcall
storeU(std::int32_t * m, SimdFInt32 a)
{
-#if defined(__ibmxl__) || defined(__xlC__)
- vec_xstw4(a.simdInternal_, 0, m);
-#else
*reinterpret_cast<__vector int *>(m) = a.simdInternal_;
-#endif
}
static inline SimdFInt32 gmx_simdcall
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017, 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.
SimdFloat * v2,
SimdFloat * v3)
{
- *v0 = simdLoad( base + align * offset[0] );
- *v1 = simdLoad( base + align * offset[1] );
- *v2 = simdLoad( base + align * offset[2] );
- *v3 = simdLoad( base + align * offset[3] );
-
- __vector float t0 = vec_mergeh(v0->simdInternal_, v2->simdInternal_);
- __vector float t1 = vec_mergel(v0->simdInternal_, v2->simdInternal_);
- __vector float t2 = vec_mergeh(v1->simdInternal_, v3->simdInternal_);
- __vector float t3 = vec_mergel(v1->simdInternal_, v3->simdInternal_);
+ __vector float l0, l1, l2, l3;
+
+ l0 = simdLoad( base + align * offset[0] ).simdInternal_;
+ l1 = simdLoad( base + align * offset[1] ).simdInternal_;
+ l2 = simdLoad( base + align * offset[2] ).simdInternal_;
+ l3 = simdLoad( base + align * offset[3] ).simdInternal_;
+
+ __vector float t0 = vec_mergeh(l0, l2);
+ __vector float t1 = vec_mergel(l0, l2);
+ __vector float t2 = vec_mergeh(l1, l3);
+ __vector float t3 = vec_mergel(l1, l3);
v0->simdInternal_ = vec_mergeh(t0, t2);
v1->simdInternal_ = vec_mergel(t0, t2);
v2->simdInternal_ = vec_mergeh(t1, t3);
triplets2->simdInternal_ = vec_perm(scalar.simdInternal_, t1, perm2);
}
+/* TODO In debug mode, xlc 13.1.5 seems to overwrite v0 on the stack,
+ leading to segfaults. Possibly the calling convention doesn't
+ implement __vector int correctly. Release mode is OK. gcc is OK. */
template <int align>
static inline void gmx_simdcall
gatherLoadBySimdIntTranspose(const float * base,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2017, 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.
GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(1.0, 0.0)), atan2(rSimd_1_2_3, setZero()));
GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, -1.0)), atan2(setZero(), rSimd_m1_m2_m3));
GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(-1.0, 0.0)), atan2(rSimd_m1_m2_m3, setZero()));
- // degenerate value (origin) should return 0.0
- GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, 0.0)), atan2(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero()));
+ // degenerate value (origin) should return 0.0. At least IBM xlc 13.1.5 gets the reference
+ // value wrong (-nan) at -O3 optimization, so we compare to the correct value (0.0) instead.
+ GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(0.0), atan2(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero()));
}
/*! \brief Evaluate reference version of PME force correction. */
GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(1.0, 0.0)), atan2SingleAccuracy(rSimd_1_2_3, setZero()));
GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, -1.0)), atan2SingleAccuracy(setZero(), rSimd_m1_m2_m3));
GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(-1.0, 0.0)), atan2SingleAccuracy(rSimd_m1_m2_m3, setZero()));
- // degenerate value (origin) should return 0.0
- GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(std::atan2(0.0, 0.0)), atan2SingleAccuracy(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero()));
+ // degenerate value (origin) should return 0.0. At least IBM xlc 13.1.5 gets the reference
+ // value wrong (-nan) at -O3 optimization, so we compare to the correct value (0.0) instead.
+ GMX_EXPECT_SIMD_REAL_NEAR(setSimdRealFrom1R(0.0), atan2SingleAccuracy(setSimdRealFrom3R(0.0, 0.0, 0.0), setZero()));
}
TEST_F(SimdMathTest, pmeForceCorrectionSingleAccuracy)
};
static const char * const CopyrightText[] = {
"Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
- "Copyright (c) 2001-2015, The GROMACS development team at",
+ "Copyright (c) 2001-2017, The GROMACS development team at",
"Uppsala University, Stockholm University and",
"the Royal Institute of Technology, Sweden.",
"check out http://www.gromacs.org for more information."
m_add(force_vir, shake_vir, total_vir); /* we need the un-dispersion corrected total vir here */
trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ, trotter_seq, ettTSEQ2);
- copy_mat(shake_vir, state->svir_prev);
- copy_mat(force_vir, state->fvir_prev);
+ /* TODO This is only needed when we're about to write
+ * a checkpoint, because we use it after the restart
+ * (in a kludge?). But what should we be doing if
+ * startingFromCheckpoint or bInitStep are true? */
+ if (inputrecNptTrotter(ir) || inputrecNphTrotter(ir))
+ {
+ copy_mat(shake_vir, state->svir_prev);
+ copy_mat(force_vir, state->fvir_prev);
+ }
if (inputrecNvtTrotter(ir) && ir->eI == eiVV)
{
/* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */
bIMDstep = do_IMD(ir->bIMD, step, cr, bNS, state->box, as_rvec_array(state->x.data()), ir, t, wcycle);
/* kludge -- virial is lost with restart for MTTK NPT control. Must reload (saved earlier). */
- if (startingFromCheckpoint && bTrotter)
+ if (startingFromCheckpoint && (inputrecNptTrotter(ir) || inputrecNphTrotter(ir)))
{
copy_mat(state->svir_prev, shake_vir);
copy_mat(state->fvir_prev, force_vir);
include_directories(BEFORE SYSTEM ${GMOCK_INCLUDE_DIRS})
set(TESTUTILS_SOURCES
cmdlinetest.cpp
+ conftest.cpp
integrationtests.cpp
interactivetest.cpp
loggertest.cpp
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2017, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, 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 must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Implements routine to check the content of conf files.
+ *
+ * \author David van der Spoel <david.vanderspoel@icm.uu.se>
+ * \ingroup module_testutils
+ */
+#include "gmxpre.h"
+
+#include "conftest.h"
+
+#include <cstdio>
+#include <cstdlib>
+
+#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/stringutil.h"
+#include "gromacs/utility/textstream.h"
+
+#include "testutils/refdata.h"
+#include "testutils/testasserts.h"
+#include "testutils/textblockmatchers.h"
+
+namespace gmx
+{
+
+namespace test
+{
+
+namespace
+{
+
+class ConfMatcher : public ITextBlockMatcher
+{
+ public:
+ explicit ConfMatcher(const ConfMatchSettings &settings) : settings_(settings)
+ {
+ }
+
+ virtual void checkStream(TextInputStream *stream,
+ TestReferenceChecker *checker)
+ {
+ checkConfFile(stream, checker, settings_);
+ }
+ private:
+ ConfMatchSettings settings_;
+};
+
+} // namespace
+
+void checkConfFile(TextInputStream *input,
+ TestReferenceChecker *checker,
+ const ConfMatchSettings &)
+{
+
+ TestReferenceChecker groChecker(checker->checkCompound("GroFile", "Header"));
+ // Just check the first two lines of the output file
+ std::string line;
+ EXPECT_TRUE(input->readLine(&line));
+ line = stripSuffixIfPresent(line, "\n");
+ groChecker.checkString(line, "Title");
+ EXPECT_TRUE(input->readLine(&line));
+ line = stripSuffixIfPresent(line, "\n");
+ groChecker.checkInteger(std::atoi(line.c_str()), "Number of atoms");
+}
+
+TextBlockMatcherPointer ConfMatch::createMatcher() const
+{
+ return TextBlockMatcherPointer(new ConfMatcher(settings_));
+}
+
+} // namespace test
+} // namespace gmx
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2017, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, 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 must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \libinternal \file
+ * \brief
+ * Declares function to add the content of a conf file to a checker.
+ *
+ * \author David van der Spoel <david.vanderspoel@icm.uu.se>
+ * \inlibraryapi
+ * \ingroup module_testutils
+ */
+#ifndef GMX_TESTUTILS_CONFTEST_H
+#define GMX_TESTUTILS_CONFTEST_H
+
+#include <string>
+
+#include "testutils/testasserts.h"
+#include "testutils/textblockmatchers.h"
+
+namespace gmx
+{
+
+class TextInputStream;
+
+namespace test
+{
+
+class TestReferenceChecker;
+
+struct ConfMatchSettings
+{
+ ConfMatchSettings() : tolerance(defaultRealTolerance())
+ {
+ }
+
+ FloatingPointTolerance tolerance;
+};
+
+/*! \brief
+ * Adds content of a gro file to TestReferenceChecker object.
+ *
+ * \param[in] input Stream that provides the gro content.
+ * \param[in,out] checker Checker to use.
+ * \param[in] settings Settings to use for matching.
+ *
+ * Parses a gro file from the input stream, and checks the contents against
+ * reference data (only first two lines for now).
+ *
+ * \see ConfMatch
+ */
+void checkConfFile(TextInputStream *input,
+ TestReferenceChecker *checker,
+ const ConfMatchSettings &settings);
+
+/*! \libinternal \brief
+ * Match the contents as an gro file.
+ *
+ * \see checkGroFile()
+ *
+ * \inlibraryapi
+ * \ingroup module_testutils
+ */
+class ConfMatch : public ITextBlockMatcherSettings
+{
+ public:
+ //! Sets the tolerance for matching floating point values.
+ ConfMatch &tolerance(const FloatingPointTolerance &tolerance)
+ {
+ settings_.tolerance = tolerance;
+ return *this;
+ }
+
+ virtual TextBlockMatcherPointer createMatcher() const;
+
+ private:
+ ConfMatchSettings settings_;
+};
+
+} // namespace test
+
+} // namespace gmx
+
+#endif