Dear Stata users,
Here are the contents of the do files:
*<------------------- looptest.do -------------------------->
version 9
mata:
void looptest(numeric scalar runs, numeric scalar nsize)
{
real scalar i
real matrix a, b
for(i=1; i<=runs; i++){
a=uniform(nsize,nsize)
b=uniform(nsize,1)
b=qrsolve(a,b)
}
}
mata mosave looptest(), dir(PERSONAL) replace
end
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*<------------------- benchmark.do ------------------------->
log using benchmark.smcl, replace
local st = "$S_TIME"
mata: looptest(10,1000) /*10 regression repetitions, 1000x1000 (Nxk X
matrix)*/
elapse `st'
local st = "$S_TIME"
mata: looptest(100,1000) /*100 regression repetitions, 1000x1000 (Nxk X
matrix)*/
elapse `st'
local st = "$S_TIME"
mata: looptest(100,100) /*100 regression repetitions, 100x100 (Nxk X
matrix)*/
elapse `st'
local st = "$S_TIME"
mata: looptest(1000,100) /*1000 regression repetitions, 100x100 (Nxk X
matrix)*/
elapse `st'
log close
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-alfons
>The first benchmark randomly draws Y vector and X matrix from a uniform
>distribution, and then uses the QR decomposition to solve for the
>generalised least square of Y on X.
>Four tests were conducted depending on the size of X and Y and
>the number of repetitions.
>Test 1: Repetitions= 10, Y= [1000 x 1], X=[1000x1000]
>Test 2: Repetitions= 100, Y= [1000 x 1], X=[1000x1000]
>Test 3: Repetitions= 100, Y= [ 100 x 1], X=[ 100x 100]
>Test 3: Repetitions=1000, Y= [ 100 x 1], X=[ 100x 100]
>The "synthetic" results are:
>PC (CPU, Speed, Memory, OS, Stata Version) Time (minutes:seconds)
> Test1 Test2 Test3
Test4
>---------------------------------------------------------------------------
>Athlon 64 FX/55, 2.6GHz, 3.0GB, Windows X64, SE/9/64, 0:18, 3:09, 0:0,
0:3
>Athlon 64 FX/55, 2.6GHz, 3.0GB, Windows XP, SE/9/32, 0:21, 3:27, 0:0,
0:4
>Pentium 4, 3.0GHz, 2.0GB, Windows XP, SE/9/32, 0:24, 3:57, 0:1,
0:4
>Athlon 64 FX/55, 2.6GHz, 3.0GB, SUSE Linux64,SE/9/64, 0:45, 7:45, 0:0,
0:6
<snip>
>Also, if anyone knows any idea why my linux results are very slow (even
>when run in a batch mode)?
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/