[patch] libstdc++: Limit Riemann zeta testcases on simulator

Ed Smith-Rowland 3dw4rd@verizon.net
Thu Oct 11 12:56:00 GMT 2007


Jesper Nilsson wrote:
> Hi,
>
> The following two tests in libstdc++-v3/testsuite time out after 600 seconds
> in the simulator when running the testsuite for cris-axis-elf on
> i686-pc-linux-gnu (Core 2 @1.86GHz):
>
> tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc
> tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc
>
> The included patch cuts the number of iterations to 5 if the target
> is simulator.  On the above host, 5 iterations still takes 65 seconds
> to simulate for cris-axis-elf.  (The full set requires 700 seconds)
>
> Is this an acceptable way to limit the test?  Not knowing anything
> about Riemann Zeta, it is hard to gauge the impact...
>
> Testing done with make -k check 'RUNTESTFLAGS=--target_board=cris-sim\{,-march=v3,-march=v8,-march=v10\}'
>
> Best regards,
>
> /^Jesper Nilsson
>
> libstdc++-v3/ChangeLog:
>
> 2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>
>
> 	* tr1/5_numerical_facilities/special_functions/20_riemann_zeta/
> 	check_value_neg.c (MAX_ITERATIONS): Add limit when target is simulator.
> 	* tr1/5_numerical_facilities/special_functions/20_riemann_zeta/
> 	check_value_pos.c (MAX_ITERATIONS): Ditto.
>
>
> Index: tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc
> ===================================================================
> --- tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc	(revision 128178)
> +++ tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc	(working copy)
> @@ -20,7 +20,13 @@
>  
>  //  riemann_zeta
>  
> +// This can take long on simulators, timing out the test.
> +// { dg-options "-DMAX_ITERATIONS=5" { target simulator } }
>  
> +#ifndef MAX_ITERATIONS
> +#define MAX_ITERATIONS (sizeof(data001) / sizeof(testcase_riemann_zeta<double>))
> +#endif
> +
>  //  Compare against values generated by the GNU Scientific Library.
>  //  The GSL can be found on the web: http://www.gnu.org/software/gsl/
>  
> @@ -106,8 +112,7 @@
>    const Tp eps = std::numeric_limits<Tp>::epsilon();
>    Tp max_abs_diff = -Tp(1);
>    Tp max_abs_frac = -Tp(1);
> -  unsigned int num_datum = sizeof(data001)
> -                         / sizeof(testcase_riemann_zeta<double>);
> +  unsigned int num_datum = MAX_ITERATIONS;
>    for (unsigned int i = 0; i < num_datum; ++i)
>      {
>        const Tp f = std::tr1::riemann_zeta(Tp(data001[i].x));
> Index: tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc
> ===================================================================
> --- tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc	(revision 128178)
> +++ tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc	(working copy)
> @@ -20,7 +20,13 @@
>  
>  //  riemann_zeta
>  
> +// This can take long on simulators, timing out the test.
> +// { dg-options "-DMAX_ITERATIONS=5" { target simulator } }
>  
> +#ifndef MAX_ITERATIONS
> +#define MAX_ITERATIONS (sizeof(data001) / sizeof(testcase_riemann_zeta<double>))
> +#endif
> +
>  //  Compare against values generated by the GNU Scientific Library.
>  //  The GSL can be found on the web: http://www.gnu.org/software/gsl/
>  
> @@ -196,8 +202,7 @@
>    const Tp eps = std::numeric_limits<Tp>::epsilon();
>    Tp max_abs_diff = -Tp(1);
>    Tp max_abs_frac = -Tp(1);
> -  unsigned int num_datum = sizeof(data001)
> -                         / sizeof(testcase_riemann_zeta<double>);
> +  unsigned int num_datum = MAX_ITERATIONS;
>    for (unsigned int i = 0; i < num_datum; ++i)
>      {
>        const Tp f = std::tr1::riemann_zeta(Tp(data001[i].x));
>
>
> /^JN - Jesper Nilsson
> --
>                Jesper Nilsson -- jesper.nilsson@axis.com
>
>   
I might be OK to limit the number of iterations for *one* target.  The 
data set that is being looped over is also a numeric accuracy check so 
I'm a little reluctant to truncate the tests for *all* targets.

OTOH, I'm a little shocked at how long it takes to run the computations!

I don't have access to this architecture.  Does this arch have floating 
point?  Or is it simulated?
Maybe we might want to xfail on targets where you really aren't going to 
be crunching numbers.

I'll go check on my machines to see if Zeta is one of the more slow 
algorithms.

Ed



More information about the Libstdc++ mailing list