Skip to Main Content
Mathematica 錦囊妙計
book

Mathematica 錦囊妙計

by Sal Mangano
April 2014
Beginner to intermediate content levelBeginner to intermediate
830 pages
15h 21m
Chinese
GoTop Information, Inc.
Content preview from Mathematica 錦囊妙計
16.4 將序列式程式平行化
|
649
Parallelize
Listable 數、 數(
Apply
Map
MapThread
等)、化約指令(如
Count
MemberQ
)及迭代指令(如
Table
)等。[Page-652]
平行化動作經常需要在兩個因素間作取捨,一是問題切割所耗費資源,一是讓所有核心
隨時保持忙碌。粗顆粒方式(coarse-grained approach)根據核心數目將工作分為幾大塊
平行運算,當其一核心先計算完畢時,需等待其他核心完成工作;相反地,細顆粒方式
fine-grained approach)切割為數目較多的小塊平行運算,因此可隨時維持各核心忙碌
計算的狀態,但這會增加資料分割與傳輸的經常性耗費。
Parallelize
指令可用來實現
MapIndexed
的平行化版本,因為 Mathematica 7 並沒有直
接提供此操作,而
Map
的平行化版本
ParallelMap
是支援的,詳見訣竅 16.6
{
}
{
}
[Page-653]
ch16.indd 649 2014/4/2 下午 04:10:57
650
|
第十六章
16.5 將資料分散進行平行運算並整合結果
問題點
你想要以平行化方式呼叫函數,使得大量的輸入串
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ubuntu for Non-Geeks, 4th Edition

Ubuntu for Non-Geeks, 4th Edition

Rickford Grant, Phil Bull

Publisher Resources

ISBN: 9789863470106