Files
nvbench/testing/reset_error.cu
Sergey Pavlov a171514056 Added cudaGetLastError() calls to reset benchmarking kernel errors (issue 88). (#173)
* Create and use NVBENCH_CUDA_CALL_RESET_ERROR.

* Moved cudaGetLastError() call to NVBENCH_CUDA_CALL macro

---------

Co-authored-by: Sergey Pavlov <psvvsp89@gmail.com>
2024-05-31 11:32:01 -04:00

31 lines
525 B
Plaintext

#include <nvbench/cuda_call.cuh>
#include "test_asserts.cuh"
namespace
{
__global__ void multiply5(const int32_t* __restrict__ a, int32_t* __restrict__ b)
{
const auto id = blockIdx.x * blockDim.x + threadIdx.x;
b[id] = 5 * a[id];
}
}
int main()
{
multiply5<<<256, 256>>>(nullptr, nullptr);
try
{
NVBENCH_CUDA_CALL(cudaStreamSynchronize(0));
ASSERT(false);
}
catch (const std::runtime_error &)
{
ASSERT(cudaGetLastError() == cudaError_t::cudaSuccess);
}
return 0;
}