Files
nvbench/testing/sleep_kernel.cuh
Allison Vacanti fd3b82cc6f Move sleep kernel to its own header.
This will be useful for testing in general.
2020-12-30 14:47:25 -05:00

20 lines
494 B
Plaintext

#pragma once
#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();
}
}