Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Grid[Barrier] - 全プロセスがこのルーチンに到達するまでブロックする
使い方
Barrier()
説明
Barrier コマンドは、Launch コマンドにより起動されたジョブの全てを、その全プロセスが Barrier コマンドを実行し終わるまでブロックします。
これは、実行を同期するのに便利です。ノード 0 が、他の全ノードの処理が完了するまで強制的に待機させることができます。
この関数は、現在のところ hpc モードでは利用できません。
互換性
Grid[Barrier] コマンドは、Maple 15 より導入されました。
Maple 15 の変更点についての詳細は、Maple 15 の更新情報 をご覧ください。
例
この例では、ノード番号が高いノードの方がノード番号の低いノードよりも処理が多くなっています。実際、ノード 0 はほとんどやることがなく、すぐに終了します。ノード 0 が終わるとジョブが終了するので、他のノードからは出力がほとんどみられません。
dosome := proc() uses Grid; local i, me; me := MyNode(); for i from 1 to 10^(me+3) do if i mod 10^5 = 0 then print(me,i); end if; end do; print(me,"done"); end proc:
Grid[Launch](dosome,numnodes=4);
0, "done" 1, "done" 2, 100000 2, "done" 3, 100000 3, 200000
このプロシージャは、最後に Barrier へのコールが追加されている以外は上記のものと同じです。この一行のため、全ノードが待機し、その行で同期されます。上記の例とは違い、各ノードが終わりまで実行されます。
doall:= proc() uses Grid; local i, me; me := MyNode(); for i from 1 to 10^(me+3) do if i mod 10^5 = 0 then print(me,i); end if; end do; print(me,"done"); Barrier(); end proc:
Grid[Launch](doall,numnodes=4);
0, "done" 1, "done" 2, 100000 2, "done" 3, 100000 3, 200000 3, 300000 3, 400000 3, 500000 3, 600000 3, 700000 3, 800000 3, 900000 3, 1000000 3, "done"
参照
Grid, Grid[Setup]
Download Help Document