Merge branch release-5-1 into release-2016
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 17 Jun 2016 10:30:52 +0000 (12:30 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 17 Jun 2016 10:30:52 +0000 (12:30 +0200)
Change-Id: I02dae90bd8dfa2279081bc8547ae447b68b30a76

src/gromacs/listed-forces/disre.cpp
src/gromacs/mdlib/nbnxn_ocl/nbnxn_ocl_data_mgmt.cpp

index 7ff3a31ecc67b16f976cb46daccab7e675f4f1e8..b591b1969a89e3a87686818ab52b2d9e252d4d47 100644 (file)
@@ -152,7 +152,7 @@ void init_disres(FILE *fplog, const gmx_mtop_t *mtop,
             fprintf(fplog, "%s\n", notestr);
         }
 
-        if (dd->dr_tau != 0 || ir->eDisre == edrEnsemble || cr->ms != NULL ||
+        if (dd->dr_tau != 0 || ir->eDisre == edrEnsemble ||
             dd->nres != dd->npair)
         {
             gmx_fatal(FARGS, "Time or ensemble averaged or multiple pair distance restraints do not work (yet) with domain decomposition, use a single MPI rank%s", cr->ms ? " per simulation" : "");
index f9080af4eb120a01e479d682a4847009e7b16e3d..c7e3329a7c210d8dd3a595684d4292c607350c47 100644 (file)
@@ -641,7 +641,8 @@ nbnxn_ocl_clear_e_fshift(gmx_nbnxn_ocl_t *nb)
     cl_kernel            zero_e_fshift = nb->kernel_zero_e_fshift;
 
     local_work_size[0]   = 64;
-    global_work_size[0]  = ((shifts/64)*64) + ((shifts%64) ? 64 : 0);
+    // Round the total number of threads up from the array size
+    global_work_size[0]  = ((shifts + local_work_size[0] - 1)/local_work_size[0])*local_work_size[0];
 
     arg_no    = 0;
     cl_error  = clSetKernelArg(zero_e_fshift, arg_no++, sizeof(cl_mem), &(adat->fshift));
@@ -814,6 +815,10 @@ void nbnxn_gpu_init(gmx_nbnxn_ocl_t          **p_nb,
  */
 static void nbnxn_ocl_clear_f(gmx_nbnxn_ocl_t *nb, int natoms_clear)
 {
+    if (natoms_clear == 0)
+    {
+        return;
+    }
 
     cl_int               cl_error;
     cl_atomdata_t *      adat     = nb->atdat;
@@ -830,7 +835,9 @@ static void nbnxn_ocl_clear_f(gmx_nbnxn_ocl_t *nb, int natoms_clear)
     cl_uint              natoms_flat = natoms_clear * (sizeof(rvec)/sizeof(real));
 
     local_work_size[0]  = 64;
-    global_work_size[0] = ((natoms_flat/local_work_size[0])*local_work_size[0]) + ((natoms_flat%local_work_size[0]) ? local_work_size[0] : 0);
+    // Round the total number of threads up from the array size
+    global_work_size[0] = ((natoms_flat + local_work_size[0] - 1)/local_work_size[0])*local_work_size[0];
+
 
     arg_no    = 0;
     cl_error  = clSetKernelArg(memset_f, arg_no++, sizeof(cl_mem), &(adat->f));