[問題] snow 結束運算輸出Summary File

作者: h310713 (虎虎虎)   2016-05-17 23:21:16
[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
使用者(已經有用R 做過不少作品)
[問題敘述]:
各位好,目前想將自己所解的程式,運算完後輸出一個summay的檔案
所使用的平行運算套件為Snow套件。
目前所遭遇的問題有兩個,分別敘述如下:
1.在平行運算的時候,想要印出 iterations 的進度
ex. 總共做 10 次運算,印出 1/10,2/10...這樣的輸出掌握運算進度
請問這該如何改寫?
2.在平行運算之後,該如何印出每一次iterations所得到的summary?
ex.
Iteration 1: A B C
Iteration 2: B C D
Iteration 3: E G I
##################################
運算結束後
輸出一個Summary File
1.A B C
2.B C D
3.E G I
這樣子的一個檔案
請問該如何改寫?
[程式範例]:
在此我提供兩個程式碼
1.寫好的for loop 運算,並未使用平行運算,可以順利輸出summary file
& Iteration number
Link:http://ideone.com/5AT7l6
2.加入平行運算之後,並未成功輸出 summary file & print out iteration number
Link:http://ideone.com/QUIfoF
請各位指導一下該如何改寫,謝謝各位的指導,如果需要任何資訊
請讓我知道
謝謝
[環境敘述]:
> R.version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 2.3
year 2015
month 12
day 10
svn rev 69752
language R
version.string R version 3.2.3 (2015-12-10)
nickname Wooden Christmas-Tree
[關鍵字]:
Data.table,dplry,snow
作者: cywhale (cywhale)   2016-05-18 01:39:00
outDF <- rbindlist(parLapply(clus,1:L, function(x,dt) {.. dt<-rbindlist(list(dt,..))}, dt=summaryDF))then outDF is your summary output (ps: here functionis ur clusterfunction, but pass initial summaryDF asan argument (So no need to clusterExport it again)
作者: h310713 (虎虎虎)   2016-05-18 13:12:00
Thanks for you reply, but can you teach me in detailprocess ? I tried the way you replied, but didnt work. Error information is : have no object summaryDF. Thanks

Links booklink

Contact Us: admin [ a t ] ucptt.com