mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
Move sleep kernel to its own header.
This will be useful for testing in general.
This commit is contained in:
@@ -3,28 +3,11 @@
|
||||
#include <nvbench/cuda_stream.cuh>
|
||||
#include <nvbench/types.cuh>
|
||||
|
||||
#include "sleep_kernel.cuh"
|
||||
#include "test_asserts.cuh"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <cuda/std/chrono>
|
||||
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
__global__ void sleep_kernel(double seconds)
|
||||
{
|
||||
const auto start = cuda::std::chrono::high_resolution_clock::now();
|
||||
const auto ns = cuda::std::chrono::nanoseconds(
|
||||
static_cast<nvbench::int64_t>(seconds * 1000 * 1000 * 1000));
|
||||
const auto finish = start + ns;
|
||||
|
||||
auto now = cuda::std::chrono::high_resolution_clock::now();
|
||||
while (now < finish)
|
||||
{
|
||||
now = cuda::std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
}
|
||||
|
||||
void test_basic(cudaStream_t time_stream,
|
||||
cudaStream_t exec_stream,
|
||||
bool expected)
|
||||
|
||||
Reference in New Issue
Block a user