From cfd7ae6ed97e391fec84f32c3b7f25d625063879 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Szil=C3=A1rd=20P=C3=A1ll?= Date: Mon, 28 Aug 2017 14:31:25 +0200 Subject: [PATCH] Avoid division by zero is pruning part calculation Added assert on manually set pruning interval. Change-Id: I438f98a0a42335d8f79bf7604b53b51943e7db8c --- docs/user-guide/environment-variables.rst | 3 ++- src/gromacs/mdlib/nbnxn_tuning.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/environment-variables.rst b/docs/user-guide/environment-variables.rst index 1505969478..ac78d8f0dc 100644 --- a/docs/user-guide/environment-variables.rst +++ b/docs/user-guide/environment-variables.rst @@ -358,7 +358,8 @@ Performance and Run Control ``GMX_NSTLIST_DYNAMICPRUNING`` overrides the dynamic pair-list pruning interval chosen heuristically - by mdrun. Values should be between 1 and :mdp:`nstlist - 1`. + by mdrun. Values should be between the pruning frequency value + (1 for CPU and 2 for GPU) and :mdp:`nstlist - 1`. ``GMX_USE_TREEREDUCE`` use tree reduction for nbnxn force reduction. Potentially faster for large number of diff --git a/src/gromacs/mdlib/nbnxn_tuning.cpp b/src/gromacs/mdlib/nbnxn_tuning.cpp index 58d48e33cd..6b616c6ee0 100644 --- a/src/gromacs/mdlib/nbnxn_tuning.cpp +++ b/src/gromacs/mdlib/nbnxn_tuning.cpp @@ -488,6 +488,10 @@ void setupDynamicPairlistPruning(FILE *fplog, * rolling pruning interval slightly shorter than nstlistTune, * thus giving correct results, but a slightly lower efficiency. */ + GMX_RELEASE_ASSERT(listParams->nstlistPrune >= c_nbnxnGpuRollingListPruningInterval, + ( "With dynamic list pruning on GPUs pruning frequency must be at least as large as the rolling pruning interval (" + + std::to_string(c_nbnxnGpuRollingListPruningInterval) + + ").").c_str() ); listParams->numRollingParts = listParams->nstlistPrune/c_nbnxnGpuRollingListPruningInterval; } else -- 2.22.0