2011-03-03 245 views
4

我正在監測Stata/MP(Stata/SE的多核版本)的CPU和內存使用情況,但我不是一個Stata程序員(更多的是Perl人員)。如何在Stata/MP上生成多核負載?

任何人都可以發佈一些代碼,利用公共數據集在Stata/MP上產生足夠的負載,使四個CPU內核在幾分鐘左右被利用(甚至超出)?

如果您可以提供給我一個.do文件和一個.dta文件(或者我可能需要的任何文件),我想我可以從那裏獲取它。提前致謝!

+2

這個問題,因爲它不處理統計分析,在統計數據網站上並不合適。您可能會從Stata用戶的列表中獲得一份快速和權威的答案,網址爲http://www.stata.com/statalist/。在此期間,我們將它遷移到相關的Stack Exchange論壇。 – 2011-03-03 16:02:52

回答

7

這應做到:

sysuse auto 
expand 10000 
bootstrap: logistic foreign price-gear_ratio 
+0

非常感謝!太棒了! – 2011-03-03 17:43:24

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」的文件中,並用File - > Do在Stata中執行它。單擊Break按鈕停止執行。

如果更合適,請隨時將其合併到較早的答案中。