4
64 코어를 가진 x86_64-redhat-linux-gnu 머신에서 R (버전 2.15)의 부트 스트랩 연습을 위해 아래의 코드 스 니펫을 실행할 때 관찰 된 계산 시간은 4 코어 이상을 사용한 후에 저하 된 것으로 보입니다. R이 4 개 이상의 코어를 사용하는 데 필요한 추가 구성 변경 사항이 있습니까?R의이 부트 스트랩 모델에서 4 개 이상의 코어를 사용할 때 계산 시간이 늘어나는 이유는 무엇입니까?
library(doMC)
library(plyr)
df <- empty <- data.frame(cores = numeric(), trial = numeric(), time = numeric())
for(i in 1:64){
registerDoMC(cores=i)
trials <- 1000
stime <- system.time({
r <- foreach(icount(trials), .combine=cbind) %dopar% {
ind <- sample(1000000, 1000000, replace=TRUE)
mean(ind)}})
df<- rbind(df, data.frame(cores=i,trial=1,time=stime[3]))
}
df2 <- ddply(df, c("cores"), summarize, time_avg = mean(time))
다음은 코어 수별 처리 시간입니다.
num_cores time(seconds)
1 16.544
2 8.198
3 5.627
4 4.313
5 7.045
6 8.898
7 10.412
8 11.539
9 12.382
10 13.329
11 13.786
12 14.375
13 14.977
14 15.095
15 14.984
16 15.393
17 15.728
18 15.983
19 16.039
20 15.947
21 16.101
22 16.365
23 16.549
24 16.687
25 17.022
26 17.116
27 17.212
28 17.548
29 17.605
30 17.672
31 18.067
32 18.158
33 16.884
34 17.2
35 17.167
36 17.178
37 17.516
38 17.425
39 17.449
40 17.845
41 17.758
42 17.74
43 18.093
44 14.481
45 14.25
46 18.441
47 18.294
48 18.311
49 18.694
50 18.692
51 15.936
52 16.495
53 16.512
54 18.627
55 19.019
56 18.631
57 13.916
58 19.227
59 19.225
60 13.606
61 18.029
62 19.392
63 19.378
64 19.753
1k 시도에서 말하면 100k로 변경하면 어떻게됩니까? –
이 게시물은 관련이있을 수 있습니다 : http://stackoverflow.com/questions/14614306/why-is-the-parallel-package-slower-than-just-using-apply/14614734#14614734 – Arun
어때 http : // stackoverflow 어때? .com/questions/3547831/different-behaviour-use-different-number of multicoring-workers? 당신은 당신보다 많은 코어를 사용할 수 없습니다. –