How can I generate multicore load on Stata/MP?
Asked Answered
D

2

6

I'm working on monitoring CPU and memory usage of Stata/MP (the multicore version of Stata/SE) but I am not a Stata programmer (more of a Perl guy).

Can anyone post some code that utilizes a public data set to generate enough load on Stata/MP such that four CPU cores are utilized (or even maxed out) for several minutes or so?

If you can provide me with a .do file and a .dta file (or whatever I may need for this), I think I can take it from there. Thanks in advance!

Diogenes answered 3/3, 2011 at 15:51 Comment(1)
This question, because it does not deal with statistical analysis, is not really appropriate on the stats site. You would likely get a fast and authoritative answer from the Stata user's listserve at stata.com/statalist . In the meantime let's migrate it to the relevant Stack Exchange forum.Comedown
G
8

This should do it:

sysuse auto
expand 10000
bootstrap: logistic foreign price-gear_ratio
Gigot answered 3/3, 2011 at 16:11 Comment(0)
D
2
// Clear memory before each run
// http://www.stata.com/help.cgi?clear
clear all

// Allocate plenty of memory
// http://www.stata.com/help.cgi?memory
set memory 1024m

// Load data set: 1978 Automobile Data
// (Use "sysuse dir" to list other data sets)
// http://www.stata.com/help.cgi?sysuse
sysuse auto

// Duplicate observations
// http://www.stata.com/help.cgi?expand
expand 10000

// Bootstrap sampling and estimation
// http://www.stata.com/help.cgi?bootstrap
// Generate high load using example from bootstrap documentation
bootstrap: regress mpg weight gear foreign
// Generate even higher load and for a longer period
//bootstrap: logistic foreign price-gear_ratio

This answer is based on an earlier answer, but I added some comments, some setup, and an extra bootstrap command that generates less load. You can put this into a file called "load.do" and execute it in Stata with File -> Do. Click the Break button to stop execution.

Please feel free to merge this into the earlier answer if that is more appropriate.

Diogenes answered 3/3, 2011 at 17:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.