From 56a67d7cce2acc2feee9b7fe3c7e503010f5032b Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Wed, 13 May 2015 21:54:38 +0200 Subject: [PATCH] Fixed CUDA error with empty domains Recent commit fc8a5624 introduced empty CUDA kernel calls when there are empty domains. This seems not be allowed by CUDA (we get errors). Fixed #1734. Refs #1721. Change-Id: Ifd32a55c8d6756c93a0fcaba29983ae326abc569 --- src/mdlib/nbnxn_cuda/nbnxn_cuda.cu | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu b/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu index 11a1f43291..31be75dd60 100644 --- a/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu +++ b/src/mdlib/nbnxn_cuda/nbnxn_cuda.cu @@ -292,7 +292,8 @@ void nbnxn_cuda_launch_kernel(nbnxn_cuda_ptr_t cu_nb, we always call the local kernel, the local x+q copy and later (not in this function) the stream wait, local f copyback and the f buffer clearing. All these operations, except for the local interaction kernel, - are needed for the non-local interactions. */ + are needed for the non-local interactions. The skip of the local kernel + call is taken care of later in this function. */ if (iloc == eintNonlocal && plist->nsci == 0) { return; @@ -343,6 +344,12 @@ void nbnxn_cuda_launch_kernel(nbnxn_cuda_ptr_t cu_nb, CU_RET_ERR(stat, "cudaEventRecord failed"); } + if (plist->nsci == 0) + { + /* Don't launch an empty local kernel (not allowed with CUDA) */ + return; + } + /* beginning of timed nonbonded calculation section */ if (bDoTime) { -- 2.22.0