如何在Stata / MP上生成多核负载?

时间:2011-03-03 15:51:18

标签: stata

我正在研究监控Stata / MP(Stata / SE的多核版本)的CPU和内存使用情况,但我不是Stata程序员(更多的是Perl人)。

任何人都可以发布一些使用公共数据集的代码,以便在Stata / MP上产生足够的负载,这样四个CPU内核可以使用(甚至超出)几分钟左右吗?

如果你能提供.do文件和.dta文件(或者我可能需要的任何文件),我想我可以从那里拿走它。提前谢谢!

2 个答案:

答案 0 :(得分:7)

这应该这样做:

sysuse auto
expand 10000
bootstrap: logistic foreign price-gear_ratio

答案 1 :(得分: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

这个答案基于earlier answer,但我添加了一些注释,一些设置以及一个产生较少负载的额外引导命令。您可以将其放入名为“load.do”的文件中,然后在Stata with File - >中执行它。做。单击“中断”按钮以停止执行。

如果更合适,请随意将其合并到之前的答案中。