25
1 © 2012 The MathWorks, Inc. 並列計算・並列実行による 高速化ソリューション MathWorks Japan アプリケーションエンジニアリング部 アプリケーションエンジニア 吉田剛士

MathWorks - 並列計算・並列実行による 高速化ソ …...4 MATLAB R2012bのハイライト② アプリケーション –各Toolbox が提供する様々なGUIアプリを一覧(ギャラリー)

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

1 © 2012 The MathWorks, Inc.

並列計算・並列実行による

高速化ソリューション

MathWorks Japan

アプリケーションエンジニアリング部

アプリケーションエンジニア

吉田剛士

2

アジェンダ

MATLAB® R2012b ハイライト

PCT / MDCS 新機能ハイライト

Simulink® プロダクトの並列化

まとめ

3

MATLAB R2012bのハイライト①

新しいデスクトップ – 使用頻度の高い機能を整理

– 見つけやすく

データのインポート – テキストファイルの対話的入力

– 数値、テキスト、日付処理強化

4

MATLAB R2012bのハイライト②

アプリケーション – 各Toolbox が提供する様々なGUIアプリを一覧(ギャラリー)

– ユーザ作成GUIアプリのパッケージ化、配布、インストールの簡単化

ヘルプの再設計 – 閲覧機能、検索機能、フィルター処理機能が向上

5

アジェンダ

MATLAB R2012b ハイライト

PCT / MDCS 新機能ハイライト

Simulink プロダクトの並列化

まとめ Desktop Computer

Parallel Computing Toolbox™

Computer Cluster

MATLAB Distributed Computing Server™

Scheduler

6

Parallel Computing Toolbox™ &

MATLAB Distributed Computing Server™

コンピュータ クラスタ

MATLAB Distributed Computing Server

スケジューラ

デスクトップ

Parallel Computing Toolbox

7

R2012x の新機能

R2012a

– 「Parallel Configuration」 から 「Cluster Profile」 へ変更

– GPU サポート関数の拡大

beta / bsxfun / det / inv /

fftn / ifftn / …

R2012b

– GPU サポート関数の拡大

mpower / convn / var / cov / …

– サポート製品の拡大

8

並列化対応製品一覧

Bioinformatics Toolbox™

Communication System

Toolbox™

Embedded Coder®

Global Optimization Toolbox

Image Processing Toolbox™

Model-Based Calibration

Toolbox™

Neural Network Toolbox™

Optimization Toolbox™

Robust Control Toolbox™

Signal Processing Toolbox™

Simulink Coder™

Simulink Control Design™

Simulink Design

Optimization™

Statistics Toolbox™

SystemTest™

9

Web: 並列化対応製品

10

Neural Network Toolbox GPU computing support for training and simulations

学習プロセスの並列化 (CPU)の例

学習プロセスの並列化 (GPU)の例

>> % 並列計算用プロセスの起動

>> matlabpool open

>>

>> % 学習の並列化

>> net2 = train(net1, x, t, 'useParallel', 'yes');

>> net2 = train(net1, x, t, 'useGPU', 'yes');

11

