Commit 342e4a2e60113d896895d0c5fc25c81aad619cc5

Authored by nope
1 parent 5d28430a
Exists in master

add dqds benchamrk

Showing 1 changed file with 31 additions and 8 deletions   Show diff stats
benchmarks/vectors/vectors.h
1 1 #ifndef VECTORS
2 2 #define VECTORS
3 3  
4   -const int BENCH_COUNT = 5;
  4 +const int BENCH_COUNT = 6;
5 5  
6 6 const char* type_names[BENCH_COUNT] = {
7 7 "op", // 0
8 8 "op_d", // 1
9 9 "scalar", // 2
10 10 "scalar_d", // 3
11   - "gorner" // 3
  11 + "horner", // 4
  12 + "dqds" // 5
12 13 };
13 14  
14 15 template <typename T, typename AT>
... ... @@ -97,7 +98,6 @@ void KernelScalarD(AT a, AT b, AT c, int size)
97 98 c[0] = a[0];
98 99 }
99 100  
100   -
101 101 template <typename T, typename AT>
102 102 void KernelHorner(AT a, AT, AT c, int size)
103 103 {
... ... @@ -110,27 +110,50 @@ void KernelHorner(AT a, AT, AT c, int size)
110 110 }
111 111  
112 112 template <typename T, typename AT>
  113 +void KernelDQDS(AT a, AT b, AT c, int size)
  114 +{
  115 + T delta = 0; // some param
  116 +
  117 + T d = a[0] - delta;
  118 +
  119 + for(int j = 0; j < size - 2; j++)
  120 + {
  121 + a[j] = d + b[j];
  122 + T t = a[j + 1] / a[j];
  123 + b[j] = b[j] * t;
  124 + d = d * t - delta;
  125 + }
  126 +
  127 + a[size - 1] = d;
  128 +
  129 + c[0] = d; // checksum
  130 +}
  131 +
  132 +template <typename T, typename AT>
113 133 void CallKernel(int core_type, AT a, AT b, AT c, int size)
114 134 {
115 135 LOC_PAPI_BEGIN_BLOCK
116 136  
117 137 switch(core_type)
118 138 {
119   - //op
  139 + // op
120 140 case 0: KernelOp<T, AT>(a, b, c, size); break;
121 141  
122   - //op with double
  142 + // op with double
123 143 case 1: KernelOpD<T, AT>(a, b, c, size); break;
124 144  
125   - //dot product
  145 + // dot product
126 146 case 2: KernelScalar<T, AT>(a, b, c, size); break;
127 147  
128   - //dot product with double
  148 + // dot product with double
129 149 case 3: KernelScalarD<T, AT>(a, b, c, size); break;
130 150  
131   - //gorner
  151 + // horner
132 152 case 4: KernelHorner<T, AT>(a, b, c, size); break;
133 153  
  154 + // dqds
  155 + case 5: KernelDQDS<T, AT>(a, b, c, size); break;
  156 +
134 157 default: fprintf(stderr, "unexpected core type");
135 158 }
136 159  
... ...