[問題]multiprocessing ( Done

作者: redbxh (林佳)   2014-04-04 00:17:59
目前需要使用到 multiprocessing
我要做到的是 開啟多個process 分別將資料進行 排序
排序法
def xxxxxSort( data_list ):
#略
return sorted
目前找到的資料是用 multiprocessing.Pool
我可以用 multiprocessing.Pool 來達到
多process 執行 function ( print something)
但是我一直無法取到我 執行完 xxxxxSort 之後回傳的list
不過我有得到一些東西
像是 <multiprocessing.pool.ApplyResult object at 0x02716310>
請問有辦法使用 multiprocessing 來達到 多process 排序&回傳嗎
還是要透過 object at 0x02716310 來取得 list?
請求各路高手解答
作者: LarryPage (癩痢。佩吉)   2014-04-04 00:49:00
p=multiprocessing.Pool(100)output_list = p.map(XXXXsort, input_list)print output_list[[1,4,5],[2,3],[7,9]]有錯請指定
作者: tiefblau (tiefblau)   2014-04-04 01:02:00
call .get()才會是函式的回傳值 話說樓上你有一百核嗎?
作者: redbxh (林佳)   2014-04-04 01:18:00
1f 那樣寫是一百核還是允許最大100個process同時?感謝1F 方法可行 3Q
作者: hsnu114444 (我只是QQ糖)   2014-04-25 22:55:00
100個process

Links booklink

Contact Us: admin [ a t ] ucptt.com