Assert the size of non-bonded GPU work units
authorSzilard Pall <pall.szilard@gmail.com>
Wed, 13 May 2015 18:25:22 +0000 (20:25 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 15 May 2015 15:39:34 +0000 (17:39 +0200)
<=0 sized grid blocks lead to kernel launch failure which have
caused issues before.

Refs #1734

Change-Id: I4e914bcf3168f7268dab64b69d25bf34fb6c85c9

src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu

index 46b460811dddebdaadfa445ff7deca939e0ed9cf..69eab0a4606a9716d1034153f132515c63f64396 100644 (file)
@@ -131,6 +131,9 @@ static inline int calc_nb_kernel_nblock(int nwork_units, cuda_dev_info_t *dinfo)
     int max_grid_x_size;
 
     assert(dinfo);
+    /* CUDA does not accept grid dimension of 0 (which can happen e.g. with an
+       empty domain) and that case should be handled before this point. */
+    assert(nwork_units > 0);
 
     max_grid_x_size = dinfo->prop.maxGridSize[0];