Add early returns in clearDeviceBuffer(...) in OpenCL and CUDA
authorArtem Zhmurov <zhmurov@gmail.com>
Fri, 2 Apr 2021 12:31:27 +0000 (15:31 +0300)
committerAndrey Alekseenko <al42and@gmail.com>
Sun, 11 Apr 2021 01:17:43 +0000 (01:17 +0000)
commite8ed65878a74d7f63a369520d35322ff94599173
tree3a7e8f442d3c40fc915183da7b9531e95538f35e
parentd851626776eb6abbc4c49b173d3c58bd50d4f15b
Add early returns in clearDeviceBuffer(...) in OpenCL and CUDA

Clearing of empty buffer can cause the OpenCL/CUDA API failure.
Early return when requested size to clear is zero allows to
avoid this failure not calling the API for empty buffers.

This also makes the definition of the clearDeviceBuffer(...) in
OpenCL, CUDA similar to its definition in SYCL, where the early
return is already present.

Fixes #4002.
src/gromacs/gpu_utils/devicebuffer.cuh
src/gromacs/gpu_utils/devicebuffer_ocl.h