26 #include "utilities.h"
36 extern "C" void cblas_saxpy(
const int,
const float,
const float*,
const int,
float *,
const int);
40 template <
template<
class>
class Perf_Analyzer,
class Action>
52 std::vector<double> tab_mflops(nb_point);
53 std::vector<int> tab_sizes(nb_point);
58 std::vector<int> oldSizes;
59 std::vector<double> oldFlops;
61 int oldi = oldSizes.size() - 1;
64 Perf_Analyzer<Action> perf_action;
65 for (
int i=nb_point-1;
i>=0;
i--)
68 std::cout <<
" " <<
"size = " << tab_sizes[
i] <<
" " << std::flush;
78 tab_mflops[
i] = perf_action.eval_mflops(tab_sizes[
i]);
79 std::cout << tab_mflops[
i];
83 while (oldi>=0 && oldSizes[oldi]>tab_sizes[
i])
85 if (oldi>=0 && oldSizes[oldi]==tab_sizes[
i])
87 if (oldFlops[oldi]<tab_mflops[
i])
91 std::cout << oldFlops[oldi];
95 std::cout <<
" MFlops (" << nb_point-
i <<
"/" << nb_point <<
")" << std::endl;
103 std::vector<int> newSizes;
104 std::vector<double> newFlops;
107 while (
i<tab_sizes.size() &&
j<oldSizes.size())
109 if (tab_sizes[
i] == oldSizes[
j])
111 newSizes.push_back(tab_sizes[
i]);
112 newFlops.push_back(
std::max(tab_mflops[
i], oldFlops[
j]));
116 else if (tab_sizes[
i] < oldSizes[
j])
118 newSizes.push_back(tab_sizes[
i]);
119 newFlops.push_back(tab_mflops[
i]);
124 newSizes.push_back(oldSizes[
j]);
125 newFlops.push_back(oldFlops[
j]);
129 while (
i<tab_sizes.size())
131 newSizes.push_back(tab_sizes[
i]);
132 newFlops.push_back(tab_mflops[
i]);
135 while (
j<oldSizes.size())
137 newSizes.push_back(oldSizes[
j]);
138 newFlops.push_back(oldFlops[
j]);
141 tab_mflops = newFlops;
142 tab_sizes = newSizes;
153 template <
class Action>
157 bench<Portable_Perf_Analyzer,Action>(size_min,size_max,nb_point);