Do not overallocate shiftVec and fshifts buffers in OpenCL
authorArtem Zhmurov <zhmurov@gmail.com>
Mon, 15 Mar 2021 09:12:04 +0000 (12:12 +0300)
committerAndrey Alekseenko <al42and@gmail.com>
Mon, 15 Mar 2021 10:28:44 +0000 (10:28 +0000)
When changing buffers from flat float format to Float3,
the sizes of the shiftVec and fshift buffers were not updated
in OpenCL NBNXM data management, which lead to the buffers being
overallocated. This fixes the issue.

Introduced in c66827166fc9099ecd1a4a2f7080558df70bf529

src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp

index 0583d0a73d7d6896aa7ebacf2febbfeaea4b9717..b823973a6812fe2707598370e1ab03c6e2329d5a 100644 (file)
@@ -107,10 +107,10 @@ static void init_atomdata_first(NBAtomData* ad, int ntypes, const DeviceContext&
 {
     ad->numTypes = ntypes;
 
-    allocateDeviceBuffer(&ad->shiftVec, SHIFTS * DIM, deviceContext);
+    allocateDeviceBuffer(&ad->shiftVec, SHIFTS, deviceContext);
     ad->shiftVecUploaded = false;
 
-    allocateDeviceBuffer(&ad->fShift, SHIFTS * DIM, deviceContext);
+    allocateDeviceBuffer(&ad->fShift, SHIFTS, deviceContext);
     allocateDeviceBuffer(&ad->eLJ, 1, deviceContext);
     allocateDeviceBuffer(&ad->eElec, 1, deviceContext);