From 7417c69ce221dac7361f5982809a3833c75b5f6b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 24 Sep 2017 19:46:00 +0200 Subject: [PATCH] Make the number of GPU iterations a named constant. --- narabu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/narabu.cpp b/narabu.cpp index a0e5871..bb1209c 100644 --- a/narabu.cpp +++ b/narabu.cpp @@ -271,7 +271,8 @@ int main(int argc, char **argv) #define PARALLEL_SLICES 1 steady_clock::time_point start = steady_clock::now(); - for (int i = 0; i < 1000; ++i) { + unsigned num_iterations = 1000; + for (unsigned i = 0; i < num_iterations; ++i) { unsigned num_slices = (WIDTH/8)*(HEIGHT/8)/BLOCKS_PER_STREAM; glDispatchCompute(1, (num_slices+PARALLEL_SLICES-1)/PARALLEL_SLICES, 1); } @@ -373,5 +374,5 @@ int main(int argc, char **argv) glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); // unbind printf("foo = 0x%x\n", glGetError()); - printf("Each iteration took %.3f ms.\n", 1e3 * duration(now - start).count() / 1000); + printf("Each iteration took %.3f ms.\n", 1e3 * duration(now - start).count() / num_iterations); } -- 2.39.2