开发者

How can I generate multicore load on Stata/MP?

开发者 https://www.devze.com 2023-02-14 10:22 出处:网络
I\'m working on monitoring CPU and memory usage of Stata/MP (the multicore version of S开发者_JS百科tata/SE) but I am not a Stata programmer (more of a Perl guy).

I'm working on monitoring CPU and memory usage of Stata/MP (the multicore version of S开发者_JS百科tata/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!


This should do it:

sysuse auto
expand 10000
bootstrap: logistic foreign price-gear_ratio


// 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消