$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r71667 - sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance
From: mario.mulansky_at_[hidden]
Date: 2011-05-02 09:56:21
Author: mariomulansky
Date: 2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
New Revision: 71667
URL: http://svn.boost.org/trac/boost/changeset/71667
Log:
performance for default algebra
Added:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4_def_alg.cpp   (contents, props changed)
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk54ck_def_alg.cpp   (contents, props changed)
Text files modified: 
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/Jamfile        |     8 ++++++++                                
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4.cpp |     5 ++---                                   
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/perf_tests.py  |     8 ++++----                                
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/results.dat    |    40 ++++++++++++++++++++--------------------
   4 files changed, 34 insertions(+), 27 deletions(-)
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/Jamfile
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/Jamfile	(original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/Jamfile	2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
@@ -24,6 +24,10 @@
     :   odeint_rk4.cpp
     ;
     
+exe odeint_rk4_def_alg
+    :   odeint_rk4_def_alg.cpp
+    ;
+    
 exe nr_rk4
     : nr_rk4.cpp
     ;
@@ -46,6 +50,10 @@
     :   odeint_rk54ck.cpp
     ;
     
+exe odeint_rk54ck_def_alg
+    :   odeint_rk54ck_def_alg.cpp
+    ;
+    
 exe gsl_rk54ck
     : gsl_rk54ck.cpp libgsl libgslcblas
     ;
\ No newline at end of file
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4.cpp	(original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4.cpp	2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
@@ -36,9 +36,8 @@
 
 
 typedef boost::array< double , 3 > state_type;
-typedef boost::numeric::odeint::explicit_rk4< state_type > rk4_odeint_type;
-//typedef boost::numeric::odeint::explicit_rk4< state_type , double , state_type , double ,
-//                                              boost::numeric::odeint::array_algebra > rk4_odeint_type;
+typedef boost::numeric::odeint::explicit_rk4< state_type , double , state_type , double ,
+                                              boost::numeric::odeint::array_algebra > rk4_odeint_type;
 
 
 inline void lorenz( const state_type &x , state_type &dxdt , const double t )
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4_def_alg.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk4_def_alg.cpp	2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
@@ -0,0 +1,84 @@
+/*
+ * odeint_rk4.cpp
+ *
+ *  Created on: Apr 28, 2011
+ *      Author: mario
+ */
+
+#include <iostream>
+#include <fstream>
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/stepper/explicit_rk4.hpp>
+#include <boost/numeric/odeint/algebra/array_algebra.hpp>
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics.hpp>
+#include <boost/timer.hpp>
+
+#define tab "\t"
+
+using namespace std;
+using namespace boost::accumulators;
+
+typedef accumulator_set<
+    double , stats< tag::mean , tag::variance >
+    > accumulator_type;
+
+ostream& operator<<( ostream& out , accumulator_type &acc )
+{
+    out << boost::accumulators::mean( acc ) << tab;
+//    out << boost::accumulators::variance( acc ) << tab;
+    return out;
+}
+
+typedef boost::timer timer_type;
+
+
+typedef boost::array< double , 3 > state_type;
+typedef boost::numeric::odeint::explicit_rk4< state_type > rk4_odeint_type;
+
+inline void lorenz( const state_type &x , state_type &dxdt , const double t )
+{
+    const double sigma = 10.0;
+    const double R = 28.0;
+    const double b = 8.0 / 3.0;
+    dxdt[0] = sigma * ( x[1] - x[0] );
+    dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
+    dxdt[2] = x[0]*x[1] - b * x[2];
+}
+
+
+const size_t loops = 20;
+
+int main( int argc , char **argv )
+{
+    rk4_odeint_type rk4_odeint;
+
+    const size_t num_of_steps = 20000000;
+    const double dt = 1E-10;
+
+    accumulator_type acc;
+    timer_type timer;
+
+    srand( 12312354 );
+
+    for( size_t n=0 ; n<loops ; ++n )
+    {
+        state_type x = {{ 10.0 * rand()/RAND_MAX , 
+                          10.0 * rand()/RAND_MAX , 
+                          10.0 * rand()/RAND_MAX }};
+        double t = 0.0;
+
+        timer.restart();
+        for( size_t i=0 ; i<num_of_steps ; ++i, t+=dt )
+            rk4_odeint.do_step( lorenz , x , t , dt );
+        acc( timer.elapsed() );
+
+        clog.precision( 3 );
+        clog.width( 5 );
+        clog << acc << " " << x[0] << endl;
+    }
+    cout << acc << endl;
+    return 0;
+}
Added: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk54ck_def_alg.cpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/odeint_rk54ck_def_alg.cpp	2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
@@ -0,0 +1,86 @@
+/*
+ * odeint_rk54ck.cpp
+ *
+ *  Created on: Apr 29, 2011
+ *      Author: mario
+ */
+
+#include <iostream>
+#include <fstream>
+
+#include <boost/array.hpp>
+
+#include <boost/numeric/odeint/stepper/explicit_error_rk54_ck.hpp>
+#include <boost/numeric/odeint/algebra/array_algebra.hpp>
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/statistics.hpp>
+#include <boost/timer.hpp>
+
+#define tab "\t"
+
+using namespace std;
+using namespace boost::accumulators;
+
+typedef accumulator_set<
+    double , stats< tag::mean , tag::variance >
+    > accumulator_type;
+
+ostream& operator<<( ostream& out , accumulator_type &acc )
+{
+    out << boost::accumulators::mean( acc ) << tab;
+//    out << boost::accumulators::variance( acc ) << tab;
+    return out;
+}
+
+typedef boost::timer timer_type;
+
+
+typedef boost::array< double , 3 > state_type;
+typedef boost::numeric::odeint::explicit_error_rk54_ck< state_type > rk54_ck_odeint_type;
+
+
+inline void lorenz( const state_type &x , state_type &dxdt , const double t )
+{
+    const double sigma = 10.0;
+    const double R = 28.0;
+    const double b = 8.0 / 3.0;
+    dxdt[0] = sigma * ( x[1] - x[0] );
+    dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
+    dxdt[2] = x[0]*x[1] - b * x[2];
+}
+
+
+const size_t loops = 20;
+
+int main( int argc , char **argv )
+{
+    rk54_ck_odeint_type rk54_ck_odeint;
+
+    const size_t num_of_steps = 20000000;
+    const double dt = 1E-4;
+
+    accumulator_type acc;
+    timer_type timer;
+
+    srand( 12312354 );
+
+    for( size_t n=0 ; n<loops ; ++n )
+    {
+        state_type x = {{ 10.0 * rand()/RAND_MAX ,
+                          10.0 * rand()/RAND_MAX ,
+                          10.0 * rand()/RAND_MAX }};
+        state_type x_err;
+        double t = 0.0;
+
+        timer.restart();
+        for( size_t i=0 ; i<num_of_steps ; ++i, t+=dt )
+            rk54_ck_odeint.do_step( lorenz , x , t , dt , x_err );
+        acc( timer.elapsed() );
+
+        clog.precision( 15 );
+        clog.width( 20 );
+        clog << acc << " " << x[0] << tab << " " << x_err[0] << endl;
+    }
+    cout << acc << endl;
+    return 0;
+}
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/perf_tests.py
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/perf_tests.py	(original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/perf_tests.py	2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
@@ -1,11 +1,11 @@
 from os import popen
 from os.path import isfile
 
-#bin_path = "bin/gcc-4.4/release/"
-bin_path = "bin/intel-linux/release/"
+bin_path = "bin/gcc-4.4/release/"
+#bin_path = "bin/intel-linux/release/"
 
-bins = [ "odeint_rk4" , "generic_rk4" , "nr_rk4" , "gsl_rk4" , "rt_generic_rk4" , 
-		 "odeint_rk54ck" , "generic_rk54ck" , "gsl_rk54ck" ]
+bins = [ "odeint_rk4" , "odeint_rk4_def_alg" , "generic_rk4" , "nr_rk4" , "gsl_rk4" , "rt_generic_rk4" , 
+		 "odeint_rk54ck" , "odeint_rk54ck_def_alg" , "generic_rk54ck" , "gsl_rk54ck" ]
 results = []
 
 print "Performance tests for " , bin_path
Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/results.dat
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/results.dat	(original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/results.dat	2011-05-02 09:56:19 EDT (Mon, 02 May 2011)
@@ -1,26 +1,26 @@
 Results for Runge-Kutta 4 with different implementations and compilers
 
-            |   odeint  |   generic |   nr      |   gsl     |   rt gen  |
--------------------------------------------------------------------------
-gcc 4.5.0   |   0.78    |   0.76    |   0.80    |   1.07    |   1.08    |   Corei7 870 @ 2.93 GHz
-gcc 4.3.2   |   0.84    |   0.64    |   0.96    |   1.52    |   1.85    |   Core2Quad Q9550 @ 2.83 GHz
-icc 12.0.2  |   0.81    |   0.85    |   1.03    |   1.07    |   1.61    |   Corei7 870 @ 2.93 GHz
-icc 11.1    |   0.98    |   1.03    |   0.64    |   1.35    |   1.99    |   Xeon X5650   @ 2.67 GHz
-gcc 4.4.1   |   1.19    |   1.22    |   1.24    |   1.97    |           |   Core2Quad Q6600  @ 2.40GHz (to be repeated)
-msvc 9.0    |   5.84    |   6.30    |   5.55    |   ----    |   12.7    |   Via Nano @ 1.60 GHz (to be repeated)
-gcc 4.4.1	|	0.59 	|	0.56	|	0.64	|	1.61	|	1.85	|	PhenomII X4 945 @ 3 GHz
-icc 11.1	|	1.15	|	1.09	|	0.74	|	1.62	|	2.18	|	PhenomII X4 945 @ 3 GHz
+            |   odeint  |	def alg	|   generic |   nr      |   gsl     |   rt gen  |
+-------------------------------------------------------------------------------------
+gcc 4.5.0   |   0.78    |   		|	0.76    |   0.80    |   1.07    |   1.08    |   Corei7 870 @ 2.93 GHz
+gcc 4.3.2   |   0.84    |   		|	0.64    |   0.96    |   1.52    |   1.85    |   Core2Quad Q9550 @ 2.83 GHz
+icc 12.0.2  |   0.81    |   		|	0.85    |   1.03    |   1.07    |   1.61    |   Corei7 870 @ 2.93 GHz
+icc 11.1    |   0.98    |   		|	1.03    |   0.64    |   1.35    |   1.99    |   Xeon X5650   @ 2.67 GHz
+gcc 4.4.1   |   1.19    |   		|	1.22    |   1.24    |   1.97    |           |   Core2Quad Q6600  @ 2.40GHz (to be repeated)
+msvc 9.0    |   6.91    |   		|	7.28    |   5.59    |   ----    |   13.2    |   Via Nano @ 1.60 GHz
+gcc 4.4.1	|	0.59 	|	0.59	|	0.56	|	0.64	|	1.61	|	1.85	|	PhenomII X4 945 @ 3 GHz
+icc 11.1	|	1.15	|			|	1.09	|	0.74	|	1.62	|	2.18	|	PhenomII X4 945 @ 3 GHz
 
 
 Results for Runge-Kutta 54 Cash Karp
 
-            |   odeint  |   generic |   nr      |   gsl     |
--------------------------------------------------------------
-gcc 4.5.0   |   0.80    |   1.28    |           |   1.80    |   Corei7 870 @ 2.93 GHz
-gcc 4.3.2   |   1.41    |   1.27    |           |   3.80    |   Core2Quad Q9550 @ 2.83 GHz
-icc 12.0.2  |   1.41    |   2.03    |           |   1.86    |   Corei7 870 @ 2.93 GHz
-icc 11.1    |   1.90    |   2.40    |           |   2.20    |   Xeon X5650   @ 2.67 GHz
-gcc 4.4.1   |           |           |           |           |   Core2Quad Q6600  @ 2.40GHz
-msvc 9.0    |           |           |           |   ----    |   Via Nano @ 1.60 GHz
-gcc 4.4.1	|	1.11	|	1.15	|			|	2.63	|	PhenomII X4 945 @ 3 GHz
-icc 11.1	|	1.83	|	2.42	|			|	2.67	|	PhenomII X4 945 @ 3 GHz
\ No newline at end of file
+            |   odeint  |	def alg	|   generic |   nr      |   gsl     |
+-------------------------------------------------------------------------
+gcc 4.5.0   |   0.80    |			|   1.28    |           |   1.80    |   Corei7 870 @ 2.93 GHz
+gcc 4.3.2   |   1.41    |   		|	1.27    |           |   3.80    |   Core2Quad Q9550 @ 2.83 GHz
+icc 12.0.2  |   1.41    |   		|	2.03    |           |   1.86    |   Corei7 870 @ 2.93 GHz
+icc 11.1    |   1.90    |   		|	2.40    |           |   2.20    |   Xeon X5650   @ 2.67 GHz
+gcc 4.4.1   |           |           |			|           |           |   Core2Quad Q6600  @ 2.40GHz
+msvc 9.0    |   12.8    |   		|	15.4    |           |   ----    |   Via Nano @ 1.60 GHz
+gcc 4.4.1	|	1.06	|	1.05	|	1.15	|			|	2.63	|	PhenomII X4 945 @ 3 GHz
+icc 11.1	|	1.83	|			|	2.42	|			|	2.67	|	PhenomII X4 945 @ 3 GHz
\ No newline at end of file