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

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

    1. <tfoot id='cNFxp'></tfoot>
      <legend id='cNFxp'><style id='cNFxp'><dir id='cNFxp'><q id='cNFxp'></q></dir></style></legend>
          <bdo id='cNFxp'></bdo><ul id='cNFxp'></ul>

      1. <small id='cNFxp'></small><noframes id='cNFxp'>

        我可以從 multiprocessing.Process 中獲得返回值嗎?

        Can I get a return value from multiprocessing.Process?(我可以從 multiprocessing.Process 中獲得返回值嗎?)
      2. <tfoot id='qtYKO'></tfoot>

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

            <bdo id='qtYKO'></bdo><ul id='qtYKO'></ul>
              <tbody id='qtYKO'></tbody>

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

                • <legend id='qtYKO'><style id='qtYKO'><dir id='qtYKO'><q id='qtYKO'></q></dir></style></legend>
                  本文介紹了我可以從 multiprocessing.Process 中獲得返回值嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我使用 Python 多處理模塊在 Monte Carlo 代碼中實現了一些簡單的并行性.我的代碼如下所示:

                  I've implemented some simple parallelism in a Monte Carlo code using the Python multiprocessing module. I have code that looks like:

                  montecarlos = [MonteCarlo(f,fargs) for fargs in farglist]
                  jobs = [multiprocessing.Process(mc) for mc in montecarlos]
                  for job in jobs: job.start()
                  for job in jobs: job.join()
                  results = [mc.results for mc in montecarlos]
                  

                  但是,當我查看結果列表時,似乎蒙特卡羅迭代器甚至還沒有啟動.我知道他們有,因為我可以讓流程在蒙特卡羅步驟中打印出信息.所以我在做一些愚蠢的事情.我原以為 job.join() 會阻止結果列表的構建,直到一切都運行完畢,因此 mc.results 字段將被更新.

                  However, when I look at the results list, it looks like the monte carlo iterators haven't even started. I know that they have, because I can have the processes print out information during the monte carlo steps. So I'm doing something dumb. I had thought the job.join() would keep the results list from being constructed until everything had run, and thus the mc.results field would be updated.

                  我意識到我沒有告訴你我的 monte carlo 例程的詳細信息,希望這沒關系,我犯的錯誤在于我對多處理功能的解釋.提前感謝您提供的任何幫助.

                  I realize I haven't told you the details of my monte carlo routine, and hope that it doesn't matter, and that the mistake I'm making is in my interpretation of what multiprocessing does. Thanks in advance for any help you can offer.

                  推薦答案

                  MonteCarlo 對象已被腌制并發送到要運行的子進程 - .results 屬性在此過程中未填充,因為本地 mc 從未運行過.

                  The MonteCarlo objects have been pickled and sent to child processes to be run - the .results attribute in this process isn't populated because the local mc has never been run.

                  如果你創建一個multiprocessing.Queue,你可以將其傳遞給每個 MonteCarlo 作業,完成后它應該將結果放在那里.然后頂層可以等待隊列中的值.(在引擎蓋下,這將腌制和取消腌制結果對象.)

                  If you create a multiprocessing.Queue, you can pass that into each MonteCarlo job, and when it finishes it should put the result in there. Then the top-level can wait for values from the queue. (Under the hood this will pickle and unpickle the result object.)

                  result_queue = multiprocessing.Queue()
                  montecarlos = [MonteCarlo(result_queue, f,fargs) for fargs in farglist]
                  jobs = [multiprocessing.Process(mc) for mc in montecarlos]
                  for job in jobs: job.start()
                  for job in jobs: job.join()
                  results = [result_queue.get() for mc in montecarlos]
                  

                  這篇關于我可以從 multiprocessing.Process 中獲得返回值嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)

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

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

                            <tfoot id='K9gnE'></tfoot>
                          1. <legend id='K9gnE'><style id='K9gnE'><dir id='K9gnE'><q id='K9gnE'></q></dir></style></legend>
                            主站蜘蛛池模板: 国产免费黄网 | 中文字幕在线一区二区三区 | 日本成人福利视频 | 欧美综合国产精品久久丁香 | 日韩三级在线 | 久久综合一区二区三区 | 国产一区二区在线免费播放 | 国产999精品久久久久久 | 国产精品99久久久久久动医院 | 韩日精品一区 | 久久99精品久久久久久 | 日本欧美大片 | 日韩中文字幕一区 | 亚洲国产成人精品女人久久久 | 国产精品视频久久 | 亚洲视频在线一区 | 亚洲视频一区二区三区 | 成人午夜电影在线观看 | 祝你幸福电影在线观看 | 久久国产欧美日韩精品 | 91国在线高清视频 | 国产精品永久 | 欧美一级免费 | 免费久草 | 81精品国产乱码久久久久久 | 91精品久久久久久久久中文字幕 | 久久久一区二区 | 欧美一区二区精品 | 一区二区高清在线观看 | 国产精品久久久久久久久久久久午夜片 | 久久人人网 | 久久激情视频 | 精品久久久久久久久久 | 国产xxxx岁13xxxxhd | 欧美福利一区 | 日日操夜夜摸 | 99久久精品一区二区毛片吞精 | 久久在视频 | 亚洲色欧美另类 | av在线天天 | 91精品国产91久久久久游泳池 |