Move sleep kernel to its own header.

This will be useful for testing in general.
This commit is contained in:
Allison Vacanti
2020-12-30 14:47:25 -05:00
parent ad44463d6e
commit fd3b82cc6f
2 changed files with 20 additions and 18 deletions

View File

@@ -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)