Demo: 加速度データからの動作予測

),,,( 21 nxxxfy

Input (24変数) - 左手: 12変数 x,y,z 方向の各加速度に対する

• 平均 • 分散 • 最大値 • 最小値

- 右手: 12変数 x,y,z 方向の各加速度に対する

• 平均 • 分散 • 最大値 • 最小値

Output - 読書 - キータイプ - マウス操作 - 文字筆記 - 静止

0

1

2

3

4

5

1 core 4 cores GPU Tesla C2050

12

MATLABにおける機械学習

),,,( 21 nxxxfy Input Output

Decision Tree

Neural Network

Support Vector Machine

13

Statistics Toolbox : Computation of decision trees

on multiple bootstrap replicates uses multi-processors

TreeBagger class

– バギング (Bootstrap Aggregating) 法 や ランダム・フォレスト法

を扱うためのクラス

ツリーの並列生成

>> % 並列計算用プロセスの起動

>> matlabpool open

>> % 並列オプションの設定

>> opt = statset('UseParallel', 'always');

>> % 決定木の並列化

>> b = TreeBagger(nTrees, X, Y, ‘OOBVarImp’, ‘on’, …

‘categorical’, 6, 'minleaf', leaf, 'Options', opt);

14

学習時間の比較

Demo: アンケートからの性格分類

0

10

20

30

40

1 core 2 cores 4 cores 6 cores

),,,( 21 nxxxfy Input - 40の設問からなる アンケート

Output - 8つのグループ

A

C

E

G

H B

D F

15

アジェンダ

MATLAB R2012b ハイライト

PCT / MDCS 新機能ハイライト

Simulink プロダクトの並列化

まとめ

16

Simulink Coder Parallel building for large model reference hierarchies

パラレルビルドの準備

ビルドに対する MATLAB ワーカー初期化 - なし : ワーカー(計算プロセス)に対して何もしない

- ベースワークスペースへコピー: ベースワークスペースにある変数をワーカーに送信する

- 最上位モデルの読み込み: モデル起動時に読み込まれる変数をワーカーに送信する

17

パラレルビルドのベンチマーク

環境

– CPU: Intel Xeon W3690 @ 3.47GHz (6-cores)

– Memory: 24GB

– OS: Win7 SP1

– Compiler: Microsoft Visual Studio 64-bit Edition

– MATLAB: R2012a

ベンチマーク

– 総ブロック数 323,976 を

有するモデルで計測

0

50

100

150

200

250

300

350

400

450

18

SLDV: Simulink Design Verifier™

テストケース自動生成

プロパティ検証

設計エラー検出

解析

検証仕様

要求仕様

入力と出力との間に矛盾が無いことを形式的手法に証明

ゼロ割やオーバー

フローなどの検出

オーバーフロー可能性あり

→ 反例となる入力ベクタを作成

19

例: テストケース生成の並列実行 Parallel For-Loop による検証の並列化

>> ModelList = {‘sldvdemo_cruise_control’; … 'sldvdemo_design_error_detection'};

>> opts = sldvoptions;

>> opts.Mode = ‘TestGeneration’; % テストケース生成を選択

>> % 並列計算用プロセスの起動

>> matlabpool open 2

>>

>> parfor n = 1:length(ModelList)

load_system(ModelList{n});

sldvrun(bdroot, opts); % 検証の実行

end

TIPS

– 「sldvrun」実行の際はMATLABプロセスと 検証用プロセス

「dvoanalyzer.exe」が起動するので、「matlabpool open」時に

コア数の半分の値を指定するのが効果的

20

SLVV: Simulink Verification and Validation™

モデルカバレッジ測定

仕様とモデル間のトレーサビリティ設定

モデルアドバイザ (モデルのスタイル

チェック)

モデルカバレッジ

レポート

• Decision

• Condition

• MC/DC 制御モデル

TT,TF,FT

仕様書からモデルへ

モデルから仕様書へ

Word

Excel

DOORS

MKS Integrity

任意

Word

Excel

DOORS

MKS Integrity

任意

• GUIからのモデル

チェックの実行

• 指摘に従い修正

(自動修正も有)

• レポート生成

• カスタムチェックの追加

21

例: モデルアドバイザの並列実行

>> matlabpool open % 並列計算用プロセスの起動

>>

>> SysList = {'sldemo_auto_climatecontrol/Heater Control', ...

'sldemo_auto_climatecontrol/AC Control'};

>>

>> [fail, warn] = run_configuration(SysList);

function [fail, warn] = run_configuration(SysList)

fileName = 'slvnvdemo_mdladv_config.mat';

fail = 0;

warn = 0;

SysResultObjArray = ModelAdvisor.run(SysList, …

'Configuration', fileName);

for n = 1:length(SysResultObjArray)

fail = fail + SysResultObjArray{n}.numFail;

warn = warn + SysResultObjArray{n}.numWarn;

end

22

アジェンダ

MATLAB R2012b ハイライト

PCT / MDCS 新機能ハイライト

Simulink プロダクトの並列化

まとめ

23

まとめ

新しいリリースとともに Parallel Computing Toolbox

および MATLAB Distributed Computing Server との

連携製品が拡大

Simulink 関連製品、特にコード生成や検証系の製品との

親和性が高い

Desktop Computer

Parallel Computing Toolbox

Computer Cluster

MATLAB Distributed Computing Server

Scheduler

24

MATLAB Production Server™

MATLAB

Toolboxes

MATLAB Compiler

Computer Cluster

MATLAB Production Server

License

Manager

Shared

Directory

Web

Browser

End User

特徴

– MCR (ランタイム)をサーバで一元管理

– クラスタ環境をサポート

25

アプリケーション配布のフロー

MATLAB デスクトップ

End User

1

2

Toolboxes

3

4

MATLAB Compiler

MATLAB Compiler™

.exe