From bab7afc539d77e4f931936a591c8e57622ac85ec Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Sun, 7 Sep 2008 18:39:54 +0400 Subject: [PATCH] benchmarks: time{catalan,euler,exp1,zeta3}.cc actually compile and work now. These benchmarks use internal CLN functions. Even worse -- they expect to find these functions in the global namespace. Declare internal CLN functions in the namespace cln. --- tests/timecatalan.cc | 20 ++++++++++++++------ tests/timeeuler.cc | 23 +++++++++++++++-------- tests/timeexp1.cc | 7 ++++++- tests/timezeta3.cc | 14 +++++++++----- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/tests/timecatalan.cc b/tests/timecatalan.cc index 4ddb6be..36c1bf7 100644 --- a/tests/timecatalan.cc +++ b/tests/timecatalan.cc @@ -8,6 +8,18 @@ #include #include "float/lfloat/cl_LF.h" #include +namespace cln +{ +// FIXME: using internal functions is a bad idea (even if it works +// on some ELF systems) +extern cl_LF compute_catalanconst_ramanujan (uintC len); +extern cl_LF compute_catalanconst_ramanujan_fast (uintC len); +extern cl_LF compute_catalanconst_expintegral1 (uintC len); +extern cl_LF compute_catalanconst_expintegral2 (uintC len); +extern cl_LF compute_catalanconst_cvz1 (uintC len); +extern cl_LF compute_catalanconst_cvz2 (uintC len); +} + using namespace cln; using namespace std; @@ -21,12 +33,8 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - extern cl_LF compute_catalanconst_ramanujan (uintC len); - extern cl_LF compute_catalanconst_ramanujan_fast (uintC len); - extern cl_LF compute_catalanconst_expintegral1 (uintC len); - extern cl_LF compute_catalanconst_expintegral2 (uintC len); - extern cl_LF compute_catalanconst_cvz1 (uintC len); - extern cl_LF compute_catalanconst_cvz2 (uintC len); + + cl_LF p; ln(cl_I_to_LF(1000,len+10)); // fill cache { CL_TIMING; diff --git a/tests/timeeuler.cc b/tests/timeeuler.cc index 40f44ea..f0730e6 100644 --- a/tests/timeeuler.cc +++ b/tests/timeeuler.cc @@ -7,6 +7,19 @@ #include #include #include "float/lfloat/cl_LF.h" +namespace cln +{ +// FIXME: don't use internal functions. +extern cl_LF compute_eulerconst (uintC len); +extern cl_LF compute_eulerconst_expintegral (uintC len); +extern cl_LF compute_eulerconst_expintegral1 (uintC len); +extern cl_LF compute_eulerconst_expintegral2 (uintC len); +extern cl_LF compute_eulerconst_besselintegral1 (uintC len); +extern cl_LF compute_eulerconst_besselintegral2 (uintC len); +extern cl_LF compute_eulerconst_besselintegral3 (uintC len); +extern cl_LF compute_eulerconst_besselintegral4 (uintC len); +} + using namespace cln; int main (int argc, char * argv[]) @@ -19,14 +32,8 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - extern cl_LF compute_eulerconst (uintC len); - extern cl_LF compute_eulerconst_expintegral (uintC len); - extern cl_LF compute_eulerconst_expintegral1 (uintC len); - extern cl_LF compute_eulerconst_expintegral2 (uintC len); - extern cl_LF compute_eulerconst_besselintegral1 (uintC len); - extern cl_LF compute_eulerconst_besselintegral2 (uintC len); - extern cl_LF compute_eulerconst_besselintegral3 (uintC len); - extern cl_LF compute_eulerconst_besselintegral4 (uintC len); + + cl_LF p; ln(cl_I_to_LF(1000,len+10)); // fill cache #if 0 diff --git a/tests/timeexp1.cc b/tests/timeexp1.cc index fac40e3..5aeab13 100644 --- a/tests/timeexp1.cc +++ b/tests/timeexp1.cc @@ -6,6 +6,12 @@ #include #include #include +namespace cln +{ +// FIXME: don't use internal functions! +extern cl_LF compute_exp1 (uintC len); +} + using namespace cln; int main (int argc, char * argv[]) @@ -18,7 +24,6 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - extern cl_LF compute_exp1 (uintC len); cl_LF p; { CL_TIMING; for (int rep = repetitions; rep > 0; rep--) diff --git a/tests/timezeta3.cc b/tests/timezeta3.cc index 898b958..cbdb8a0 100644 --- a/tests/timezeta3.cc +++ b/tests/timezeta3.cc @@ -6,6 +6,15 @@ #include #include #include "float/lfloat/cl_LF.h" +namespace cln +{ +// FIXME: don't use internal functions. +extern cl_LF zeta (int s, uintC len); +extern cl_LF compute_zeta_exp (int s, uintC len); +extern cl_LF compute_zeta_cvz1 (int s, uintC len); +extern cl_LF compute_zeta_cvz2 (int s, uintC len); +extern cl_LF zeta3 (uintC len); +} using namespace cln; #include using namespace std; @@ -20,11 +29,6 @@ int main (int argc, char * argv[]) if (argc < 2) exit(1); uintL len = atoi(argv[1]); - extern cl_LF zeta (int s, uintC len); - extern cl_LF compute_zeta_exp (int s, uintC len); - extern cl_LF compute_zeta_cvz1 (int s, uintC len); - extern cl_LF compute_zeta_cvz2 (int s, uintC len); - extern cl_LF zeta3 (uintC len); cl_LF p; ln(cl_I_to_LF(1000,len+10)); // fill cache { CL_TIMING;