簡體   English   中英

通過 ssh 在幾台 Windows 計算機上的 python 中的並行處理

[英]Parallel processing in python on several Windows computers through ssh

我曾經通過 SSH 跨多台 Windows 計算機在 R 中進行並行處理:

# Assume there are two computers, pc1 and pc2, both accessible by 
# user1 through SSH from the master computer, master_pc.
hosts <- list(list(host = "pc1", user = "user1"), list(host = "pc2", user = "user1"))
my_cl <- parallel::makeCluster(type   = 'PSOCK',
                               master = "master_pc",
                               spec   = hosts)
# Calls to functions from the parallel package that use the cluster my_cl

我知道 Linux 計算機中的 fork 是一種更好的方法,但是這些計算機必須運行 Windows ,所以襪子是我唯一的選擇。

我將在這些計算機上做一些 Python 中的並行處理任務。 我可以做一些像上面 Python 中的方法一樣簡單的事情嗎?

我檢查了一下, parallel-ssh似乎是我需要的。 但是,PyPI 的版本最后一次更新是在 2018 年 11 月 我不確定使用這個 package 編寫代碼是否安全。 我搜索了互聯網,但我發現的大多數解決方案都是針對 Linux 計算機,或單機並行處理。

我會建議你使用Dask設置集群。 我在我的一個項目中使用過它,它的效果非常棒。 您也可以使用SSH進行集群設置,或者選擇適合您要求的集群。 請從官方文檔中找到程序

希望能幫助到你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM