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>
48 INFOS(
"starting " <<filename);
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;
60 bool hasOldResults =
read_xy_file(filename, oldSizes, oldFlops,
true);
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;
74 cblas_saxpy(1,0,&dummy,1,&dummy,1);
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);
bool read_xy_file(const std::string &filename, std::vector< int > &tab_sizes, std::vector< double > &tab_mflops, bool quiet=false)
void size_lin_log(const int nb_point, const int, const int size_max, Vector &X)
static BTL_DONT_INLINE bool skipAction(const std::string &_name)
void dump_xy_file(const Vector_A &X, const Vector_B &Y, const std::string &filename)
#define BTL_DISABLE_SSE_EXCEPTIONS()
static BtlConfig Instance
BTL_DONT_INLINE void bench(int size_min, int size_max, int nb_point)