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

      1. <tfoot id='CWOqH'></tfoot>
      2. <legend id='CWOqH'><style id='CWOqH'><dir id='CWOqH'><q id='CWOqH'></q></dir></style></legend>

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

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

          <bdo id='CWOqH'></bdo><ul id='CWOqH'></ul>
      3. 將 100% 的內核與多處理模塊一起使用

        Using 100% of all cores with the multiprocessing module(將 100% 的內核與多處理模塊一起使用)

          • <bdo id='QgFhK'></bdo><ul id='QgFhK'></ul>

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

            1. <tfoot id='QgFhK'></tfoot>

                <tbody id='QgFhK'></tbody>
              • <small id='QgFhK'></small><noframes id='QgFhK'>

                1. 本文介紹了將 100% 的內核與多處理模塊一起使用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有兩段代碼用于了解 Python 3.1 中的多處理.我的目標是使用 100% 的所有可用處理器.但是,這里的代碼片段在所有處理器上僅達到 30% - 50%.

                  I have two pieces of code that I'm using to learn about multiprocessing in Python 3.1. My goal is to use 100% of all the available processors. However, the code snippets here only reach 30% - 50% on all processors.

                  無論如何強制"python 100% 使用?操作系統(Windows 7、64 位)是否限制了 Python 對處理器的訪問?當下面的代碼片段正在運行時,我打開任務管理器并觀察處理器的峰值,但從未達到并保持 100%.除此之外,我還可以看到在此過程中創建和銷毀了多個 python.exe 進程.這些過程與處理器有什么關系?例如,如果我生成 4 個進程,則每個進程都沒有使用它自己的核心.相反,這些進程使用的是什么?他們是否共享所有內核?如果是這樣,是操作系統強制進程共享內核嗎?

                  Is there anyway to 'force' python to use all 100%? Is the OS (windows 7, 64bit) limiting Python's access to the processors? While the code snippets below are running, I open the task manager and watch the processor's spike, but never reach and maintain 100%. In addition to that, I can see multiple python.exe processes created and destroyed along the way. How do these processes relate to processors? For example, if I spawn 4 processes, each process isn't using it's own core. Instead, what are the processes using? Are they sharing all cores? And if so, is it the OS that is forcing the processes to share the cores?

                  import multiprocessing
                  
                  def worker():
                      #worker function
                      print ('Worker')
                      x = 0
                      while x < 1000:
                          print(x)
                          x += 1
                      return
                  
                  if __name__ == '__main__':
                      jobs = []
                      for i in range(50):
                          p = multiprocessing.Process(target=worker)
                          jobs.append(p)
                          p.start()
                  

                  代碼片段 2

                  from multiprocessing import Process, Lock
                  
                  def f(l, i):
                      l.acquire()
                      print('worker ', i)
                      x = 0
                      while x < 1000:
                          print(x)
                          x += 1
                      l.release()
                  
                  if __name__ == '__main__': 
                      lock = Lock()
                      for num in range(50):
                          Process(target=f, args=(lock, num)).start()
                  

                  推薦答案

                  要使用 100% 的所有內核,不要創建和銷毀新進程.

                  To use 100% of all cores, do not create and destroy new processes.

                  為每個核心創建幾個進程并將它們與管道鏈接.

                  Create a few processes per core and link them with a pipeline.

                  在操作系統級別,所有流水線進程同時運行.

                  At the OS-level, all pipelined processes run concurrently.

                  你寫的越少(你委托給操作系統的越多)你就越有可能使用盡可能多的資源.

                  The less you write (and the more you delegate to the OS) the more likely you are to use as many resources as possible.

                  python p1.py | python p2.py | python p3.py | python p4.py ...
                  

                  將最大限度地利用您的 CPU.

                  Will make maximal use of your CPU.

                  這篇關于將 100% 的內核與多處理模塊一起使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                  <tfoot id='Sd9jW'></tfoot>

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

                        • <legend id='Sd9jW'><style id='Sd9jW'><dir id='Sd9jW'><q id='Sd9jW'></q></dir></style></legend>
                            <tbody id='Sd9jW'></tbody>

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

                            主站蜘蛛池模板: 成人免费视屏 | 成年人黄色小视频 | 中文字幕在线剧情 | 91电影 | 欧美成人精品在线 | 国产一级片一区二区三区 | av香蕉| 中文字幕高清 | 精品一二三 | 久久蜜桃资源一区二区老牛 | av在线一区二区三区 | 最近中文字幕免费 | 亚洲综合大片69999 | 中文在线a在线 | 久久亚洲一区 | 亚洲激精日韩激精欧美精品 | 久久精品成人一区 | 久久久久免费观看 | 国产不卡一区 | 亚洲精品9999久久久久 | 人人干人人玩 | 成人日b视频 | 成人精品鲁一区一区二区 | 黄色毛片一级 | 久久久精品国产 | 国产精品自产拍在线观看蜜 | 2018国产精品 | 国产日韩一区二区 | 中文字幕成人网 | 日韩av免费在线观看 | 中文字幕亚洲一区 | 一级黄色毛片免费 | 国产成人亚洲精品 | 欧美久久一区二区三区 | 天天干干 | 日韩欧美高清 | 久久青 | 日韩毛片免费视频 | 久久人人爽人人爽人人片av免费 | 亚洲色欧美另类 | 国产伊人久久久 |