42 const int nloop = 1000000;
52 cout <<
"Clean Cache" << endl;
55 cout <<
"_Size_____TFad______TinyFad_______Hand_______Member___\n" ;
90 cout.setf(ios::fixed,ios::floatfield);
95 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
106 for (j=0; j<ntest; j++){
111 for (i=0; i<
nloop; ++i)
112 x4 = 2.
f*(x1*x2)-x3+x3/x5+4.f;
129 for (i=0; i<
nloop; ++i)
130 y4 = 2.
f*(y1*y2)-y3+y3/y5+4.f;
136 float z1=2., z2=3., z3=5., z4, z5=3.;
137 float *tz1, *tz2, *tz3, *tz4, *tz5;
138 tz1 =
new float[Num]; tz2 =
new float[Num]; tz3 =
new float[Num]; tz4 =
new float[Num]; tz5 =
new float[Num];
139 for (k=0; k<Num; ++k) {
140 tz5[k] = tz4[k] = tz3[k] = tz1[k] = tz2[k] = float(0.);
146 for (i=0; i<
nloop; ++i) {
147 z4 = 2.f*(z1*z2)-z3+z3/z5+4.
f;
148 for (k=0; k<Num; ++k)
149 tz4[k] = 2.
f*(z2*tz1[k]+z1*tz2[k])-tz3[k]+ (z5*tz3[k] - z3*tz5[k])/(z5*z5);
155 delete [] tz1;
delete [] tz2;
delete [] tz3;
delete [] tz4;
delete [] tz5;
160 for (i=0; i<
nloop; ++i) {
161 x4.val() = 2.f*(x1.val()*x2.val())-x3.val()+x3.val()/x5.
val()+4.f;
162 for (k=0; k<Num; ++k)
163 x4.fastAccessDx(k) = 2.f*(x1.fastAccessDx(k)*x2.val()+x1.val()*x2.fastAccessDx(k)) - x3.fastAccessDx(k)
174 cout << setw(12) << time1 << setw(12) << time2 << setw(12) << time3 << setw(12) << time4 << endl;
void Bench_4_Op(const TinyFad< Num > &x, const int nloop)
clarg::argInt nloop("-l", "Number of loop iterations of the Subst_Backward/Subst_Forward", 1)