From de0533d168a9c34be859b6ec8111edd8186e4d3b Mon Sep 17 00:00:00 2001 From: "Dakota St. Laurent" Date: Thu, 18 Jun 2015 14:15:37 -0400 Subject: [PATCH] lots of changes to example01: - added a fourth version, which includes additional overhead also in version 01 (indexing, determining ratio, etc) - added a 'verbose' command line option, where if verbose is true then ratios of timings will be outputted, otherwise just durations will be outputted - made certain variables to be constants - cleaned up comments and what not - removed all instances of kernelfunctor --- example01/main.cpp | 130 ++++++++++++++++++++++++++++++--------------- 1 file changed, 88 insertions(+), 42 deletions(-) diff --git a/example01/main.cpp b/example01/main.cpp index a1bb5c3..5284a40 100644 --- a/example01/main.cpp +++ b/example01/main.cpp @@ -1,6 +1,7 @@ #include -#include "CL/cl.hpp" #include +#include +#include "../CL/cl.hpp" void compareResults (double CPUtime, double GPUtime, int trial) { @@ -30,9 +31,8 @@ double timeAddVectorsCPU(int n, int k) { start = std::clock(); for (int i=0; i all_platforms; cl::Platform::get(&all_platforms); @@ -71,7 +86,7 @@ int main() { std::string kernel_code= // is equivalent to the host's "time_add_vectors" function, except the // timing will be done on the host. - " void kernel looped_add(global const int* v1, global const int* v2, global int* v3, " + " void kernel add_looped(global const int* v1, global const int* v2, global int* v3, " " global const int* constants) {" " int ID, NUM_GLOBAL_WITEMS, n, k, ratio, start, stop;" " ID = get_global_id(0);" @@ -105,12 +120,23 @@ int main() { " v3[i] = v1[i] + v2[i];" " }" "" - " void kernel add_single(global const int* v1, global const int* v2, global int* v3, " - " global const int* constants) { " - " int k = constants[1];" + " void kernel add_single(global const int* v1, global const int* v2, global int* v3) { " " int ID = get_global_id(0);" - " for (int i=0; i