SimMcの基本的な使い方
単一のアプリケーションを実行する
インストールと動作確認で行ったように,
バイナリファイル1つを引数として(オプションなしに)SimMcを実行すると,
自動的に4×4の16コアを利用することを想定して,アプリケーションを実行します.
$ ../../../sim/SimMc test.out
## SimMc: Many-Core and NoC Simulator v2.0 2012-09-30
## arguments: test.out
## Physical Size : 4x4
## Logical Size App 0: 4x4
## [a 1, 1 ][a 2, 1 ][a 3, 1 ][a 4, 1 ]
## [a 1, 2 ][a 2, 2 ][a 3, 2 ][a 4, 2 ]
## [a 1, 3 ][a 2, 3 ][a 3, 3 ][a 4, 3 ]
## [a 1, 4 ][a 2, 4 ][a 3, 4 ][a 4, 4 ]
(後略)
オプション -x -y は利用するコアの数を指定します.
これらを変更して実行してみます.
$ ../../../sim/SimMc test.out -x2 -y2
## SimMc: Many-Core and NoC Simulator v2.0 2012-09-30
## arguments: test.out -x2 -y2
## Physical Size : 2x2
## Logical Size App 0: 2x2
## [a 1, 1 ][a 2, 1 ]
## [a 1, 2 ][a 2, 2 ]
デフォルトでは -x4 -y4 として16個のコアが利用されていますが,
これらを設定することで,4個のコアで動作することがわかります.
また,この例ではオプションをファイル名の後に記述していますが,
ファイル名の前に記述しても構いません.
SimMcには,このほかにもいくつかのオプションが存在します.
それらの詳細については,
SimMcのオプション
を参照してください.
複数のアプリケーションを実行する
複数のアプリケーションを実行する
(あるいは,単一のアプリケーションでも複雑なコア配置で実行する)場合は,
システムコンフィグファイルとよばれる,
テキスト形式のファイルを用いてコア配置を指定します.
例えば,4×4の16コアに対して,
4×2の8コアで動作するアプリケーションを2つ同時に実行する場合は,
以下のようなmap.txtファイルを作成します.
--------------------------------------------------------------------
4x4 P : physical system configuration
4x2 a : logical system configuration for application 'a'
4x2 b : logical system configuration for application 'b'
[a1,1 ] [a2,1 ] [a3,1 ] [a4,1 ]
[a1,2 ] [a2,2 ] [a3,2 ] [a4,2 ]
[b1,1 ] [b2,1 ] [b3,1 ] [b4,1 ]
[b1,2 ] [b2,2 ] [b3,2 ] [b4,2 ]
--------------------------------------------------------------------
そして,システムコンフィグファイルを読み込む -c オプションと,
実行する2つのバイナリファイルを引数として実行します.
このとき,バイナリファイルは指定した順序で,
システムコンフィグファイルのアプリケーションa, b, …に対応します.
$ ../sim/SimMc -c map.txt test10.out test11.out
## SimMc: Many-Core and NoC Simulator v2.0 2012-09-30
## arguments: -c map.txt test10.out test11.out
## Physical Size : 4x4
## Logical Size App 0: 4x2
## Logical Size App 1: 4x2
## [a 1, 1 ][a 2, 1 ][a 3, 1 ][a 4, 1 ]
## [a 1, 2 ][a 2, 2 ][a 3, 2 ][a 4, 2 ]
## [b 1, 1 ][b 2, 1 ][b 3, 1 ][b 4, 1 ]
## [b 1, 2 ][b 2, 2 ][b 3, 2 ][b 4, 2 ]
## Multi-Core library MClib v1.0.1 2012-09-30
## Multi-Core library MClib v1.0.1 2012-09-30
$$ test10: I am core (2,1).
$$ test10: I am core (3,1).
$$ test10: I am core (4,1).
$$ test10: I am core (2,2).
$$ test10: I am core (3,2).
$$ test10: I am core (4,2).
$$ test10: I am core (1,2).
$$ test11: I am core physical(2,3), logical(2,1).
$$ test11: I am core physical(3,3), logical(3,1).
$$ test11: I am core physical(4,3), logical(4,1).
$$ test11: I am core physical(2,4), logical(2,2).
$$ test11: I am core physical(3,4), logical(3,2).
$$ test11: I am core physical(4,4), logical(4,2).
$$ test11: I am core physical(1,4), logical(1,2).
$$ test10: I am core (1,1).
$$ test11: I am core physical(1,3), logical(1,1).
## Simulation time (s) : 0.122
## Simulation cycle : 22224
## Simulation speed (kc/s): 182.566
2つ目のアプリケーションとして指定したtest11では,
論理的なコアIDだけではなく,実際に配置された物理的なコアIDも表示します.
これらの物理IDはシステムコンフィグファイルでの指定と一致しています.