void allocateDeviceBuffer(DeviceBuffer<ValueType>* buffer, size_t numValues, const DeviceContext& /* deviceContext */)
{
GMX_ASSERT(buffer, "needs a buffer pointer");
- // NOLINTNEXTLINE(google-readability-casting)
- cudaError_t stat = cudaMalloc((void**)(buffer), numValues * sizeof(ValueType));
+ cudaError_t stat = cudaMalloc(buffer, numValues * sizeof(ValueType));
GMX_RELEASE_ASSERT(
stat == cudaSuccess,
("Allocation of the device buffer failed. " + gmx::getDeviceErrorString(stat)).c_str());
{
case GpuApiCallBehavior::Async:
GMX_ASSERT(isHostMemoryPinned(hostBuffer), "Source host buffer was not pinned for CUDA");
- // NOLINTNEXTLINE(google-readability-casting)
- stat = cudaMemcpyAsync(*((ValueType**)buffer) + startingOffset,
+ stat = cudaMemcpyAsync(*reinterpret_cast<ValueType**>(buffer) + startingOffset,
hostBuffer,
bytes,
cudaMemcpyHostToDevice,
break;
case GpuApiCallBehavior::Sync:
- stat = cudaMemcpy(
- // NOLINTNEXTLINE(google-readability-casting)
- *((ValueType**)buffer) + startingOffset,
- hostBuffer,
- bytes,
- cudaMemcpyHostToDevice);
+ stat = cudaMemcpy(*reinterpret_cast<ValueType**>(buffer) + startingOffset,
+ hostBuffer,
+ bytes,
+ cudaMemcpyHostToDevice);
GMX_RELEASE_ASSERT(
stat == cudaSuccess,
("Synchronous H2D copy failed. " + gmx::getDeviceErrorString(stat)).c_str());
GMX_ASSERT(isHostMemoryPinned(hostBuffer),
"Destination host buffer was not pinned for CUDA");
stat = cudaMemcpyAsync(hostBuffer,
- // NOLINTNEXTLINE(google-readability-casting)
- *((ValueType**)buffer) + startingOffset,
+ *reinterpret_cast<ValueType**>(buffer) + startingOffset,
bytes,
cudaMemcpyDeviceToHost,
deviceStream.stream());
case GpuApiCallBehavior::Sync:
stat = cudaMemcpy(hostBuffer,
- // NOLINTNEXTLINE(google-readability-casting)
- *((ValueType**)buffer) + startingOffset,
+ *reinterpret_cast<ValueType**>(buffer) + startingOffset,
bytes,
cudaMemcpyDeviceToHost);
GMX_RELEASE_ASSERT(
const char pattern = 0;
cudaError_t stat = cudaMemsetAsync(
- // NOLINTNEXTLINE(google-readability-casting)
- *((ValueType**)buffer) + startingOffset,
- pattern,
- bytes,
- deviceStream.stream());
+ *reinterpret_cast<ValueType**>(buffer) + startingOffset, pattern, bytes, deviceStream.stream());
GMX_RELEASE_ASSERT(stat == cudaSuccess,
("Couldn't clear the device buffer. " + gmx::getDeviceErrorString(stat)).c_str());
}
const size_t sizeInBytes = numValues * sizeof(ValueType);
- cudaError_t stat =
- // NOLINTNEXTLINE(google-readability-casting)
- cudaMemcpy(*((ValueType**)deviceBuffer), hostBuffer, sizeInBytes, cudaMemcpyHostToDevice);
+ cudaError_t stat = cudaMemcpy(
+ *reinterpret_cast<ValueType**>(deviceBuffer), hostBuffer, sizeInBytes, cudaMemcpyHostToDevice);
GMX_RELEASE_ASSERT(stat == cudaSuccess,
("Synchronous H2D copy failed. " + gmx::getDeviceErrorString(stat)).c_str());