久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='yWFNU'><style id='yWFNU'><dir id='yWFNU'><q id='yWFNU'></q></dir></style></legend>

  • <tfoot id='yWFNU'></tfoot>
      <bdo id='yWFNU'></bdo><ul id='yWFNU'></ul>
        <i id='yWFNU'><tr id='yWFNU'><dt id='yWFNU'><q id='yWFNU'><span id='yWFNU'><b id='yWFNU'><form id='yWFNU'><ins id='yWFNU'></ins><ul id='yWFNU'></ul><sub id='yWFNU'></sub></form><legend id='yWFNU'></legend><bdo id='yWFNU'><pre id='yWFNU'><center id='yWFNU'></center></pre></bdo></b><th id='yWFNU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yWFNU'><tfoot id='yWFNU'></tfoot><dl id='yWFNU'><fieldset id='yWFNU'></fieldset></dl></div>
      1. <small id='yWFNU'></small><noframes id='yWFNU'>

        具有分布式集群的 Python 多處理

        Python Multiprocessing with Distributed Cluster(具有分布式集群的 Python 多處理)

        • <i id='Axhs9'><tr id='Axhs9'><dt id='Axhs9'><q id='Axhs9'><span id='Axhs9'><b id='Axhs9'><form id='Axhs9'><ins id='Axhs9'></ins><ul id='Axhs9'></ul><sub id='Axhs9'></sub></form><legend id='Axhs9'></legend><bdo id='Axhs9'><pre id='Axhs9'><center id='Axhs9'></center></pre></bdo></b><th id='Axhs9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Axhs9'><tfoot id='Axhs9'></tfoot><dl id='Axhs9'><fieldset id='Axhs9'></fieldset></dl></div>

          • <bdo id='Axhs9'></bdo><ul id='Axhs9'></ul>
            <tfoot id='Axhs9'></tfoot>
                <tbody id='Axhs9'></tbody>
            1. <legend id='Axhs9'><style id='Axhs9'><dir id='Axhs9'><q id='Axhs9'></q></dir></style></legend>

              <small id='Axhs9'></small><noframes id='Axhs9'>

                  本文介紹了具有分布式集群的 Python 多處理的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在尋找一個 python 包,它不僅可以在單臺計算機內的不同內核上進行多處理,而且還可以在分布在多臺機器上的集群中進行多處理.有很多不同的用于分布式計算的 Python 包,但大多數似乎都需要更改代碼才能運行(例如,表示對象位于遠程計算機上的前綴).具體來說,我想要盡可能接近多處理 pool.map 函數的東西.因此,例如,如果在一臺機器上,腳本是:

                  I am looking for a python package that can do multiprocessing not just across different cores within a single computer, but also with a cluster distributed across multiple machines. There are a lot of different python packages for distributed computing, but most seem to require a change in code to run (for example a prefix indicating that the object is on a remote machine). Specifically, I would like something as close as possible to the multiprocessing pool.map function. So, for example, if on a single machine the script is:

                  from multiprocessing import Pool
                  pool = Pool(processes = 8)
                  resultlist = pool.map(function, arglist)
                  

                  那么分布式集群的偽代碼將是:

                  Then the pseudocode for a distributed cluster would be:

                  from distprocess import Connect, Pool, Cluster
                  
                  pool1 = Pool(processes = 8)
                  c = Connect(ipaddress)
                  pool2 = c.Pool(processes = 4)
                  cluster = Cluster([pool1, pool2])
                  resultlist = cluster.map(function, arglist)
                  

                  推薦答案

                  如果你想要一個非常簡單的解決方案,沒有.

                  If you want a very easy solution, there isn't one.

                  但是,有一個解決方案具有 multiprocessing 接口 -- pathos -- 它能夠通過并行映射建立與遠程服務器的連接,并做多處理.

                  However, there is a solution that has the multiprocessing interface -- pathos -- which has the ability to establish connections to remote servers through a parallel map, and to do multiprocessing.

                  如果您想建立 ssh 隧道連接,您可以這樣做……或者如果您可以使用不太安全的方法,您也可以這樣做.

                  If you want to have a ssh-tunneled connection, you can do that… or if you are ok with a less secure method, you can do that too.

                  >>> # establish a ssh tunnel
                  >>> from pathos.core import connect
                  >>> tunnel = connect('remote.computer.com', port=1234)
                  >>> tunnel       
                  Tunnel('-q -N -L55774:remote.computer.com:1234 remote.computer.com')
                  >>> tunnel._lport
                  55774
                  >>> tunnel._rport
                  1234
                  >>> 
                  >>> # define some function to run in parallel
                  >>> def sleepy_squared(x):
                  ...   from time import sleep
                  ...   sleep(1.0)
                  ...   return x**2
                  ... 
                  >>> # build a pool of servers and execute the parallel map
                  >>> from pathos.pp import ParallelPythonPool as Pool
                  >>> p = Pool(8, servers=('localhost:55774',))
                  >>> p.servers
                  ('localhost:55774',)
                  >>> y = p.map(sleepy_squared, x)
                  >>> y
                  [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
                  

                  或者,您可以配置為直接連接(無 ssh)

                  Or, instead you could configure for a direct connection (no ssh)

                  >>> p = Pool(8, servers=('remote.computer.com:5678',))
                  # use an asynchronous parallel map
                  >>> res = p.amap(sleepy_squared, x)
                  >>> res.get()
                  [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
                  

                  這有點挑剔,要讓遠程服務器工作,你必須事先在指定端口啟動一個運行在 remote.computer.com 上的服務器——你必須確保本地主機和遠程主機上的設置都將允許直接連接或 ssh 隧道連接.另外,您需要在每個主機上運行相同版本的 pathospppathos 分支.此外,對于 ssh,您需要運行 ssh-agent 以允許使用 ssh 進行無密碼登錄.

                  It's all a bit finicky, for the remote server to work, you have to start a server running on remote.computer.com at the specified port beforehand -- and you have to make sure that both the settings on your localhost and the remote host are going to allow either the direct connection or the ssh-tunneled connection. Plus, you need to have the same version of pathos and of the pathos fork of pp running on each host. Also, for ssh, you need to have ssh-agent running to allow password-less login with ssh.

                  但是,希望一切正常……如果您的功能代碼可以使用 dill.source.importable 傳輸到遠程主機.

                  But then, hopefully it all works… if your function code can be transported over to the remote host with dill.source.importable.

                  僅供參考,pathos 早就應該發布了,基本上,在新的穩定版本被刪除之前,有一些錯誤和界面更改需要解決.

                  FYI, pathos is long overdue a release, and basically, there are a few bugs and interface changes that need to be resolved before a new stable release is cut.

                  這篇關于具有分布式集群的 Python 多處理的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What exactly is Python multiprocessing Module#39;s .join() Method Doing?(Python 多處理模塊的 .join() 方法到底在做什么?)
                  Passing multiple parameters to pool.map() function in Python(在 Python 中將多個參數傳遞給 pool.map() 函數)
                  multiprocessing.pool.MaybeEncodingError: #39;TypeError(quot;cannot serialize #39;_io.BufferedReader#39; objectquot;,)#39;(multiprocessing.pool.MaybeEncodingError: TypeError(cannot serialize _io.BufferedReader object,)) - IT屋-程序員軟件開
                  Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?(Python 多進程池.當其中一個工作進程確定不再需要完成工作時,如何退出腳本?) - IT屋-程序員
                  How do you pass a Queue reference to a function managed by pool.map_async()?(如何將隊列引用傳遞給 pool.map_async() 管理的函數?)
                  yet another confusion with multiprocessing error, #39;module#39; object has no attribute #39;f#39;(與多處理錯誤的另一個混淆,“模塊對象沒有屬性“f)
                  • <bdo id='UrpwS'></bdo><ul id='UrpwS'></ul>
                    <legend id='UrpwS'><style id='UrpwS'><dir id='UrpwS'><q id='UrpwS'></q></dir></style></legend>

                    <tfoot id='UrpwS'></tfoot>

                      <small id='UrpwS'></small><noframes id='UrpwS'>

                    1. <i id='UrpwS'><tr id='UrpwS'><dt id='UrpwS'><q id='UrpwS'><span id='UrpwS'><b id='UrpwS'><form id='UrpwS'><ins id='UrpwS'></ins><ul id='UrpwS'></ul><sub id='UrpwS'></sub></form><legend id='UrpwS'></legend><bdo id='UrpwS'><pre id='UrpwS'><center id='UrpwS'></center></pre></bdo></b><th id='UrpwS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UrpwS'><tfoot id='UrpwS'></tfoot><dl id='UrpwS'><fieldset id='UrpwS'></fieldset></dl></div>

                        <tbody id='UrpwS'></tbody>

                          • 主站蜘蛛池模板: 草樱av| 亚洲欧美中文日韩在线v日本 | 一区欧美| 亚洲日本三级 | 欧美色性| 亚洲天堂男人的天堂 | 一区视频在线 | 激情五月婷婷综合 | 久久久久国产精品午夜一区 | 亚洲欧美一区二区三区国产精品 | 伊人伊人 | 中文字幕在线一区 | 成人影院免费视频 | 国产 日韩 欧美 在线 | 亚洲精品一区二区三区在线观看 | 亚洲激情av| 91亚洲精品国偷拍自产在线观看 | 久久精品国产清自在天天线 | 久久99国产精品 | 一区二区不卡视频 | 91色在线 | 狠狠干影院 | 日韩电影免费观看中文字幕 | 国产色| 日韩欧美一区在线 | 伊人网国产 | 欧美视频免费在线 | 福利色导航 | 91精品国产91久久综合桃花 | 欧美a√ | 日韩不卡视频在线 | 国产69精品久久久久777 | 国产精品久久久久久福利一牛影视 | 黄网站免费观看 | 欧美一级在线免费观看 | 精品无码久久久久久久动漫 | 亚洲成人一区二区 | 亚洲成人久久久 | 久草精品视频 | 久久99精品久久久久婷婷 | 国产精品高清在线 |