pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

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

        multiprocessing.Pool 似乎可以在 Windows 中工作,但不

        multiprocessing.Pool seems to work in Windows but not in ubuntu?(multiprocessing.Pool 似乎可以在 Windows 中工作,但不能在 ubuntu 中工作?)
          <bdo id='v99MQ'></bdo><ul id='v99MQ'></ul>

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

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

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

                  本文介紹了multiprocessing.Pool 似乎可以在 Windows 中工作,但不能在 ubuntu 中工作?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  已解決:問題出在 Wingware Python IDE 上.我想現在很自然的問題是這怎么可能以及如何解決.

                  SOLVED: The problem was Wingware Python IDE. I guess the natural question now is how it is possible and how this could be fixed.

                  我昨天問了一個問題(Python 中 multiprocessing.Pool 的問題) 這個問題幾乎是一樣的,但我發現它似乎可以在 Windows 計算機上運行,??而不是在我的 ubuntu 中運行.在這篇文章的最后,我將發布一個略有不同的代碼版本.

                  I asked a question yesterday ( Problem with multiprocessing.Pool in Python ) and this question is almost the same but I have figured out that it seems to work on a Windows computer and not in my ubuntu. At the end of this post I will post a slightly different version of the code that does the same thing.

                  我的問題的簡短摘要:在 Python 中使用 multiprocessing.Pool 時,我并不總是能夠獲得我所要求的工人數量.發生這種情況時,程序就會停止.

                  Short summary of my problem: When using multiprocessing.Pool in Python I am not always able to get the amount of workers that I am asking for. When this happens, the program just stalls.

                  我整天都在尋找解決方案,然后我開始思考 Noahs 對我之前的問題的評論.他說它可以在他的機器上運行,所以我把代碼提供給了我的同事,他運行的是一臺帶有 Enthoughts 64 位 Python 2.7.1 發行版的 Windows 機器.我與我在 ubuntu 上運行的巨大差異相同.我還提到我們都有 Wingware Python IDE,但我懷疑這是否重要?

                  I have been working for a solution all day, and then I came to think about Noahs' comment on my previous question. He said that it worked on his machine so I gave the code to my colleague who runs a Windows machine with Enthoughts 64-bit Python 2.7.1 distribution. I have the same with the big difference that mine runs on ubuntu. I also mention that we both have Wingware Python IDE, but I doubt that this is of any importance?

                  當我的同事在他的機器上運行代碼時,我的代碼不會出現兩個問題.

                  There are two problems with my code that don't arise when my colleague runs the code on his machine.

                  1. 我并不總是能夠得到我要求的四個工人(盡管我的機器有 12 個工人).發生這種情況時,該過程會停止并且不會繼續.沒有引發異常或錯誤.

                  1. I am not always able to get the four workers I am asking for (Although my machine has 12 workers). When this happens, the process just stalls and does not continue. No exception or Error is raised.

                  當我能夠得到我要求的四名工人時(大約 5 次左右出現 1 次),所產生的數字(普通隨機數)對于所有四張圖片都是完全相同的.我的同事不是這樣.

                  When I am able to get the four workers I ask for (which happens approximately 1 out 5 times or so), the figures that are produced (plain random numbers) are EXACTLY the same for all four pictures. This is not the case for my colleague.

                  有些事情很可疑,我非常感謝你們提供的任何幫助.

                  Something is very fishy and I am very thankful for any kind of help you guys can offer.

                  代碼:

                  import multiprocessing as mp
                  import scipy as sp
                  import scipy.stats as spstat
                  import pylab
                  
                  def testfunc(x0, N):
                      print 'working with x0 = %s' % x0
                      x = [x0]
                      for i in xrange(1,N):
                          x.append(spstat.norm.rvs(size = 1)) # stupid appending to make it slower
                          if i % 10000 == 0:
                              print 'x0 = %s, i = %s' % (x0, i)
                      return sp.array(x)
                  
                  def testfuncParallel(fargs):
                      return testfunc(*fargs)
                  
                  
                  # Define Number of tasks.
                  nTasks = 4
                  N = 100000
                  
                  if __name__ == '__main__':
                  
                      """
                      Try number 1. Using multiprocessing.Pool together with Pool.map_async
                      """
                      pool = mp.Pool(processes = nTasks) # I have 12 threads (six cores) available so I am suprised that it does not get access to nTasks = 4 amount of workers
                  
                      # Define tasks:
                      tasks = [(x, n) for x, n in enumerate(nTasks*[N])] # nTasks different tasks
                  
                      # Compute parallel: async - asynchronically, i.e. not necessary in order.
                      result = pool.map_async(testfuncParallel, tasks)
                  
                      pool.close() # These are needed if map_async is used
                      pool.join()
                  
                      # Get results:
                      sim = sp.zeros((N, nTasks)) 
                  
                      for nn, res in enumerate(result.get()):    
                          sim[:, nn] = res
                  
                      pylab.figure()
                      for i in xrange(nTasks):
                          pylab.subplot(nTasks,1, i + 1)
                          pylab.plot(sim[:, i])
                  
                      pylab.show()
                  

                  提前致謝.

                  真誠地,馬蒂亞斯

                  推薦答案

                  更新: 原來這與 matplotlib 或后端無關,而是與一般多處理相關的錯誤有關.我們已經為 Wing 版本 4.0.4+ 修復了這個問題.解決方法是不在子進程中執行的代碼中設置斷點.

                  Update: Turns out this had nothing to do with matplotlib or the backends but rather with a bug associated with multiprocessing in general. We've fixed this for Wing version 4.0.4+. The work-around is not to set breakpoints in the code that is executed in the sub-processes.

                  這似乎是 Wing IDE 的 matplotlib 支持 Tkinter 后端與多處理交互不良.當我嘗試這個示例時,它會在 TCL/Tk 代碼中崩潰.我懷疑在 Windows 上工作的人正在使用不同的 matplotlib 后端.

                  It seems to be Wing IDE's matplotlib support for the Tkinter backend interacting badly with multiprocessing. When I try this example it crashes in TCL/Tk code. I suspect the person working on Windows was using a different matplotlib backend.

                  在擴展"選項卡下的項目屬性"中關閉matplotlib 事件循環支持"似乎可以解決這個問題.

                  Turning off the "matplotlib event loop support" in Project Properties under the Extensions tab seems to work around it.

                  或者,當matplotlib 事件循環支持"打開時,添加以下內容似乎可以為我修復它.

                  Or, adding the following seems to fix it for me when the "matplotlib event loop support" is turned on.

                  導入matplotlibmatplotlib.use('WXAgg')

                  import matplotlib matplotlib.use('WXAgg')

                  這僅在您擁有 WXAgg 后端時才有效.Wing IDE 支持的其他后端(即使調試過程暫停,繪圖也能保持交互)是 GTKAgg 和 Qt4Agg,但我還沒有嘗試過.

                  This will only work if you have the WXAgg backend. Other backends supported by Wing IDE (in such a way that plots remain interactive even if the debug process is paused) are GTKAgg and Qt4Agg but I didn't try those yet.

                  我會看看我是否能找到并修復這個錯誤.我懷疑我們需要在進程 ID 更改時禁用我們的事件循環支持.感謝您報告此事.

                  I'll see if I can find and fix the bug. I suspect we need to disable our event loop support when the process ID changes. Thanks for reporting this.

                  這篇關于multiprocessing.Pool 似乎可以在 Windows 中工作,但不能在 ubuntu 中工作?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                    <legend id='POF7b'><style id='POF7b'><dir id='POF7b'><q id='POF7b'></q></dir></style></legend>
                      <bdo id='POF7b'></bdo><ul id='POF7b'></ul>

                        <tbody id='POF7b'></tbody>

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

                    • <tfoot id='POF7b'></tfoot>

                      1. <i id='POF7b'><tr id='POF7b'><dt id='POF7b'><q id='POF7b'><span id='POF7b'><b id='POF7b'><form id='POF7b'><ins id='POF7b'></ins><ul id='POF7b'></ul><sub id='POF7b'></sub></form><legend id='POF7b'></legend><bdo id='POF7b'><pre id='POF7b'><center id='POF7b'></center></pre></bdo></b><th id='POF7b'></th></span></q></dt></tr></i><div class="0q0sqms" id='POF7b'><tfoot id='POF7b'></tfoot><dl id='POF7b'><fieldset id='POF7b'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 伺服电机维修、驱动器维修「安川|三菱|松下」伺服维修公司-深圳华创益 | 钢骨架轻型板_膨石轻型板_钢骨架轻型板价格_恒道新材料 | 电机修理_二手电机专家-河北豫通机电设备有限公司(原石家庄冀华高压电机维修中心) | 厂房出租_厂房出售_产业园区招商_工业地产&nbsp;-&nbsp;中工招商网 | 电主轴-高速精密电主轴-高速电机厂家-瑞德沃斯品牌有限公司 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 等离子空气净化器_医用空气消毒机_空气净化消毒机_中央家用新风系统厂家_利安达官网 | 中矗模型-深圳中矗模型设计有限公司 | 食品无尘净化车间,食品罐装净化车间,净化车间配套风淋室-青岛旭恒洁净技术有限公司 | 航空铝型材,7系铝型材挤压,硬质阳*氧化-余润铝制品 | 西门子气候补偿器,锅炉气候补偿器-陕西沃信机电工程有限公司 | 包塑丝_高铁绑丝_地暖绑丝_涂塑丝_塑料皮铁丝_河北创筹金属丝网制品有限公司 | 齿辊分级破碎机,高低压压球机,立式双动力磨粉机-郑州长城冶金设备有限公司 | 车牌识别道闸_停车场收费系统_人脸识别考勤机_速通门闸机_充电桩厂家_中全清茂官网 | 电动手术床,医用护理床,led手术无影灯-曲阜明辉医疗设备有限公司 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 无压烧结银_有压烧结银_导电银胶_导电油墨_导电胶-善仁(浙江)新材料 | 环氧乙烷灭菌器_压力蒸汽灭菌器_低温等离子过氧化氢灭菌器 _低温蒸汽甲醛灭菌器_清洗工作站_医用干燥柜_灭菌耗材-环氧乙烷灭菌器_脉动真空压力蒸汽灭菌器_低温等离子灭菌设备_河南省三强医疗器械有限责任公司 | 爆破器材运输车|烟花爆竹运输车|1-9类危险品厢式运输车|湖北江南专用特种汽车有限公司 | 邢台人才网_邢台招聘网_邢台123招聘【智达人才网】 | 生态板-实木生态板-生态板厂家-源木原作生态板品牌-深圳市方舟木业有限公司 | 电位器_轻触开关_USB连接器_广东精密龙电子科技有限公司 | 苏州防水公司_厂房屋面外墙防水_地下室卫生间防水堵漏-苏州伊诺尔防水工程有限公司 | 蜗轮丝杆升降机-螺旋升降机-丝杠升降机厂家-润驰传动 | 地图标注-手机导航电子地图如何标注-房地产商场地图标记【DiTuBiaoZhu.net】 | 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 四川成都干燥设备_回转筒干燥机_脉冲除尘器_输送设备_热风炉_成都川工星科机电设备有限公司 | EFM 022静电场测试仪-套帽式风量计-静电平板监测器-上海民仪电子有限公司 | 数控专用机床,专用机床,自动线,组合机床,动力头,自动化加工生产线,江苏海鑫机床有限公司 | 鄂泉泵业官网|(杭州、上海、全国畅销)大流量防汛排涝泵-LW立式排污泵 | 考勤系统_考勤管理系统_网络考勤软件_政企|集团|工厂复杂考勤工时统计排班管理系统_天时考勤 | 天长市晶耀仪表有限公司 | 上海平衡机-单面卧式动平衡机-万向节动平衡机-圈带动平衡机厂家-上海申岢动平衡机制造有限公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 广州工业氧气-工业氩气-工业氮气-二氧化碳-广州市番禺区得力气体经营部 | 高精度-恒温冷水机-螺杆式冰水机-蒸发冷冷水机-北京蓝海神骏科技有限公司 | 北京网站建设公司_北京网站制作公司_北京网站设计公司-北京爱品特网站建站公司 | HDPE土工膜,复合土工膜,防渗膜价格,土工膜厂家-山东新路通工程材料有限公司 | 一体式钢筋扫描仪-楼板测厚仪-裂缝检测仪-泰仕特(北京) |