[問題] 無法使用平行運算makeCluster()

看板DataScience作者 (劉A.y)時間5年前 (2019/04/26 02:13), 編輯推噓2(203)
留言5則, 2人參與, 5年前最新討論串1/1
大家好,我大部分是使用R作統計運算,約有使用兩年的經驗,想請教有 關無法使用makeCluster()的問題,在之前有在其他電腦使用過程式是沒 有問題的,但是這台工作用的windows 10 桌電(去年才買)卻無法使用, 有點不知道怎麼解決,想請教大家有沒有什麼建議,或有遇過類似事情 的經歷 我是執行以下的程式 library(parallel) myCoreNums <- detectCores() cl <- makeCluster(myCoreNums -1) 但是我的電腦卻執行一整天都還卡在makeCluster()的地方,非常奇怪, 我就手動中斷了R,於是我也試過了cl <- makeCluster(2) 但也卡了很 久,覺得不太尋常。後來用這個方式,出現以下的訊息 cl <- future::makeClusterPSOCK(1L, verbose = TRUE, outfile = NULL) ----------以下為error code 的訊息----------------------- > cl <- future::makeClusterPSOCK(1L, verbose = TRUE, outfile = NULL) [local output] Workers: [n = 1] ‘localhost’ [local output] Base port: 11234 [local output] Creating node 1 of 1 ... [local output] - setting up node Testing if worker's PID can be inferred: ‘C:/PROGRA~1/R/R-35~1.3/ bin/x64/Rscript -e "try(cat(Sys.getpid(),file=\"C:/Users/xxxxx/ AppData/Local/Temp/RtmpsVKdaV/future.parent=20556.504c2b692669.p id\"), silent = TRUE)" -e "file.exists(\"C:/Users/xxxxx/AppData/ Local/Temp/RtmpsVKdaV/future.parent=20556.504c2b692669.pid\")"’ - Possible to infer worker's PID: FALSE [local output] Starting worker #1 on ‘localhost’: "C:/PROGRA~1 /R/R-35~1.3/bin/x64/Rscript" --default-packages=datasets,utils, grDevices,graphics,stats,methods -e "parallel:::.slaveRSOCK()" MASTER=localhost PORT=11234 OUT= TIMEOUT=2592000 XDR=TRUE [local output] - Exit code of system() call: 0 [local output] Waiting for worker #1 on ‘localhost’ to connect back [local output] - Detected 'outfile=NULL' on Windows: this will make the output from the background worker visible when running R from a terminal, but it will most likely not be visible when using a GUI. Error in socketConnection("localhost", port = port, server = TRUE, blocking = TRUE, : Failed to launch and connect to R worker on local machine ‘localhost’ from local machine ‘DESKTOP-OUUF46V’. * The error produced by socketConnection() was: ‘reached elapsed time limit’ (which suggests that the connection timeout of 120 seconds (argument 'connectTimeout') kicked in) * The localhost socket connection that failed to connect to the R worker used port 11234 using a communication timeout of 2592000 seconds and a connection timeout of 120 seconds. * Worker launch call: "C:/PROGRA~1/R/R-35~1.3/bin/x64/Rscript" --default- packages=datasets,utils,grDevices,graphics,stats,methods -e "parallel:::.slaveRSOCK()" MASTER=localhost PORT=11234 OUT= TIMEOUT=2592000 XDR=TRUE. * Failed to kill local worker because it's PID is could not be identified. * Troubleshooting suggestions: - Suggestion #1: On Windows, to see output from worker, set 'outfile=NULL' and run R from a terminal (not a GUI). In addition: Warning message: In system(test_cmd, intern = TRUE, input = input) : running command 'C:/PROGRA~1/R/R-35~1.3/bin/x64/Rscript -e "try(cat (Sys.getpid(),file=\"C:/Users/xxxxx/AppData/Local/Temp/RtmpsVKdaV/future.parent=20556 .504c2b692669.pid\"), silent = TRUE)" -e "file.exists(\"C:/Users/xxxxx/AppData/Local /Temp/RtmpsVKdaV/future.parent=20556.504c2b692669.pid\")"' had status 1 > ------------------------------------------------------------ 我也查了一下網路上相關資料,只有一個提到可能是跟防火牆有關,我也曾經關掉防火牆 (https://support.microsoft.com/zh-tw/help/4028544/windows-10-turn-windows-defender-firewall-on-or-off) 再執行一次,但是也同樣不行,有點不是很清楚該怎麼修復這樣的情形, 想請教版上的大家有沒有什麼方法或建議可以解決了,謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.162.144.7 ※ 文章網址: https://www.ptt.cc/bbs/DataScience/M.1556215986.A.F08.html

04/27 12:43, 5年前 , 1F
或許防火牆沒關乾淨吧,如果在學校公司,也要注意他們的防
04/27 12:43, 1F

04/27 12:43, 5年前 , 2F
火牆
04/27 12:43, 2F

04/27 13:30, 5年前 , 3F
按照他說的trouble shoot走看看
04/27 13:30, 3F

04/27 13:30, 5年前 , 4F
從cmd跑makeCluster 設output = null
04/27 13:30, 4F

04/27 13:31, 5年前 , 5F
*outfile=NULL
04/27 13:31, 5F
文章代碼(AID): #1SmVYoy8 (DataScience)
文章代碼(AID): #1SmVYoy8 (DataScience)