After helping my son upgrade his gaming machine, I decided it was time to upgrade my 8-year old desktop. I wanted to see how my new computer compares to my existing one, so I wrote a program implementing 10 commands (10 times each). I'm presently running Stata 15 MP(4), so for comparison purposes I chose 5 commands that scale 1:1 with the number of cores and 5 commands that do not scale at all by cores (according to Stata's analysis). I'm curious if anyone has any better ideas.
It was an interesting project, and unfortunately I don't have Stata 15 SE running (though I'm thinking about installing it since I have it, just for the test). I have Stata 13SE on my desktop, so I ran it in that version as well. Here's the code and the results.
I first create 4 random variables (X's; 500,000 obs) and then create a Y based on the X's and a random disturbance. I also create a Z variable of 50 observations to conduct a time series model. And, I create a 500x500 matrix to run a matrix command. I run each command 10 times to get a distribution, since at times I experienced some outliers for some commands (though not so much now). I think the median is probably the best indicator, since the mean can be affected by the outliers.
COMPUTER: I7-870 (4 cores; no overclock); Sandisk 512gb SSD; 32GB Ram (DDR3); Video AMD HD 5770 (a pair in SLI for a 4-monitor rig).
My upgrade includes a Ryzen 2700X processor (8 core), an Adata NVMe drive, and 32GB ram (DDR4). Same video cards (I don't game).
Thoughts welcome.
***********************************************
clear all
set obs 500000
/************************************************** ***************************/
/***** CREATE A DATASET *******************************************/
/************************************************** ***************************/
forv i = 1(1)4 {
qui g x`i' = rnormal()
}
*For Time Series Operations
qui g t = _n
tsset t
qui g z = 0.9*l.x2 + rnormal() if t<=51
*For matrix calculations
mata
M = rnormal(500,500,0,1)
st_matrix("M2",M)
end
/************************************************** ***************************/
/***** CREATE A STORE MATRIX *******************************************/
/************************************************** ***************************/
mata: st_matrix("R" , J(10,10,0))
matrix colnames R = replace correl regress predict bootstrap ///
mvtest xtile expand_drop arfima eigenv
/************************************************** ***************************/
/***** TIMER PROGRAMS *******************************************/
/************************************************** ***************************/
capture program drop tstart
program tstart, rclass
timer clear 1
timer on 1
end
capture program drop tend
program tend, rclass
timer off 1
qui timer list 1
scalar r = r(t1)
end
/************************************************** ***************************/
/***** PROPORTIONAL TO CORES *******************************************/
/************************************************** ***************************/
qui g y = 0
qui g yt = 0
*replace
forv i = 1(1)10 {
qui replace yt = 1 + 0.1*x1 -0.25*x2 + 0.4*x3 -0.15*x4 + rnormal()
tstart
qui replace y = yt
tend
matrix R[`i',1] = scalar(r)
tstart
qui correl y x1 x2 x3 x4
tend
matrix R[`i',2] = scalar(r)
*regress
qui reg y x1 x2 x3 x4 // first time is always very slow
tstart
qui reg y x1 x2 x3 x4
tend
matrix R[`i',3] = scalar(r)
*predict
tstart
qui predict cooksd, cooksd
tend
drop cooksd
matrix R[`i',4] = scalar(r)
*bootstrap
tstart
qui bootstrap , reps(25): reg y x1 x2 x3 x4
tend
matrix R[`i',5] = scalar(r)
}
/************************************************** ***************************/
/***** MULTICORE HAS NO EFFECT *****************************************/
/************************************************** ***************************/
forv i = 1(1)10 {
*mvtest normality
tstart
qui mvtest normality y x1
tend
matrix R[`i',6] = scalar(r)
*xtile
tstart
qui xtile tempv = y , nq(4)
tend
capture drop tempv
matrix R[`i',7] = scalar(r)
* expand, drop if
tstart
qui expand 2 , g(ex)
qui drop if ex==1
tend
capture drop ex
matrix R[`i',8] = scalar(r)
*arfima
tstart
qui arfima z
tend
matrix R[`i',9] = scalar(r)
*matrix eigenvalues
tstart
qui matrix eigenvalues re im = M2
tend
matrix R[`i',10] = scalar(r)
}
/************************************************** ***************************/
/***** SUMMARIZE RESULTS *****************************************/
/************************************************** ***************************/
svmat R , names(col)
summ replace regress predict correl bootstrap mvtest xtile expand_drop arfima eigenv
tabstat replace regress predict correl bootstrap ///
mvtest xtile expand_drop arfima eigenv , stats(median mean sd min max) columns(s) Array
Related Posts with Benchmarking Stata to Test Speed Across Computers and Versions
Simulation fails when global macro is calledHello everyone, I am trying to implement a simulation and face an error message. Apparently it has …
Two way area - lines get "thin" as they move upExample code: Code: set obs 200 gen indicator = uniform()<=0.5 gen y = _n twoway (area indicator…
Probability distribution histogram - binomialHello, In case of binomial probability, where n = 100 and p= 0.6. I would like to compute binomial p…
Need help in coding (Factorial Survey Method)Hello everyone. This is my first post in this forum. I am having a problem running the code for a re…
Random Stata glitchesI'm working with a dataset of ~1000 variables and ~5000 observations. Whenever I try to do my analys…
Subscribe to:
Post Comments (Atom)
0 Response to Benchmarking Stata to Test Speed Across Computers and Versions
Post a Comment