Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-06-16 15:24:13


Am Montag, 13. Juni 2005 15:43 schrieb christopher diggins:
> Here are my benchmark results:
>
> boost ublas performance, rows = 3, cols = 3, iters = 100000
> benchmarking element_access(m1) 406 msec elapsed
> benchmarking matrix_copy(m1, m2) 31 msec elapsed
> benchmarking scalar_arithmetic(m1) 266 msec elapsed
> benchmarking matrix_arithmetic(m1, m2) 2407 msec elapsed
> benchmarking multiply(m1, m2, m3) 234 msec elapsed
>
> boost ublas performance, rows = 100, cols = 100, iters = 100
> benchmarking element_access(m1) 390 msec elapsed
> benchmarking matrix_copy(m1, m2) 0 msec elapsed
> benchmarking scalar_arithmetic(m1) 266 msec elapsed
> benchmarking matrix_arithmetic(m1, m2) 796 msec elapsed
> benchmarking multiply(m1, m2, m3) 3828 msec elapsed

after fixing some lines I get
g++ -I $HOME/include -o cookbook cookbook.cpp -DNDEBUG -O3

$ ./cookbook
boost ublas performance, rows = 3, cols = 3, iters = 1000000
benchmarking boost_element_access(m1) 130 msec elapsed
benchmarking matrix_copy(m1, m2) 70 msec elapsed
benchmarking scalar_arithmetic(m1) 580 msec elapsed
benchmarking matrix_arithmetic(m1, m2) 1110 msec elapsed
(axpy) benchmarking boost_multiply(m1, m2, m3) 120 msec elapsed
(prod) benchmarking boost_multiply(m1, m2, m3) 110 msec elapsed
boost ublas performance, rows = 100, cols = 100, iters = 1000
benchmarking boost_element_access(m1) 130 msec elapsed
benchmarking matrix_copy(m1, m2) 10 msec elapsed
benchmarking scalar_arithmetic(m1) 580 msec elapsed
benchmarking matrix_arithmetic(m1, m2) 830 msec elapsed
(axpy) benchmarking boost_multiply(m1, m2, m3) 3000 msec elapsed
(prod) benchmarking boost_multiply(m1, m2, m3) 2620 msec elapsed

dynamic matrix performance, rows = 3, cols = 3, iters = 1000000
benchmarking matrix_element_access(m1) 90 msec elapsed
benchmarking matrix_copy(m1, m2) 70 msec elapsed
benchmarking scalar_arithmetic(m1) 430 msec elapsed
benchmarking matrix_arithmetic(m1, m2) 100 msec elapsed
benchmarking matrix_multiply(m1, m2, m3) 50 msec elapsed
dynamic matrix performance, rows = 100, cols = 100, iters = 1000
benchmarking matrix_element_access(m1) 90 msec elapsed
benchmarking matrix_copy(m1, m2) 20 msec elapsed
benchmarking scalar_arithmetic(m1) 330 msec elapsed
benchmarking matrix_arithmetic(m1, m2) 70 msec elapsed
benchmarking matrix_multiply(m1, m2, m3) 1480 msec elapsed

k-matrix performance, rows = 3, cols = 3, iters = 1000000
benchmarking kmatrix_element_access(m1) 20 msec elapsed
benchmarking matrix_copy(m1, m2) 60 msec elapsed
benchmarking scalar_arithmetic(m1) 300 msec elapsed
benchmarking matrix_arithmetic(m1, m2) 40 msec elapsed
benchmarking kmatrix_multiply(m1, m2, m3) 30 msec elapsed
k-matrix performance, rows = 100, cols = 100, iters = 1000
benchmarking kmatrix_element_access(m1) 10 msec elapsed
benchmarking matrix_copy(m1, m2) 20 msec elapsed
benchmarking scalar_arithmetic(m1) 320 msec elapsed
benchmarking matrix_arithmetic(m1, m2) 60 msec elapsed
benchmarking kmatrix_multiply(m1, m2, m3) 440 msec elapsed

> m[i][j] = 0;
I changed this to m(i,j) because that is as intuitive as m[i][j].

uBLAS is surprisingly slow ...

mfg
Gunter