From 5ba80e14efb595688a3dc3d49c212bc393840513 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Fri, 9 Jun 2023 19:38:01 -0400 Subject: Add constant_cycles_kernel benchmark + header split and Makefile Benchmark supports: => Looping on the GPU for a specified number of iterations => Looping infinitely on the GPU => Logging the sum time (ns and ms) for all iterations to complete Also splits `testbench.h` out of `copy_testbench.h` for use in other benchmarks. --- testbench.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 testbench.h (limited to 'testbench.h') diff --git a/testbench.h b/testbench.h new file mode 100644 index 0000000..28d7f77 --- /dev/null +++ b/testbench.h @@ -0,0 +1,14 @@ +/* Copyright 2021-2023 Joshua Bakita + * Header for miscellaneous experimental helper functions. + */ + +#define SAFE(x) \ + if ((err = (cudaError_t)(x)) != 0) { \ + printf("CUDA error %d! %s\n", err, cudaGetErrorString(err)); \ + printf("Suspect line: %s\n", #x); \ + exit(1); \ + } + +#define s2ns(s) ((s)*1000l*1000l*1000l) +#define ns2ms(s) ((s)/(1000l*1000l)) +#define timediff(start, end) ((s2ns((end).tv_sec) + (end).tv_nsec) - (s2ns((start).tv_sec) + (start).tv_nsec)) -- cgit v1.2.2