$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [ublas] Product of two matrices is very slow
From: zdespot (zdespot_at_[hidden])
Date: 2009-06-16 03:02:09
Jesse Manning schrieb:
> For a comparison I ran your code using msvc 2003
>
> I ran each test 10 times and averaged the time.
>
> Debug mode: 6.1 seconds
> Release mode: 10 milliseconds
>
> Based on my timing there is definitely something not right about your 
> setup. If you go to the project properites->c/c++->preprocessor page
> the preprocessor define for NDEBUG should automatically be defined in 
> Release mode and not defined in Debug mode. And if it is not you can 
> add it here instead of in your code file.
>
> Make sure you are doing your timing analysis with code built in 
> Release mode it makes a huge difference.
>
> namespace ublas = boost::numeric::ublas;
>
> #include <windows.h>
> int main()
> {
>     int ntime=0;
>     LARGE_INTEGER ntime1;
>     LARGE_INTEGER ntime2;
>     LARGE_INTEGER freq;
>     QueryPerformanceFrequency(&freq);
>     QueryPerformanceCounter(&ntime1);
>
>     ublas::matrix<double> m1(600,100);
>     ublas::matrix<double> m2(100,100);
>     ublas::matrix<double> r(600,100);
>     noalias(r) = prod(m1,m2);
>
>     QueryPerformanceCounter(&ntime2);
>     ntime = 
> static_cast<int>((ntime2.QuadPart-ntime1.QuadPart)/(freq.QuadPart/1000));
>     std::cout << "Matrix mult. took " << ntime << " ms" << std::endl;
>
>     return 0;
> }
>
>
> On Mon, Jun 15, 2009 at 8:36 AM, zdespot <zdespot_at_[hidden] 
> <mailto:zdespot_at_[hidden]>> wrote:
>
>     Maik Beckmann schrieb:
>>     zdespot schrieb am Montag 15 Juni 2009 um 13:07:
>>
>>       
>>>     #include <boost/numeric/ublas/matrix.hpp>
>>>     using namespace boost;
>>>     using namespace boost::numeric;
>>>
>>>     #define BOOST_UBLAS_CHECK_FALSE
>>>     #define NDEBUG
>>>     int main(int,char*[])
>>>     {
>>>         ublas::matrix<double> m1(600,100);
>>>         ublas::matrix<double> m2(100,100);
>>>         ublas::matrix<double> r(600,100);
>>>         noalias(r) = prod(m1,m2);
>>>     }
>>>
>>>         
>>     You have to place the #define statements _before_ the #include
>>     statements. -- Maik
>>     _______________________________________________ ublas mailing
>>     list ublas_at_[hidden] <mailto:ublas_at_[hidden]>
>>     http://listarchives.boost.org/mailman/listinfo.cgi/ublas
>>
>>     Sent to: zdespot_at_[hidden] <mailto:zdespot_at_[hidden]>
>>
>>       
>     Hi Maik
>
>     Thanks for the prompt answer. I changed the postion and rebuilt
>     it, but it is still slow.
>
>     Zoran
>
>
>     _______________________________________________
>     ublas mailing list
>     ublas_at_[hidden] <mailto:ublas_at_[hidden]>
>     http://listarchives.boost.org/mailman/listinfo.cgi/ublas
>     Sent to: manning.jesse_at_[hidden] <mailto:manning.jesse_at_[hidden]>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://listarchives.boost.org/mailman/listinfo.cgi/ublas
> Sent to: zdespot_at_[hidden]
Hallo Jesse
As you have said I have checked the properties for C++ -> Preprocessor 
and changed to Release. Now the prod is very fast!
Thanks to both of you (Maik) for fast response and help.
Best Regards
Zoran