-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create and use NVBENCH_CUDA_CALL_RESET_ERROR.
- Loading branch information
Sergey Pavlov
committed
May 29, 2024
1 parent
088c9ee
commit b333e5c
Showing
6 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#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_RESET_ERROR(cudaStreamSynchronize(0)); | ||
return 1; | ||
} | ||
catch (const std::runtime_error &) | ||
{ | ||
ASSERT(cudaGetLastError() == cudaError_t::cudaSuccess); | ||
} | ||
|
||
return 0; | ||
} |