The timer() function seems to miswork on multi-core systems. Run the two scri
Reported by Michael BAUDIN
-- Bug description --
The timer() function seems to miswork on multi-core systems.
Run the two scripts below on a multi-core system.
On a 4 CPU Windows with Intel MKL, I get :
7.7376496 // with timer
2.043 // with toc
This might be caused because timer measure the sum of the CPU times on all the cores. The following script sets in numofcores the number of cores on the machine. We may divide the result of timer by this numofcores to get consistent results.
a=getdebuginfo();k=grep(a,"Number of processors");a=strsplit(a(k),":");numofcores=evstr(a(2))
To sum this up:
* either the implementation of timer must divide by the number of cores,
* or the help page of timer should be updated to warn against this topic.
-- Scilab error message --
-- How to reproduce the bug --
// With timer()
stacksize("max");
rand( "normal" );
n = 3000;
A = rand(n,n);
B = rand(n,n);
timer();
C = A * B;
t = timer()
// With tic()/toc()
stacksize("max");
rand( "normal" );
n = 3000;
A = rand(n,n);
B = rand(n,n);
tic();
C = A * B;
t = toc()