MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / perf_saxpy

Function perf_saxpy

compute/perf/perf_saxpy.cpp:34–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template<class T>
34double perf_saxpy(const compute::vector<T>& x,
35 const compute::vector<T>& y,
36 const T alpha,
37 const size_t trials,
38 compute::command_queue& queue)
39{
40 // create vector on the device to store the result
41 compute::vector<T> result(x.size(), queue.get_context());
42
43 perf_timer t;
44 for(size_t trial = 0; trial < trials; trial++){
45 compute::fill(result.begin(), result.end(), T(0), queue);
46 queue.finish();
47
48 t.start();
49
50 using compute::lambda::_1;
51 using compute::lambda::_2;
52
53 compute::transform(
54 x.begin(), x.end(), y.begin(), result.begin(), alpha * _1 + _2, queue
55 );
56
57 queue.finish();
58 t.stop();
59 }
60
61 return t.min_time();
62}
63
64template<class T>
65void tune_saxpy(const compute::vector<T>& x,

Callers 2

tune_saxpyFunction · 0.85
mainFunction · 0.85

Calls 11

transformFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
fillFunction · 0.50
TClass · 0.50
sizeMethod · 0.45
get_contextMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected