SlideShare une entreprise Scribd logo
1  sur  60
Télécharger pour lire hors ligne
並列化のロードマップ:
今後のインテルソフトウェア開発製品について

池井 満
ソフトウェア&サービス統括本部部長
インテル株式会社

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
Legal Disclaimer

INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED,
BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS
DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS
OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR
WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR
INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

Performance tests and ratings are measured using specific computer systems and/or components
and reflect the approximate performance of Intel products as measured by those tests. Any
difference in system hardware or software design or configuration may affect actual performance.
Buyers should consult other sources of information to evaluate the performance of systems or
components they are considering purchasing. For more information on performance tests and on
the performance of Intel products, reference www.intel.com/software/products.

Intel, Intel Core and the Intel logo are trademarks of Intel Corporation in the U.S. and other
countries.

*Other names and brands may be claimed as the property of others.

Copyright © 2009. Intel Corporation.

                                                                            http://intel.com/software/products




     Software & Services Group, Developer Products Division
     Copyright © 2009, Intel Corporation. All rights reserved.
     *Other brands and names are the property of their respective owners.
                                                                                                                 2
マルチコアとメニーコア
                   Memory Controller
M                                                                               M
i                                                                               i
s
c
                                                                                s
                                                                                c
                                                                                    インテル® Core™ i7 プロセッサー
    コア                  コア                Q           コア                  コア
I                                         u                                     I
O                                         e                                     O
                                          u
                                          e
Q                                                                               Q
P                                                                               P
I                                                                               I
                              Shared L3 Cache
0                                                                               1



           Larrabee✝




                                                                                              ✝開発コード名
         Software & Services Group, Developer Products Division
         Copyright © 2009, Intel Corporation. All rights reserved.
         *Other brands and names are the property of their respective owners.
ほとんどのプロセッサーが
                                  並列プロセッサー




Software & Services Group, Developer Products Division
Copyright © 2009, Intel Corporation. All rights reserved.
*Other brands and names are the property of their respective owners.
ソフトウェア開発部門へのインパクト
                                 マルチコアのプロセッサは膨大な性能向上を提供できる
               マルチコアに対応していないアプリケーションは新しいプロセッサが登場しても速くならない。実際は遅くな
                                   るかもしれない!


        • マルチスレッド化は難しく、時間がかかり、バグを作りやすい
        • マルチスレッド化しただけではコア数に応じて性能が向上する
          アプリケーションは得られない
        • マルチスレッド化ではシングルコアで利用可能な並列性を利用
          できない
        • 現在のマルチコア用の方法ではアクセラレータには適用できな
          い
        • 各バーティカルのアプリケーションはそれぞれデータマネージメ
          ントやプロセッサ特有の開発に固有のチャレンジがある



          Software & Services Group, Developer Products Division
          Copyright © 2009, Intel Corporation. All rights reserved.

September *Other brands and names are the property of their respective owners.
          18, 2007                                     Copyright © 2007, RapidMind, Inc.
スケーラビリティー




                                 8X



パフォーマンス
“スケーリング”
                                 4X


                                  2X
                                 1X
                                        1      2               4          8

   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
主要な 5 つの並列化手法
いずれの手法を導入するか?
• メッセージ・パッシング
        – MPI、PVM
• 明示的なスレディング
        – Windows スレッド API、Pthreads、Solaris スレッド、
          Java スレッド・クラス
• コンパイラーのサポートと言語の拡張
        – 自動並列化、OpenMP、インテル・スレッディング・ビルディング・ブロッ
          ク
• 並列プログラミング言語
        – HPF、CAF、UPC、CxC、Cilk
• 並列マス・ライブラリー
        – ScaLAPACK、PARDISO、PLAPACK、PETsc

                                                                        2009/12/5
 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
インテルの HPC ツール




インテル® コンパイラー 11.1 日本語版をリリースしました

Software & Services Group, Developer Products Division
Copyright © 2009, Intel Corporation. All rights reserved.
*Other brands and names are the property of their respective owners.
インテル® Parallel Studio

• Windows* クライアント・アプリケーション開発者の
  並列化プログラミングをサポート




   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
細分化:
         目的に応じた 2 つの製品ライン

                                                     並列パフォーマンスを最大限に引き出す製品
                                                     Windows*/Linux*/Mac OS* X の C++ および
                                                     Fortran
                 販売中                                             継続的に投資...



                                                  並列による生産性を最大限に引き出す製品
                                                  Windows* の Visual Studio* を使用する C++
                                                  2009 年 5 月




Software & Services Group, Developer Products Division
Copyright © 2009, Intel Corporation. All rights reserved.
*Other brands and names are the property of their respective owners.
インテル® スレッディング・ビルディング・
 ブロック (インテル® TBB)

• 並列化向けに C++ を拡張
   • 複数の箇所で C++ の課題を解決
   • あらゆる C++ コンパイラー、プロセッサー、OS に移植可能。
     すでに幅広い移植実績有り!
• インテルが開始したオープン・ソース・プロジェクト
• インテル® Parallel Studio でフルサポート




   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
ツールが行うべき 支援


• シリアルプログラムの開発向けに設計された古いツールの
  使用では不十分
• 新しいツールの利点:
    • 並列化における 2 つの主要な課題 を支援:
      正当性とスケーラビリティ
    • 適切な抽象化を提供: 保守性、“将来への保証”




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
並列化を行うための開発ライフサイクル


                                  Find where to start
                                                                         設計
                                  parallelizing                          並列化の恩恵が得られる既存の
                                                                         ソースコード部分を特定

                                  Introduce threads,                     コーディング & デバッグ
                                  compile, and
                                  debug with the                         C/C++ コンパイラーと包括的な
                                  Intel® Parallel Composer               スレッド化ライブラリーで効率的な
                                                                         アプリケーションを開発
                                 Find threading and
                                 memory errors                           検証
                                 with the
                                 Intel® Parallel Inspector               並列メモリーエラーとスレッド化
                                                                         エラーを未然に防ぐ検証機能で
                                                                         アプリケーションの信頼性を確保
                                  Tune with the Intel®
                                  Parallel Amplifier  チューニング
                                                      直感的なパフォーマンス・アナライ
                                                      ザーとチューナーでアプリケーショ
                                                      ンを向上
  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
インテル® Parallel Studio
マルチコア並列化の直感的な開発ツール
Microsoft* Visual Studio* を使用して、Windows* 用の並列アプリケー
ションを作成する C++ アーキテクト、デベロッパー、ソフトウェア・イノベ
ーター向け




                                                            インテル® Parallel Studio は次の 3 製品で構成
                                                              されています。
                                                            • インテル® Parallel Composer
                                                            • インテル® Parallel Inspector
                                                            • インテル® Parallel Amplifier
                                                       • Microsoft* Visual Studio* プラグイン
                                                       • 並列化向けエンドツーエンド製品スイート
                                                       • 将来のメニーコア向けにスケーリング

   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
インテル® Parallel Composer
C/C++ コンパイラーと包括的なスレッド化ライブラリーで効率的な
アプリケーションを開発
                     Find where to start                                 • コーディング& デバッグフェーズ
                     parallelizing
                                                                         • 面倒な作業は尐なく、より良いスケーリ
                                                                           ングで Windows* アプリケーションへ
                     Introduce threads,                                    すぐに並列化を実装!
                     compile, and
                     debug with the                                      • 高度に最適化され、自動並列化機能を
                     Intel® Parallel Composer                              実装したC/C++ コンパイラー
                                                                             • OpenMP* サポート
                     Find threading and                                      • インテル® スレッディング・ビル
                     memory errors
                     with the
                                                                               ディング・ブロック (インテル®
                     Intel® Parallel Inspector                                 TBB)
                                                                             • インテル® インテグレーテッド・
                                                                               パフォーマンス・プリミティブ
                     Tune with the Intel®                                      (インテル® IPP)
                     Parallel Amplifier
                                                                             • 並列デバッガーを実装
                                                                         • 開発時間を短縮し生産性を向上



  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
インテル® Parallel Composer
OpenMPに対するKeyWord の拡張

                                                                         OpenMP 3.0 のtask 機能を簡易表記で利用するこ
                                                                         とが可能


      __taskcomplete {
         __task f_sum(500, a, b, c);
         __task f_sum(500, a+500, b+500, c+500);
       }



      void f_sum ( int length, int *a, int *b, int *c ) {
        int i;
        __par for (i=0; i<length; i++) {
          c[i] = a[i] + b[i];                                                     データ並列
          }                                                                       アルゴリズムに利用
      }




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.                   2009/12/5
インテル® Parallel Inspector
並列メモリーエラーとスレッド化エラーを未然に防止


                     Find where to start                                 • 検証フェーズ
                     parallelizing
                                                                         • スレッド化特有のエラーを素早く検出
                                                                         • メモリーエラーを点検
                     Introduce threads,
                     compile, and                                        • 標準的なデバッグビルドで動作
                     debug with the
                     Intel® Parallel Composer                            • コードを素早く分析
                                                                         • Windows* アプリケーションの信頼
                     Find threading and                                    性を確認するのに役立ちます
                     memory errors
                     with the                                            • アプリケーションを事前にテストし
                     Intel® Parallel Inspector
                                                                           十分にエラーチェックを行うことで、製
                                                                           品の品質向上に役立ちます
                     Tune with the Intel®
                     Parallel Amplifier




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
インテル® Parallel Inspector
スレッド化エラーを特定




                                                              スレッド化特有のエラーの位
                                                                 置と状態を表示




                                                                         コード行を素早く参照




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
17


インテル® Parallel Inspector
メモリーエラーの特定

                                                                                    メモリーリークの位置や
                                                                                       サイズを特定




                                                     観測結果により
                                                      問題を特定



                                                                         観測結果を特定の
                                                                          コードに縮小

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
インテル® Parallel Amplifier
直感的なパフォーマンス・アナライザーとチューナー


                     Find where to start
                                                                         • チューニング・フェーズ
                     parallelizing                                       • ボトルネックを素早く検知
                                                                         • アプリケーションのパフォーマンスを
                                                                           チューニング
                     Introduce threads,
                     compile, and                                        • アプリケーションのパフォーマンスを最適
                     debug with the                                        化
                     Intel® Parallel Composer
                                                                         • スケーリングのためのチューニング
                                                                         • 並列化アプリケーションのための設計
                     Find threading and
                     memory errors                                         • ホットスポット分析
                     with the
                     Intel® Parallel Inspector                             • コンカレンシー分析
                                                                           • ロック/待機分析
                     Tune with the Intel®                                – フレキシブルに分析
                     Parallel Amplifier
                                                                          • ソースコードを参照
                                                                          • 統計コールツリー
                                                                          • 複数の分析を比較


  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
インテル® Parallel Amplifier
hotspot 分析によるボトルネックの検出


                                   アプリケーションで時間がかかっている場所は?
                                     パフォーマンスに最もインパクトのある
                                   クリティカル・ファンクションを素早く見つけます




    どうしてそうなっているのか?
  クリティカル・ファンクションの使用を
 削減できそうな場所をコールスタックで
       ハイライトします




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
並列化の事前検証機能


                    Find where to start
                                                                        • “Think Parallel” をお手伝い
                    parallelizing
                                                                        • 並列化には魔法のようなソリューション
                                                                          があるわけではありません
                    Introduce threads,                                  • しかし、さまざまな役立つ方法がありま
                    compile, and
                    debug with the                                        す
                    Intel® Parallel Composer
                                                                        • 「役立つ方法」のリストは毎日増え続け
                                                                          ていて、お客様からのフィードバックを
                    Find threading and
                    memory errors                                         もとに強化されています
                    with the
                    Intel® Parallel Inspector                           • Parallel Studio リリース時に、
                                                                          Parallel Studio ユーザー限定で
                                                                          初回バージョンを公開予定です
                    Tune with the Intel®
                    Parallel Amplifier                                    Parallel Studio を拡張!
                                                                        • 並列化の概念は、実行前に、安全に
                                                                          モデル化し、測定し、テストします
                                次にプレビューをご紹介…

 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
Visual Studio* 2010 による並列化
  コミュニティー・テクノロジー・プレビュー

                     インテル® Parallel
   インテル®             Studio

    Parallel         Parallel
   Studio は          Inspector、
   VS2005、           Amplifier

   VS2008、
将来の VS2010
                     OpenMP*
  をサポート


                     インテル® TBB




                  インテルは
     Microsoft* Concurrency
          Runtime をサポート




       Software & Services Group, Developer Products Division
       Copyright © 2009, Intel Corporation. All rights reserved.
       *Other brands and names are the property of their respective owners.
インテル® ソフトウェア開発製品
関連書籍

                              インテル® Parallel Studio プログラミングガイド
                              Windows* C++ での並列プログラミングにおける最適な最初のステップ

                              著者: 池井 満、林 浩史 、田中 智子




                        インテル® スレッディング・                                   C/C++ プログラマーの
                        ビルディング・ブロック                                      ための OpenMP* 並列
                        マルチコア時代の C++ 並列                                  プログラミング
                        プログラミング                                          OpenMP* を詳説

                        著者: James Reinders                               著者: 菅原 清文




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
Ct テクノロジー:マルチコアおよびメニーコアプロセッサー
のための 高生産性 スループット・コンピューティング
池井 満
ソフトウェア&サービス統括本部部長
インテル株式会社

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
目次
概要
‐ Ctテクノロジーとは何?
‐ Ctテクノロジーがもたらす価値とは?
‐ Ctテクノロジーの主要な機能とは?またその利点とは?
‐ どのようなワークロードに向くのか
詳細
‐ Ctテクノロジーはどのようなもの?
‐ Ctテクノロジーはどうやって動く?
‐ どのようなツールをサポートするのか?




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        26
Ctテクノロジーとは何か?

• アプリケーション開発者を特定のハードウェア・アーキテク
  チャーに依存させない汎用のデータ・パラレル・プログラミン
  グの方法
• 既存の開発環境に統合することができ、それによってハイレ
  ベルで並列化アルゴリズムの仕様を定めさせることができる
  システム
• ハイレベルに記述した計算を効率的に並列化して実装できる
  動的コンパイラーとランタイムで、SIMDとスレッドレベルの並
  列化、およびアクセラレーターの両者の恩恵を受けることが
  できます。
• アプリケーション開発者が「パフォーマンス(性能)」、「ポータ
 ビリティー(移植性)」および「プロダクティビティー(生産性)」
 を両立させることができるシステムです。

 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        27
Ctテクノロジーがもたらす価値とは?

        Single source
                                                                        プロダクティビティー(生産性)
                                                                        ・既存のツールと統合
                                                                        ・多くの問題領域に適用可能
                                                                        ・基本的に安全:メンテナンス可能

                                                Future                  パフォーマンス(性能)
        CPU
                                                                        ・効率的でスケーラブル
                  SSE 4                                                 ・ベクターとスレッドの両方を利用する
                                                                        ・C++モジュール化のオーバーヘッドをなく
                                                                        す

           AVX                                                          ポータビリティー(移植性)
                                                                        ・ハイレベルな抽象化
                                                                        ・ハードウェアに依存しない
                                                                        ・フォワード・スケーリング




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                                                28
プロダクティビティー(生産性)

• 統合:既存のIDE、ツールやコンパイラーと統合:新しいコンパイラーは不要
  です
• 相互運用:他のインテル並列化ツールやライブラリーと相互に運用可能
• インクリメンタル:既存コードを基に選択的または目標を絞って修正が可能
• 豊かな表現:シンタックス(構文)はアプリケーションのエキスパートに配慮し
  てある
• 基本的に安全:決定論的なセマンティックスにより、レース状態やデッドロッ
  クは発生しない
• 簡単に学べる:逐次的で一貫性のあるセマンティックスとシンプルなインター
  フェースにより既存のスキルを活用できる
• 幅広く適用可能:汎用的なデータ並列化のモデルは、多くの種類の計算に
  適用可能




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
                                                                         29
パフォーマンス(性能)

• より大きな問題へとスケール可能:データを管理して、メモリーのボトルネッ
  クに直接対処する
• スレッドとベクトル化による協調した並列化:一つの記述により、複数のメカ
  ニズムを対象にできる
• モジュール化にともなうオーバーヘッドをなくす:自動的に複数のオペレー
  ションを融合させる
• 幅広く、なおかつ深く:開発者は抽象化のレベルを選ぶことができ、必要が
  あれば詳細にまで掘り下げることができる




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        30
ポータビリティー(移植性)

• ハイレベル:特定のハードウェアのメカニズムやアーキテクチャーに
  依存することがない
• ISA拡張からの独立:共通バイナリーは異なるISA拡張を透過的に利用
  可能である
• 今あるハードウェア上での使用が可能:多数のコアまでスケールして
  利用可能である
• 将来のハードウェアへの移行とフォワード・スケーリングが可能:
  AVX、Larrabee、とさらにその先の物もサポート予定




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        31
ハイレベルな抽象化によるプロダクティビティー
“何をするかを指定、どのように行うかではなく”


                                                                        数学的構造
                                                                        データ編成
数学的構造
                                                                        データレースはどこに?
データ編成
                                                                        デッドロックの原因は何?
                                                                        なぜこの計算を走らせる度に違う結
                                                                        果になるのか?
                                                                        いくつスレッドを使えばいい?
                                                                        キャッシュの大きさはどれくらい?
                                                                        いろんなISAやベクター幅にどうやっ
                                                                        て対応すればいい?
                                                                        もともとこのコードを書いた人はどこ
                                                                        ?コードが何の計算をやっているの
                                                                        かわからない!



                                                   注力:エキスパート・アプリケーション開
                                                   発者効率性を向上させる
 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                                             32
チャレンジ:
複数の並列化のメカニズム
 マルチコアのシステムには、並列化の方法が何種類もあります:
• パイプライン
• SIMDレジスター(SWAR)によるベクトル化
• スーパースカラー命令またはVLIW
• メモリーアクセスと計算をオーバーラップさせる(プリフェッチ)
• 1つのコア上でのマルチスレッディング(ハイパースレッディング)
• 複数のコア
• 複数のプロセッサー
• 非同期にホストとアクセラレーターで実行




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        33
利用可能
複数の並列化のメカニズム
解法: 潜在的な並列性とデータの局所性を指定する抽象的な記述を行い、それを
 自動的に複数の実装方法に適用してこれらの性質を全て活かす


ユーザーの定義:




プラットフォームの実装:
                                                                        実装の例:
                                                                        • 2コア
                                                                        • 4-way ベクトル化
                                                                        • ストリーミングによりメモリー待ち時間が
                                                                          隠ぺいされる

                                                                        実際の分配はハードウェアに依存する


 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                                                34
Ct vs. SSE 組み込み関数
                                                                                     #define NCO 4                                                     fptype * strike, fptype * rate, fptype * volatility,
                                                                                                                                                                          fptype * time, int * otype, float timet)
                                                                                     #if (NCO==2)                                                      {
                                                                                     #define fptype double                                                 int i;
                                                                                     #define SIMD_WIDTH 2                                              // local private working variables for the calculation
                                                                                     #define _MMR      __m128d                                             _MMR xStockPrice;
                                                                                     #define _MM_LOAD _mm_load_pd                                          _MMR xStrikePrice;
                                                                                     #define _MM_STORE _mm_store_pd                                        _MMR xRiskFreeRate;
                                                                                     #define _MM_MUL _mm_mul_pd                                            _MMR xVolatility;
                                                                                     #define _MM_ADD _mm_add_pd                                            _MMR xTime;
                                                                                     #define _MM_SUB _mm_sub_pd                                            _MMR xSqrtTime;
                                                                                     #define _MM_DIV _mm_div_pd
                                                                                     #define _MM_SQRT _mm_sqrt_pd                                        _MM_ALIGN16 fptype logValues[NCO];
                                                                                     #define _MM_SET(A) _mm_set_pd(A,A)                                  _MMR xLogTerm;
                                                                                     #define _MM_SETR _mm_set_pd                                         _MMR xD1, xD2;
                                                                                     #endif                                                              _MMR xPowerTerm;
                                                                                                                                                         _MMR xDen;
                                                                                     #if (NCO==4)                                                        _MM_ALIGN16 fptype d1[SIMD_WIDTH];
                                                                                     #define fptype float                                                _MM_ALIGN16 fptype d2[SIMD_WIDTH];
                                                                                     #define SIMD_WIDTH 4                                                _MM_ALIGN16 fptype FutureValueX[SIMD_WIDTH];
                                                                                     #define _MMR       __m128                                           _MM_ALIGN16 fptype NofXd1[SIMD_WIDTH];
                                                                                     #define _MM_LOAD _mm_load_ps                                        _MM_ALIGN16 fptype NofXd2[SIMD_WIDTH];
                                                                                     #define _MM_STORE _mm_store_ps                                      _MM_ALIGN16 fptype NegNofXd1[SIMD_WIDTH];
                                                                                     #define _MM_MUL _mm_mul_ps                                          _MM_ALIGN16 fptype NegNofXd2[SIMD_WIDTH];
                                                                                     #define _MM_ADD _mm_add_ps
                                                                                     #define _MM_SUB _mm_sub_ps                                          xStockPrice = _MM_LOAD(sptprice);
                                                                                     #define _MM_DIV _mm_div_ps                                          xStrikePrice = _MM_LOAD(strike);
   template <typename T>                                                             #define _MM_SQRT _mm_sqrt_ps                                        xRiskFreeRate = _MM_LOAD(rate);
   Vec<T> CND(Vec<T> x)                                                              #define _MM_SET(A) _mm_set_ps(A,A,A,A)                              xVolatility = _MM_LOAD(volatility);
   {                                                                                 #define _MM_SETR _mm_set_ps                                         xTime = _MM_LOAD(time);
     Vec<T> l = abs(x);                                                              #endif
     Vec<T> k = 1.0f / ( 1.0f + 0.2316419f * l);                                                                                                         xSqrtTime = _MM_SQRT(xTime);
                                                                                     __forceinline void CNDF ( fptype * OutputX, fptype * InputX )
       Vec<T> w =                                                                    {                                                                   for(i=0; i<SIMD_WIDTH;i ++) {
         0.31938153f * k -                                                             _MM_ALIGN16 int sign[SIMD_WIDTH];                                    logValues[i] = log(sptprice[i] / strike[i]);
         0.356563782f * k * k +                                                        int i;                                                            }
         1.781477937f * k * k * k -                                                    _MMR xInput;
         1.821255978f * k * k * k * k +                                                _MMR xNPrimeofX;                                                  xLogTerm = _MM_LOAD(&(logValues[0]));
         1.330274429f * k * k * k * k * k;                                             _MM_ALIGN16 fptype expValues[SIMD_WIDTH];
                                                                                       _MMR xK2;                                                          xPowerTerm = _MM_MUL(xVolatility, xVolatility);
       w = w * inv_sqrt_2xPI * exp(l * l * -0.5f);                                     _MMR xK2_2, xK2_3, xK2_4, xK2_5;                                   xPowerTerm = _MM_MUL(xPowerTerm, _MM_SET(0.5));
       w = select(x > 0, 1.0f - w, w);                                                 _MMR xLocal, xLocal_1, xLocal_2, xLocal_3;                         // xPowerTerm = _mm_div_pd(xPowerTerm, _MM_SET(2.0,




                     Ct                                                                                                     SSE
       return w;                                                                                                                                       2.0));
   }                                                                                     for (i=0; i<SIMD_WIDTH; i++) {
                                                                                            // Check for negative value of InputX                        xD1 = _MM_ADD(xRiskFreeRate, xPowerTerm);
   template <typename T>                                                                    if (InputX[i] < 0.0) {                                       xD2 = _MM_SUB(xRiskFreeRate, xPowerTerm);
   void ctBlackScholesKern(Vec<T> s,                                                            InputX[i] = -InputX[i];
               Vec<T> x,                                                                        sign[i] = 1;                                             xD1 = _MM_MUL(xD1, xTime);
               Vec<T> r,                                                                    } else                                                       xD2 = _MM_MUL(xD2, xTime);
               Vec<T> v,                                                                        sign[i] = 0;
               Vec<T> t,                                                                 }                                                               xD1 = _MM_ADD(xD1, xLogTerm);
               Vec<T>& result)                                                                                                                           xD2 = _MM_ADD(xD2, xLogTerm);
   {                                                                                     xInput = _MM_LOAD(InputX);
        Vec<T> sqrt_value = v * sqrt(t);                                                                                                                 xDen = _MM_MUL(xVolatility, xSqrtTime);
        Vec<T> d1 = ln(s / x) + (r + v * v * 0.5f ) * t) / sqrt_value;                 // Compute NPrimeX term common to both four & six decimal         xD1 = _MM_DIV(xD1, xDen);
        Vec<T> d2 = d1 - sqrt_value;                                                 accuracy calcs                                                      // VL: 10/15/06. An optimization is not to recompute xD2, but to
                                                                                       for (i=0; i<SIMD_WIDTH; i++) {                                  derive it from xD1
         result = x * exp(0f - r * t) * (1.0f - CND(d2)) + (-s) * (1.0 - CND(d1));        expValues[i] = exp(-0.5f * InputX[i] * InputX[i]);             // xD2 = _MM_DIV(xD2, xDen);
   }                                                                                      // printf("exp[%d]: %f¥n", i, expValues[i]);                   xD2 = _MM_SUB(xD1, xDen);
                                                                                       }
                                                                                                                                                         _MM_STORE(d1, xD1);
   template <typename T>                                                               xNPrimeofX = _MM_LOAD(expValues);                                 _MM_STORE(d2, xD2);
   void ctBlackScholes(T *option_price, int num_options,                               xNPrimeofX = _MM_MUL(xNPrimeofX,
                T *stkprice, T *strike,     T *rate, T *volatility,                  _MM_SET(inv_sqrt_2xPI));                                            CNDF( NofXd1, d1 );
                T *time)                                                                                                                                 CNDF( NofXd2, d2 );
   {                                                                                    xK2 = _MM_MUL(_MM_SET((fptype)0.2316419), xInput);
        Vec<T> s(stkprice, num_options);                                                xK2 = _MM_ADD(xK2, _MM_SET((fptype)1.0));                        for (i=0; i<SIMD_WIDTH; i++) {
        Vec<T> x(strike, num_options);                                                  xK2 = _MM_DIV(_MM_SET((fptype)1.0), xK2);                           FutureValueX[i] = strike[i] * (exp(-(rate[i])*(time[i])));
        Vec<T> r(rate, num_options);                                                    // xK2 = _mm_rcp_pd(xK2); // No rcp function for double-
        Vec<T> v(volatility, num_options);                                           precision                                                              NegNofXd1[i] = ((fptype)1.0 - (NofXd1[i]));
        Vec<T> t(time, num_options);                                                                                                                        NegNofXd2[i] = ((fptype)1.0 - (NofXd2[i]));
        Vec<T> result(option_price, num_options);                                        xK2_2 = _MM_MUL(xK2, xK2);                                         OptionPrice[i] = (FutureValueX[i] * NegNofXd2[i]) -
        rcall( ctBlackScholesKern<T> )( s,x,r,v,t,result );                              xK2_3 = _MM_MUL(xK2_2, xK2);                                  (sptprice[i] * NegNofXd1[i]);
   }                                                                                     xK2_4 = _MM_MUL(xK2_3, xK2);                                     }
                                                                                         xK2_5 = _MM_MUL(xK2_4, xK2);                                  }

                                                                                        xLocal_1 = _MM_MUL(xK2, _MM_SET((fptype)0.319381530));         void sseBlackScholes(fptype *option_price,
                                                                                        xLocal_2 = _MM_MUL(xK2_2, _MM_SET((fptype)-                                   int num_options,




   42 lines 
                                                                                     0.356563782));                                                                   fptype *stkprice,
                                                                                        xLocal_3 = _MM_MUL(xK2_3,                                                     fptype *strike,
                                                                                     _MM_SET((fptype)1.781477937));                                                   fptype *rate,
                                                                                        xLocal_2 = _MM_ADD(xLocal_2, xLocal_3);                                       fptype *volatility,
                                                                                        xLocal_3 = _MM_MUL(xK2_4, _MM_SET((fptype)-                                   fptype *time)
                                                                                     1.821255978));                                                    {




   • ベクトル化
                                                                                        xLocal_2 = _MM_ADD(xLocal_2, xLocal_3);                           for (int i = 0; i < num_options; i += NCO) {
                                                                                        xLocal_3 = _MM_MUL(xK2_5,                                            // Calling main function to calculate option value based on
                                                                                     _MM_SET((fptype)1.330274429));                                    Black & Sholes's
                                                                                        xLocal_2 = _MM_ADD(xLocal_2, xLocal_3);                              // equation.
                                                                                                                                                             BlkSchlsEqEuroNoDiv(&(option_price[i]), NCO, &(stkprice[i]),
                                                                                         xLocal_1 = _MM_ADD(xLocal_2, xLocal_1);                       &(strike[i]),




   • スレッド化
                                                                                         xLocal = _MM_MUL(xLocal_1, xNPrimeofX);                                              &(rate[i]), &(volatility[i]), &(time[i]),
                                                                                         xLocal = _MM_SUB(_MM_SET((fptype)1.0), xLocal);               NULL/*&(otype[i])*/, 0);
                                                                                                                                                          }
                                                                                         _MM_STORE(OutputX, xLocal);                                   }




                                                                                                                                                                                  186 lines 
                                                                                         // _mm_storel_pd(&OutputX[0], xLocal);
                                                                                         // _mm_storeh_pd(&OutputX[1], xLocal);




   • マシン非依存
                                                                                         for (i=0; i<SIMD_WIDTH; i++) {
                                                                                            if (sign[i]) {
                                                                                                OutputX[i] = ((fptype)1.0 - OutputX[i]);




                                                                                                                                                                                  • ベクトル化
                                                                                           }
                                                                                         }
                                                                                     }

                                                                                     void BlkSchlsEqEuroNoDiv (fptype * OptionPrice, int numOptions,
                                                                                     fptype * sptprice,




                                                                                                                                                                                  • 非 スレッド化
                                                                                                                                                                                  • マシン依存

Software & Services Group, Developer Products Division
Copyright © 2009, Intel Corporation. All rights reserved.
*Other brands and names are the property of their respective owners.
                                                                                                                                                                                                                            35
Ctによるフォワード・スケーリング                                                        Ct
                                                                         Source

• ソースファイルを一度だけコンパイ
  ルする                                                                             Ct
                                                                                  Binary
• 動的に再最適化される:
  – より多くのコア
  – より大きいキャッシュ
  – より広いバンド幅
  – より多くの命令セット拡張




Ct はムーアの法則と共に、スループットとビジュアル・コンピューティングのためにソフト
ウェアをフォワード・スケールさせる

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
                                                                                           36
両方の良いところをとりましょう

                                                                         性能    性能
                                                                 生産性
                                                                   生産性            生産性と性能
                  属性                  属性                                   (スレッドとイントリ
                                                                    (スレッドとイントリ
                                                              (数学/スクリプト言語)
                                                       (数学/スクリプト言語)             (Ctテクノロジー)
                                                                       ンシック) ンシック)
                可読性                 可読性
            明確で理解できる表記法
     明確で理解できる表記法

                 決定性                 決定性
            入力に対する出力結果が
     入力に対する出力結果が
         常に一致   常に一致

                正確さ                 正確さ
       誤りをもたらす主要因を取り除けるか
誤りをもたらす主要因を取り除けるか
                  性能                  性能
           最高の絶対性能最高の絶対性能
             スケーラビリティ
       スケーラビリティ
                増加するコア数を
         増加するコア数を
               活用する能力がある
        活用する能力がある
                保守性                 保守性
             メンテし易い メンテし易い

Provides excellent support                          Provides something in-between   Provides little or no support


   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
                                                                                                                    37
何に活用できるのか?



生物情報学                                                                     ビジュアル・コンピューティング
・ゲノミクスと遺伝子配列分析                                                            ・デジタル・コンテンツ・クリエイション(DCC)
・分子力学                                                                     ・物理エンジンと高度なレンダリング
工学設計                                                                      ・可視化
・有限要素と有限差分シミュレーション                                                        ・圧縮/解凍
・モンテカルロ・シミュレーション                                                          信号処理画像処理
財務分析                                                                      ・コンピューター・ビジョン
・オプションと証券の値付け                                                             ・レーダーとソナー処理
・リスク分析                                                                    ・顕微鏡画像や衛星画像処理
石油とガス                                                                     科学研究
・地震時の状況再現                                                                 ・学習機械と人工知能
・貯留層シミュレーション                                                              ・気候と天候シミュレーション
医療画像                                                                      ・惑星探査と天体物理学
・画像と体積の再現                                                                 企業
・分析とコンピューター支援検出(CAD)                                                      ・データベース検索
                                                                          ・企業情報



   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
                                                                                                     38
スループットとビジュアル・コンピューティング・アプリケーション


                                                                                    エンターテイメント              “RMS” アプリケーション
                                                                                                              Recognition(認識)
                                                                                                                  Mining(検索)
                                      TIPS                                                            学習と旅行     Synthesis(合成)
       IPS = Instruction per second




                                                       RMS                                                          パーソナルメディア
計算性能




                               GIPS                                                                                 作成と管理

                                                    3D &
                                                    Video
                                                                                    Tera-scale
                                  MIPS        Mult-
                                              Media                Multi-core

                                             Text
                                      KIPS
                                                     Single Core
                                                                                                                        医療
                                             Kilobytes Megabytes                          Gigabytes     Terabytes
                                                                                    データの大きさ

                        Software & Services Group, Developer Products Division
                        Copyright © 2009, Intel Corporation. All rights reserved.
                        *Other brands and names are the property of their respective owners.
                                                                                                                                39
パフォーマンスによって広がる新しい可能性




 不規則な/疎データの                                新しい並列演算と                    JITにより並列化を   コア数の増加に伴って
    並列データ                                   データ構造                         補強          スケールする
  (例:顔面認識)




Software & Services Group, Developer Products Division
Copyright © 2009, Intel Corporation. All rights reserved.
*Other brands and names are the property of their respective owners.
                                                                                                 40
アプリケーションの例




医療用画像処理                                                                 財務分析




 *Sentinelle Medicalのご厚意によりデータを提供いただきました




 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                               41
Ctテクノロジーは

コードを自動並列化するものではありません
 – Ctは効果的な並列化コードを効率よく書くためのサポートを提供しま
      す
タスク並列化によるものではありません
 – タスク並列化では、大量のプロセッサー上で性能をスケールさせること
   は難しい
 – デッドロックやデータレースなどはデバッグが難しい
 – Ct “デフォルトで安全な”データ並列化に重点を置いています
新しい言語ではありません
 – 既存の標準C++コンパイラー環境内で動作します
 – CtはC++に新しいタイプとオペレーションを追加します



 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        42
Ctテクノロジー: システム・コンポーネント

     プログラミン                                            • ユーザーは逐次的で一貫性のあるセマンティックスを用いて並列化コードを記
                                                         述します
     グ・モデル                                             • シングル・アサイメントと独立したデータスペースによって安全性を持つ




                                                       • 並列収集型と暗示的な並列化オペレーションを持つ
      インターフェイス                                         • Cの制御構造そのまま使用します




                                                       • 一部のコード・カーネルにのみ適用可能であり、アプリケーション全体に影響

               API                                       しない
                                                       • ユーザーは既存のコンパイラーを使用してアプリケーションのビルドが可能



                                                       • ハイレベルでのインターフェース抽象化により下層のハードウェアの詳細から

     HWの抽象化
                                                         解放
                                                       • 将来リリースされるプロセッサーやプラットフォーム上でもスケールする
                                                         (フォワード・スケーリング)




     Software & Services Group, Developer Products Division
     Copyright © 2009, Intel Corporation. All rights reserved.

43   *Other brands and names are the property of their respective owners.
                                                                                               43
インターフェイス:言語としてのAPI
C++を拡張するシンタックスとセマンティクス
C++に並列集合オブジェクトとメソッドを追加する
 – テンプレートと、演算子の多重定義を使用して新しい型と演算を定義
標準C++コンパイラー環境内で動作します
 – インテル® C++コンパイラー
 – Microsoft* Visual* C++ コンパイラー
 – Gnu Compiler Collection*
数学的表記を使用してアルゴリズムを表現します
 – 開発者は、「どうやって行うか」ではなく、「何をするか」に集中できる
シーケンシャルなセマンティックスを使用する
 – 開発者はスレッドやロック、または低レベルの機構を使わずにすみ、それらに伴
   う複雑性を回避することができる



プログラマは並列化ではなく、処理の流れを考えられる

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
                                                                         44
インターフェイス:プログラミング言語としてのAPI
C++を拡張するシンタックスとセマンティクス

データ                                                                      演算
 データは隔離された「データスペー                                                        演算はCt コレクションと/または
  ス」保持され、収集クラスによって管                                                        スカラー型を通じたオペレーショ
  理されます
                                                                           ンにて、C++関数として記述さ
 規則的なデータ:                                                                 れる。
  –     Vec: 1Dデータの塊
  –     Vec2D: 2Dデータの塊                                                    コンポーネントごとと集合オペ
  –     Vec3D: 3Dデータの塊
                                                                           レーションの両方をサポート
  –     Tuple: 固定長 n組                                                     演算が呼び出される要素
 不規則なデータ:                                                                – Map: 配列の全ての要素上で関数
                                                                            を並列に実行
  – VecIndexed, VecNested
                                                                          – Call: 並列オペレーションを逐次実
                                                                            行




  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
                                                                                                  45
集合オブジェクト

Vecは基本的な並列集合オブジェ                                                          #include "ct.h“
                                                                          using namespace Ct;
クト型
• 値に対する呼び名                                                                int main(int argc, char *argv[])
                                                                          {
• ランタイムによって管理される                                                            // A Vec declaration must specify a base

• フラット、複数次元、または不規
                                                                            // type: Vec<basetype> aTypedVector;


則な入れ子                                                                         // For example, DoubleVec can refer to any
                                                                              // vector of doubles.
• API を介して排他的に生成そして                                                           Vec<F64> DoubleVec;
操作される
                                                                              // A regular 2 dimensional vector:
  –決定性と分離                                                                     Vec2D<I8> 2DMatrix (“{{0,1,2}, {3,4,5},
                                                                              {6,7,8}}”);
  –パフォーマンス追及のために上書きや
  直接操作
                                                                              //An irregularly nested vector:
                                                                              VecNested<I32> IrregularVector (“{{0,1,2},
                                                                              {3,4}, {5,6,7,8}}”);

                                                                              return 0;
「デフォルトで安全」を提供する                                                           }


   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
                                                                                                                           46
並列集合上での演算


                    規則的な Vecs                                                             不規則 Vecs


      Vec


                                      Vec2D
                                                                                                    VecNested

                                                                           VecIndexed
      Vec3D
                                                                                           & 増殖中…
                                                                           Priorities: VecSparse, Vec2DSparse, VecND
                            Vec<Tuple<…>>

repeatCol, shuffle, transpose, swapRows, shift, rotate, scatter, …



    Software & Services Group, Developer Products Division
    Copyright © 2009, Intel Corporation. All rights reserved.
    *Other brands and names are the property of their respective owners.
                                                                                                                       47
Ctにおける演算の表現

Ct のJIT が変換を自動的に行う
  Vector Processing                                     Scalar Processing     Native/Intrinsic Coding




                                                                                    CMP
                                                                                    cviVPREFETCH
                                                                                    cviFMADD
                                                                                    INC
                                                                                    JMP




                     F32 kernel(F32 a, b, c, d) {                           STRIP<F32>native(
                       return a + (b/c)*d;                                    STRIP<F32> a, b, c, d) {
Vec<F32> A, B, C, D;                                                          __asm__ {
                     }
A += B/C * D;                                                                                       …
                     …
 またはプログラマーが適切なレベルの抽象化を行う
                     Vec<F32> A, B, C, D;                                              };
                                                                            }
                     A = map(kernel)(A, B, C, D);
                                                                            …
                                                                            Vec<F32> A, B, C, D;
                                                                            A = nmap(native)(A, B, C, D);



   Software & Services Group, Developer Products Division
   Copyright © 2009, Intel Corporation. All rights reserved.
   *Other brands and names are the property of their respective owners.
                                                                                                            48
どのようにして動作するのか?

逐次プログラム                                                                         CPU

              シリアルなC++アプリ                                • テンプレート
              に組み込まれたCtカー                                • オーバロードさ
              ネル                                           れた演算子

              標準的な C++ コ
              ンパイラ                                     • 動的にライブラ
                                                         リとリンク



              Ct ランタイム                            • 動的なコンパイラ
                                                  • スレッド化と異機種                         将来製品
                                                    用ランタイム




                                                                         将来製品

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
                                                                                             49
Ct 動的処理実行

int ar_a[1024], ar_b[1024]


Vec<I32> va(ar_a, …);
Vec<I32> vb(ar_b,…);
rcall( work ) ( va, vb );




                        Ct 動的処理
                               エンジン



       Software & Services Group, Developer Products Division
       Copyright © 2009, Intel Corporation. All rights reserved.
       *Other brands and names are the property of their respective owners.
                                                                              50
Ct 動的処理実行

int ar_a[1024], ar_b[1024]


Vec<I32> va(ar_a, …);
Vec<I32> vb(ar_b,…);
rcall( work ) ( va, vb );




                                                           Memory Manager
                                                            a
                                                                b
                      Ct 動的処理
                         エンジン


       Software & Services Group, Developer Products Division
       Copyright © 2009, Intel Corporation. All rights reserved.
       *Other brands and names are the property of their respective owners.
                                                                              51
Ct 動的処理実行
int ar_a[1024], ar_b[1024]


Vec<I32> va(ar_a, …);
                                                                           IR Builder
Vec<I32> vb(ar_b,…);
rcall( work ) ( va, vb );




void work( Vec<I32> a,
     Vec<I32> & b )
{
   b = a + 1;
}




                                                                  Memory Manager
                                                                   a
                                                                       b
                             Ct 動的処理
                                エンジン


              Software & Services Group, Developer Products Division
              Copyright © 2009, Intel Corporation. All rights reserved.
              *Other brands and names are the property of their respective owners.
                                                                                        52
Ct 動的処理実行
int ar_a[1024], ar_b[1024]


Vec<I32> va(ar_a, …);
                                                                            IR Builder
Vec<I32> vb(ar_b,…);
rcall( work ) ( va, vb );

                                                                       V1            1


                                                                              +
void work( Vec<I32> a,
     Vec<I32> & b )
{                                                                              V2
   b = a + 1;
}




                                                                  Memory Manager
                                                                   a
                                                                       b
                             Ct 動的処理
                                エンジン


              Software & Services Group, Developer Products Division
              Copyright © 2009, Intel Corporation. All rights reserved.
              *Other brands and names are the property of their respective owners.
                                                                                         53
Ct 動的処理実行

int ar_a[1024], ar_b[1024]                                                        Trigger JIT
                                                                     IR Builder                 JIT
Vec<I32> va(ar_a, …);
                                                                V1            1
Vec<I32> vb(ar_b,…);
rcall( work ) ( va, vb );
                                                                       +

void work( Vec<I32> a,
     Vec<I32> & b )
                                                                        V2
{
   b = a + 1;
}




                                                           Memory Manager
                                                            a
                                                                b
                         Ct 動的処理
                            エンジン


       Software & Services Group, Developer Products Division
       Copyright © 2009, Intel Corporation. All rights reserved.
       *Other brands and names are the property of their respective owners.
                                                                                                      54
Ct 動的処理実行

int ar_a[1024], ar_b[1024]                                                        JIT が動作
                                                                     IR Builder                   JIT
Vec<I32> va(ar_a, …);                                                                        ハイレベル最適化
                                                                V1            1
Vec<I32> vb(ar_b,…);
rcall( work ) ( va, vb );
                                                                       +                     ローレベル最適化


void work( Vec<I32> a,                                                                        CVI コード生成
     Vec<I32> & b )
                                                                        V2
{
   b = a + 1;
}                                                                                           SSE   LNI   AVX


                                                           Memory Manager
                                                            a
                                                                b
                         Ct 動的処理
                            エンジン


       Software & Services Group, Developer Products Division
       Copyright © 2009, Intel Corporation. All rights reserved.
       *Other brands and names are the property of their respective owners.
                                                                                                              55
Ct ランタイム
                                                                         Application
                                                                          C++ APIs
                                                                                                 他言語のバインディン
• インテルCtテクノロジーでは、                                                        calling Ct APIs
                                                                                                 グ
  ランタイム付きの標準規格に
  準拠したC++ライブラリーを                                                         JIT Compiler
  提供しています
                                                                          Virtual Machine

• ランタイムは以下のようにス                                                             Virtual   Debug/   Memory
                                                                                                         Backend
                                                                                                                    Threading
                                                                                                           JIT
  レッドやベクターコードを生成                                                            ISA        Svcs    Manager
                                                                                                         Compiler
                                                                                                                     Runtime


  し管理します
  – ハードウェアに依存しない最適化
  – 管理の軽減
  – 特定のハードウェアのためのコード
    生成と最適化
  – (TBBをもとにした!)スケーラブル
    なスレッド化ランタイム


                                                                            CPU          アクセラレータ               将来製品

  Software & Services Group, Developer Products Division
  Copyright © 2009, Intel Corporation. All rights reserved.
  *Other brands and names are the property of their respective owners.
                                                                                                                                56
Ct 動的エンジンの意味

実行時に第2ステージのコンパイル
     実行時に実装に特化できる
Ct カーネル:C関数として存在するが、
 •      1度だけ実行=>動的コンパイルのため
 •      演算を記号としてキャプチャーする
 •      現行のバインディングと状態のスナップショットを取
        得する
Ct コール:実行は遠隔関数コール
 •      データフロー依存関係を察知
 •      自動(そして常に安全な)同期
 •      遠隔実行とデータ保存を可能に
 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        57
なぜこれが重要なのか?

広く使われているライブラリーほど、よくデザインされた
汎用的なインターフェースやモジュール化と引き換えにパ
フォーマンスを妥協している
 – 仮想関数呼び出し、関数ポインター、そして制御フローはランタイ
   ム時にしか分からないパラメーターに依存しており、パフォーマン
   スを制限しうる
 – モジュール性は本来的に様々な処理に分散してしまう
 – 極端なケースでは、アプリケーションは実行時に決められる計算を
   適宜実行しているにすぎない
動的コンパイルは、「遅延結合」のオーバーヘッドを
 「コンパイル・アウト」できる
この利点によって、並列化を増大化させる作用がある


 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        58
IDEサポート
  Ctテクノロジーをお気に入りの開発環
  境で使用可能


   • Ctデータ構造の表示をユーザーが制御
   • 表示フォーマットを選択 例:イメージ、スプレッ
     ドシート
   • Ct演算またはIDEからインタラクティブに起動
     例:Microsoft* Visual Studio*
   • 変換ステップを可視化できます
   • これはプログラム開発生産性向上ための重要
     な機能です




*Other names and brands may be claimed as the property of others.




        Software & Services Group, Developer Products Division
        Copyright © 2009, Intel Corporation. All rights reserved.
        *Other brands and names are the property of their respective owners.
                                                                               59
まとめ

• Ct テクノロジーはマルチコアへのアクセスを容易にし、
  データ並列化のアプリケーションのための異機種環境で
  のメニーコア並列化を容易にします
• 逐次セマンティックスは並列プログラミングする負担を
  軽減します
• 「デフォルトで安全」によって、悩ましいデータレース
  やデッドロックを回避できます
• 今日、Ctテクノロジーで書かれたコードは、新しくリ
  リースされるメニーコア・プロセッサー上でもスケール
  する(フォワード・スケーリング)



 Software & Services Group, Developer Products Division
 Copyright © 2009, Intel Corporation. All rights reserved.
 *Other brands and names are the property of their respective owners.
                                                                        60

Contenu connexe

Tendances

Tendances (8)

Android™組込み開発基礎コース BeagleBoard編
Android™組込み開発基礎コース BeagleBoard編Android™組込み開発基礎コース BeagleBoard編
Android™組込み開発基礎コース BeagleBoard編
 
基礎から学ぶ組み込みAndroid
基礎から学ぶ組み込みAndroid基礎から学ぶ組み込みAndroid
基礎から学ぶ組み込みAndroid
 
20160619_LPICl304 技術解説セミナー in AP浜松町
20160619_LPICl304 技術解説セミナー in AP浜松町20160619_LPICl304 技術解説セミナー in AP浜松町
20160619_LPICl304 技術解説セミナー in AP浜松町
 
Androidアプリケーション開発中級研修 後編
Androidアプリケーション開発中級研修 後編Androidアプリケーション開発中級研修 後編
Androidアプリケーション開発中級研修 後編
 
はじめてのMercurial/Bitbucket
はじめてのMercurial/BitbucketはじめてのMercurial/Bitbucket
はじめてのMercurial/Bitbucket
 
ngCore engine for mobage platform
ngCore engine for mobage platformngCore engine for mobage platform
ngCore engine for mobage platform
 
Lightweight Language Diverプレゼン資料:アプリケーションのIPv6対応のススメ(LL編)
Lightweight Language Diverプレゼン資料:アプリケーションのIPv6対応のススメ(LL編)Lightweight Language Diverプレゼン資料:アプリケーションのIPv6対応のススメ(LL編)
Lightweight Language Diverプレゼン資料:アプリケーションのIPv6対応のススメ(LL編)
 
エンジニアという職業について
エンジニアという職業についてエンジニアという職業について
エンジニアという職業について
 

En vedette (9)

Vsug architect academy_sakakibara_20101016
Vsug architect academy_sakakibara_20101016Vsug architect academy_sakakibara_20101016
Vsug architect academy_sakakibara_20101016
 
Windows Azure Programming
Windows Azure ProgrammingWindows Azure Programming
Windows Azure Programming
 
Vsug2011 lt
Vsug2011 ltVsug2011 lt
Vsug2011 lt
 
Dynamic Data
Dynamic DataDynamic Data
Dynamic Data
 
Vsugアーキテクトアカデミー設立のご挨拶
Vsugアーキテクトアカデミー設立のご挨拶Vsugアーキテクトアカデミー設立のご挨拶
Vsugアーキテクトアカデミー設立のご挨拶
 
Vsugday ichigan
Vsugday ichiganVsugday ichigan
Vsugday ichigan
 
VSUG DAY_ ICHIGAN
VSUG DAY_ ICHIGANVSUG DAY_ ICHIGAN
VSUG DAY_ ICHIGAN
 
OpenStackベースのハイブリッド・クラウドで変わるITの姿
OpenStackベースのハイブリッド・クラウドで変わるITの姿OpenStackベースのハイブリッド・クラウドで変わるITの姿
OpenStackベースのハイブリッド・クラウドで変わるITの姿
 
さようなら、オートシェイプ
さようなら、オートシェイプさようなら、オートシェイプ
さようなら、オートシェイプ
 

Similaire à Parallel Technology

関数型言語ElixirのIoTシステム開発への展開
関数型言語ElixirのIoTシステム開発への展開関数型言語ElixirのIoTシステム開発への展開
関数型言語ElixirのIoTシステム開発への展開
Hideki Takase
 
dstn交流会_data_spider 3.0最新情報とデモ
dstn交流会_data_spider 3.0最新情報とデモdstn交流会_data_spider 3.0最新情報とデモ
dstn交流会_data_spider 3.0最新情報とデモ
dstn
 
Aws summits2014 nttデータaws上のシステムはこう作る!
Aws summits2014 nttデータaws上のシステムはこう作る!Aws summits2014 nttデータaws上のシステムはこう作る!
Aws summits2014 nttデータaws上のシステムはこう作る!
Boss4434
 

Similaire à Parallel Technology (20)

Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
 
技術選択とアーキテクトの役割
技術選択とアーキテクトの役割技術選択とアーキテクトの役割
技術選択とアーキテクトの役割
 
DBTS2015 Tokyo DBAが知っておくべき最新テクノロジー
DBTS2015 Tokyo DBAが知っておくべき最新テクノロジーDBTS2015 Tokyo DBAが知っておくべき最新テクノロジー
DBTS2015 Tokyo DBAが知っておくべき最新テクノロジー
 
[Oracle Innovation Summit Tokyo 2018] Fn Project: Next Generation Serverless ...
[Oracle Innovation Summit Tokyo 2018] Fn Project: Next Generation Serverless ...[Oracle Innovation Summit Tokyo 2018] Fn Project: Next Generation Serverless ...
[Oracle Innovation Summit Tokyo 2018] Fn Project: Next Generation Serverless ...
 
Ruby コミュニティの文化に学ぶエンタープライズシステム開発の処方箋
Ruby コミュニティの文化に学ぶエンタープライズシステム開発の処方箋Ruby コミュニティの文化に学ぶエンタープライズシステム開発の処方箋
Ruby コミュニティの文化に学ぶエンタープライズシステム開発の処方箋
 
【QCon】 Get Clean, Stay Clean 価値を向上し続けるための秘訣 #QConTokyo
【QCon】 Get Clean, Stay Clean 価値を向上し続けるための秘訣 #QConTokyo 【QCon】 Get Clean, Stay Clean 価値を向上し続けるための秘訣 #QConTokyo
【QCon】 Get Clean, Stay Clean 価値を向上し続けるための秘訣 #QConTokyo
 
[OracleCodeTokyo2019] Kubernetesで実現する運用自動化の新しいアプローチとは
[OracleCodeTokyo2019] Kubernetesで実現する運用自動化の新しいアプローチとは[OracleCodeTokyo2019] Kubernetesで実現する運用自動化の新しいアプローチとは
[OracleCodeTokyo2019] Kubernetesで実現する運用自動化の新しいアプローチとは
 
【de:code 2020】 AI on IA 最新情報 ~ CPU で AI を上手に動かすための 5 つのヒント ~
【de:code 2020】 AI on IA 最新情報 ~ CPU で AI を上手に動かすための 5 つのヒント ~【de:code 2020】 AI on IA 最新情報 ~ CPU で AI を上手に動かすための 5 つのヒント ~
【de:code 2020】 AI on IA 最新情報 ~ CPU で AI を上手に動かすための 5 つのヒント ~
 
エバンジェリストが語るパワーシステム特論 ~ 第1回:IBMオフコンはいかにして生き残れたのか?
エバンジェリストが語るパワーシステム特論 ~ 第1回:IBMオフコンはいかにして生き残れたのか?エバンジェリストが語るパワーシステム特論 ~ 第1回:IBMオフコンはいかにして生き残れたのか?
エバンジェリストが語るパワーシステム特論 ~ 第1回:IBMオフコンはいかにして生き残れたのか?
 
関数型言語ElixirのIoTシステム開発への展開
関数型言語ElixirのIoTシステム開発への展開関数型言語ElixirのIoTシステム開発への展開
関数型言語ElixirのIoTシステム開発への展開
 
EMF勉強会
EMF勉強会EMF勉強会
EMF勉強会
 
DeNA流cocos2d xとの付き合い方
DeNA流cocos2d xとの付き合い方DeNA流cocos2d xとの付き合い方
DeNA流cocos2d xとの付き合い方
 
エバンジェリストが語るパワーシステム特論 ~ 第3回:IBMオフコンはいかにして生き残れたのか?~第二章~
エバンジェリストが語るパワーシステム特論 ~ 第3回:IBMオフコンはいかにして生き残れたのか?~第二章~エバンジェリストが語るパワーシステム特論 ~ 第3回:IBMオフコンはいかにして生き残れたのか?~第二章~
エバンジェリストが語るパワーシステム特論 ~ 第3回:IBMオフコンはいかにして生き残れたのか?~第二章~
 
AZAREA-Cluster (Hadoop Conference Japan 2013 Winter)
AZAREA-Cluster (Hadoop Conference Japan 2013 Winter)AZAREA-Cluster (Hadoop Conference Japan 2013 Winter)
AZAREA-Cluster (Hadoop Conference Japan 2013 Winter)
 
dstn交流会_data_spider 3.0最新情報とデモ
dstn交流会_data_spider 3.0最新情報とデモdstn交流会_data_spider 3.0最新情報とデモ
dstn交流会_data_spider 3.0最新情報とデモ
 
Aws summits2014 nttデータaws上のシステムはこう作る!
Aws summits2014 nttデータaws上のシステムはこう作る!Aws summits2014 nttデータaws上のシステムはこう作る!
Aws summits2014 nttデータaws上のシステムはこう作る!
 
最近のWeb関連技術の動向あれこれ
最近のWeb関連技術の動向あれこれ最近のWeb関連技術の動向あれこれ
最近のWeb関連技術の動向あれこれ
 
OpenVINOとAzure こう連携できるのでは?
OpenVINOとAzure こう連携できるのでは?OpenVINOとAzure こう連携できるのでは?
OpenVINOとAzure こう連携できるのでは?
 
チラシルiOSでの広告枠開発
チラシルiOSでの広告枠開発チラシルiOSでの広告枠開発
チラシルiOSでの広告枠開発
 
第4回「クラウドを支えるKVMの現在と未来」(2011/07/07 on しすなま!)
第4回「クラウドを支えるKVMの現在と未来」(2011/07/07 on しすなま!)第4回「クラウドを支えるKVMの現在と未来」(2011/07/07 on しすなま!)
第4回「クラウドを支えるKVMの現在と未来」(2011/07/07 on しすなま!)
 

Dernier

Dernier (12)

NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 

Parallel Technology

  • 1. 並列化のロードマップ: 今後のインテルソフトウェア開発製品について 池井 満 ソフトウェア&サービス統括本部部長 インテル株式会社 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 2. Legal Disclaimer INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Performance tests and ratings are measured using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware or software design or configuration may affect actual performance. Buyers should consult other sources of information to evaluate the performance of systems or components they are considering purchasing. For more information on performance tests and on the performance of Intel products, reference www.intel.com/software/products. Intel, Intel Core and the Intel logo are trademarks of Intel Corporation in the U.S. and other countries. *Other names and brands may be claimed as the property of others. Copyright © 2009. Intel Corporation. http://intel.com/software/products Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 2
  • 3. マルチコアとメニーコア Memory Controller M M i i s c s c インテル® Core™ i7 プロセッサー コア コア Q コア コア I u I O e O u e Q Q P P I I Shared L3 Cache 0 1 Larrabee✝ ✝開発コード名 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 4. ほとんどのプロセッサーが 並列プロセッサー Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 5. ソフトウェア開発部門へのインパクト マルチコアのプロセッサは膨大な性能向上を提供できる マルチコアに対応していないアプリケーションは新しいプロセッサが登場しても速くならない。実際は遅くな るかもしれない! • マルチスレッド化は難しく、時間がかかり、バグを作りやすい • マルチスレッド化しただけではコア数に応じて性能が向上する アプリケーションは得られない • マルチスレッド化ではシングルコアで利用可能な並列性を利用 できない • 現在のマルチコア用の方法ではアクセラレータには適用できな い • 各バーティカルのアプリケーションはそれぞれデータマネージメ ントやプロセッサ特有の開発に固有のチャレンジがある Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. September *Other brands and names are the property of their respective owners. 18, 2007 Copyright © 2007, RapidMind, Inc.
  • 6. スケーラビリティー 8X パフォーマンス “スケーリング” 4X 2X 1X 1 2 4 8 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 7. 主要な 5 つの並列化手法 いずれの手法を導入するか? • メッセージ・パッシング – MPI、PVM • 明示的なスレディング – Windows スレッド API、Pthreads、Solaris スレッド、 Java スレッド・クラス • コンパイラーのサポートと言語の拡張 – 自動並列化、OpenMP、インテル・スレッディング・ビルディング・ブロッ ク • 並列プログラミング言語 – HPF、CAF、UPC、CxC、Cilk • 並列マス・ライブラリー – ScaLAPACK、PARDISO、PLAPACK、PETsc 2009/12/5 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 8. インテルの HPC ツール インテル® コンパイラー 11.1 日本語版をリリースしました Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 9. インテル® Parallel Studio • Windows* クライアント・アプリケーション開発者の 並列化プログラミングをサポート Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 10. 細分化: 目的に応じた 2 つの製品ライン 並列パフォーマンスを最大限に引き出す製品 Windows*/Linux*/Mac OS* X の C++ および Fortran 販売中 継続的に投資... 並列による生産性を最大限に引き出す製品 Windows* の Visual Studio* を使用する C++ 2009 年 5 月 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 11. インテル® スレッディング・ビルディング・ ブロック (インテル® TBB) • 並列化向けに C++ を拡張 • 複数の箇所で C++ の課題を解決 • あらゆる C++ コンパイラー、プロセッサー、OS に移植可能。 すでに幅広い移植実績有り! • インテルが開始したオープン・ソース・プロジェクト • インテル® Parallel Studio でフルサポート Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 12. ツールが行うべき 支援 • シリアルプログラムの開発向けに設計された古いツールの 使用では不十分 • 新しいツールの利点: • 並列化における 2 つの主要な課題 を支援: 正当性とスケーラビリティ • 適切な抽象化を提供: 保守性、“将来への保証” Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 13. 並列化を行うための開発ライフサイクル Find where to start 設計 parallelizing 並列化の恩恵が得られる既存の ソースコード部分を特定 Introduce threads, コーディング & デバッグ compile, and debug with the C/C++ コンパイラーと包括的な Intel® Parallel Composer スレッド化ライブラリーで効率的な アプリケーションを開発 Find threading and memory errors 検証 with the Intel® Parallel Inspector 並列メモリーエラーとスレッド化 エラーを未然に防ぐ検証機能で アプリケーションの信頼性を確保 Tune with the Intel® Parallel Amplifier チューニング 直感的なパフォーマンス・アナライ ザーとチューナーでアプリケーショ ンを向上 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 14. インテル® Parallel Studio マルチコア並列化の直感的な開発ツール Microsoft* Visual Studio* を使用して、Windows* 用の並列アプリケー ションを作成する C++ アーキテクト、デベロッパー、ソフトウェア・イノベ ーター向け インテル® Parallel Studio は次の 3 製品で構成 されています。 • インテル® Parallel Composer • インテル® Parallel Inspector • インテル® Parallel Amplifier • Microsoft* Visual Studio* プラグイン • 並列化向けエンドツーエンド製品スイート • 将来のメニーコア向けにスケーリング Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 15. インテル® Parallel Composer C/C++ コンパイラーと包括的なスレッド化ライブラリーで効率的な アプリケーションを開発 Find where to start • コーディング& デバッグフェーズ parallelizing • 面倒な作業は尐なく、より良いスケーリ ングで Windows* アプリケーションへ Introduce threads, すぐに並列化を実装! compile, and debug with the • 高度に最適化され、自動並列化機能を Intel® Parallel Composer 実装したC/C++ コンパイラー • OpenMP* サポート Find threading and • インテル® スレッディング・ビル memory errors with the ディング・ブロック (インテル® Intel® Parallel Inspector TBB) • インテル® インテグレーテッド・ パフォーマンス・プリミティブ Tune with the Intel® (インテル® IPP) Parallel Amplifier • 並列デバッガーを実装 • 開発時間を短縮し生産性を向上 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 16. インテル® Parallel Composer OpenMPに対するKeyWord の拡張 OpenMP 3.0 のtask 機能を簡易表記で利用するこ とが可能 __taskcomplete { __task f_sum(500, a, b, c); __task f_sum(500, a+500, b+500, c+500); } void f_sum ( int length, int *a, int *b, int *c ) { int i; __par for (i=0; i<length; i++) { c[i] = a[i] + b[i]; データ並列 } アルゴリズムに利用 } Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 2009/12/5
  • 17. インテル® Parallel Inspector 並列メモリーエラーとスレッド化エラーを未然に防止 Find where to start • 検証フェーズ parallelizing • スレッド化特有のエラーを素早く検出 • メモリーエラーを点検 Introduce threads, compile, and • 標準的なデバッグビルドで動作 debug with the Intel® Parallel Composer • コードを素早く分析 • Windows* アプリケーションの信頼 Find threading and 性を確認するのに役立ちます memory errors with the • アプリケーションを事前にテストし Intel® Parallel Inspector 十分にエラーチェックを行うことで、製 品の品質向上に役立ちます Tune with the Intel® Parallel Amplifier Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 18. インテル® Parallel Inspector スレッド化エラーを特定 スレッド化特有のエラーの位 置と状態を表示 コード行を素早く参照 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 19. 17 インテル® Parallel Inspector メモリーエラーの特定 メモリーリークの位置や サイズを特定 観測結果により 問題を特定 観測結果を特定の コードに縮小 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 20. インテル® Parallel Amplifier 直感的なパフォーマンス・アナライザーとチューナー Find where to start • チューニング・フェーズ parallelizing • ボトルネックを素早く検知 • アプリケーションのパフォーマンスを チューニング Introduce threads, compile, and • アプリケーションのパフォーマンスを最適 debug with the 化 Intel® Parallel Composer • スケーリングのためのチューニング • 並列化アプリケーションのための設計 Find threading and memory errors • ホットスポット分析 with the Intel® Parallel Inspector • コンカレンシー分析 • ロック/待機分析 Tune with the Intel® – フレキシブルに分析 Parallel Amplifier • ソースコードを参照 • 統計コールツリー • 複数の分析を比較 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 21. インテル® Parallel Amplifier hotspot 分析によるボトルネックの検出 アプリケーションで時間がかかっている場所は? パフォーマンスに最もインパクトのある クリティカル・ファンクションを素早く見つけます どうしてそうなっているのか? クリティカル・ファンクションの使用を 削減できそうな場所をコールスタックで ハイライトします Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 22. 並列化の事前検証機能 Find where to start • “Think Parallel” をお手伝い parallelizing • 並列化には魔法のようなソリューション があるわけではありません Introduce threads, • しかし、さまざまな役立つ方法がありま compile, and debug with the す Intel® Parallel Composer • 「役立つ方法」のリストは毎日増え続け ていて、お客様からのフィードバックを Find threading and memory errors もとに強化されています with the Intel® Parallel Inspector • Parallel Studio リリース時に、 Parallel Studio ユーザー限定で 初回バージョンを公開予定です Tune with the Intel® Parallel Amplifier Parallel Studio を拡張! • 並列化の概念は、実行前に、安全に モデル化し、測定し、テストします 次にプレビューをご紹介… Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 23. Visual Studio* 2010 による並列化 コミュニティー・テクノロジー・プレビュー インテル® Parallel インテル® Studio Parallel Parallel Studio は Inspector、 VS2005、 Amplifier VS2008、 将来の VS2010 OpenMP* をサポート インテル® TBB インテルは Microsoft* Concurrency Runtime をサポート Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 24. インテル® ソフトウェア開発製品 関連書籍 インテル® Parallel Studio プログラミングガイド Windows* C++ での並列プログラミングにおける最適な最初のステップ 著者: 池井 満、林 浩史 、田中 智子 インテル® スレッディング・ C/C++ プログラマーの ビルディング・ブロック ための OpenMP* 並列 マルチコア時代の C++ 並列 プログラミング プログラミング OpenMP* を詳説 著者: James Reinders 著者: 菅原 清文 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 25. Ct テクノロジー:マルチコアおよびメニーコアプロセッサー のための 高生産性 スループット・コンピューティング 池井 満 ソフトウェア&サービス統括本部部長 インテル株式会社 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 26. 目次 概要 ‐ Ctテクノロジーとは何? ‐ Ctテクノロジーがもたらす価値とは? ‐ Ctテクノロジーの主要な機能とは?またその利点とは? ‐ どのようなワークロードに向くのか 詳細 ‐ Ctテクノロジーはどのようなもの? ‐ Ctテクノロジーはどうやって動く? ‐ どのようなツールをサポートするのか? Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 26
  • 27. Ctテクノロジーとは何か? • アプリケーション開発者を特定のハードウェア・アーキテク チャーに依存させない汎用のデータ・パラレル・プログラミン グの方法 • 既存の開発環境に統合することができ、それによってハイレ ベルで並列化アルゴリズムの仕様を定めさせることができる システム • ハイレベルに記述した計算を効率的に並列化して実装できる 動的コンパイラーとランタイムで、SIMDとスレッドレベルの並 列化、およびアクセラレーターの両者の恩恵を受けることが できます。 • アプリケーション開発者が「パフォーマンス(性能)」、「ポータ ビリティー(移植性)」および「プロダクティビティー(生産性)」 を両立させることができるシステムです。 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 27
  • 28. Ctテクノロジーがもたらす価値とは? Single source プロダクティビティー(生産性) ・既存のツールと統合 ・多くの問題領域に適用可能 ・基本的に安全:メンテナンス可能 Future パフォーマンス(性能) CPU ・効率的でスケーラブル SSE 4 ・ベクターとスレッドの両方を利用する ・C++モジュール化のオーバーヘッドをなく す AVX ポータビリティー(移植性) ・ハイレベルな抽象化 ・ハードウェアに依存しない ・フォワード・スケーリング Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 28
  • 29. プロダクティビティー(生産性) • 統合:既存のIDE、ツールやコンパイラーと統合:新しいコンパイラーは不要 です • 相互運用:他のインテル並列化ツールやライブラリーと相互に運用可能 • インクリメンタル:既存コードを基に選択的または目標を絞って修正が可能 • 豊かな表現:シンタックス(構文)はアプリケーションのエキスパートに配慮し てある • 基本的に安全:決定論的なセマンティックスにより、レース状態やデッドロッ クは発生しない • 簡単に学べる:逐次的で一貫性のあるセマンティックスとシンプルなインター フェースにより既存のスキルを活用できる • 幅広く適用可能:汎用的なデータ並列化のモデルは、多くの種類の計算に 適用可能 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 29
  • 30. パフォーマンス(性能) • より大きな問題へとスケール可能:データを管理して、メモリーのボトルネッ クに直接対処する • スレッドとベクトル化による協調した並列化:一つの記述により、複数のメカ ニズムを対象にできる • モジュール化にともなうオーバーヘッドをなくす:自動的に複数のオペレー ションを融合させる • 幅広く、なおかつ深く:開発者は抽象化のレベルを選ぶことができ、必要が あれば詳細にまで掘り下げることができる Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 30
  • 31. ポータビリティー(移植性) • ハイレベル:特定のハードウェアのメカニズムやアーキテクチャーに 依存することがない • ISA拡張からの独立:共通バイナリーは異なるISA拡張を透過的に利用 可能である • 今あるハードウェア上での使用が可能:多数のコアまでスケールして 利用可能である • 将来のハードウェアへの移行とフォワード・スケーリングが可能: AVX、Larrabee、とさらにその先の物もサポート予定 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 31
  • 32. ハイレベルな抽象化によるプロダクティビティー “何をするかを指定、どのように行うかではなく” 数学的構造 データ編成 数学的構造 データレースはどこに? データ編成 デッドロックの原因は何? なぜこの計算を走らせる度に違う結 果になるのか? いくつスレッドを使えばいい? キャッシュの大きさはどれくらい? いろんなISAやベクター幅にどうやっ て対応すればいい? もともとこのコードを書いた人はどこ ?コードが何の計算をやっているの かわからない! 注力:エキスパート・アプリケーション開 発者効率性を向上させる Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 32
  • 33. チャレンジ: 複数の並列化のメカニズム マルチコアのシステムには、並列化の方法が何種類もあります: • パイプライン • SIMDレジスター(SWAR)によるベクトル化 • スーパースカラー命令またはVLIW • メモリーアクセスと計算をオーバーラップさせる(プリフェッチ) • 1つのコア上でのマルチスレッディング(ハイパースレッディング) • 複数のコア • 複数のプロセッサー • 非同期にホストとアクセラレーターで実行 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 33
  • 34. 利用可能 複数の並列化のメカニズム 解法: 潜在的な並列性とデータの局所性を指定する抽象的な記述を行い、それを 自動的に複数の実装方法に適用してこれらの性質を全て活かす ユーザーの定義: プラットフォームの実装: 実装の例: • 2コア • 4-way ベクトル化 • ストリーミングによりメモリー待ち時間が 隠ぺいされる 実際の分配はハードウェアに依存する Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 34
  • 35. Ct vs. SSE 組み込み関数 #define NCO 4 fptype * strike, fptype * rate, fptype * volatility, fptype * time, int * otype, float timet) #if (NCO==2) { #define fptype double int i; #define SIMD_WIDTH 2 // local private working variables for the calculation #define _MMR __m128d _MMR xStockPrice; #define _MM_LOAD _mm_load_pd _MMR xStrikePrice; #define _MM_STORE _mm_store_pd _MMR xRiskFreeRate; #define _MM_MUL _mm_mul_pd _MMR xVolatility; #define _MM_ADD _mm_add_pd _MMR xTime; #define _MM_SUB _mm_sub_pd _MMR xSqrtTime; #define _MM_DIV _mm_div_pd #define _MM_SQRT _mm_sqrt_pd _MM_ALIGN16 fptype logValues[NCO]; #define _MM_SET(A) _mm_set_pd(A,A) _MMR xLogTerm; #define _MM_SETR _mm_set_pd _MMR xD1, xD2; #endif _MMR xPowerTerm; _MMR xDen; #if (NCO==4) _MM_ALIGN16 fptype d1[SIMD_WIDTH]; #define fptype float _MM_ALIGN16 fptype d2[SIMD_WIDTH]; #define SIMD_WIDTH 4 _MM_ALIGN16 fptype FutureValueX[SIMD_WIDTH]; #define _MMR __m128 _MM_ALIGN16 fptype NofXd1[SIMD_WIDTH]; #define _MM_LOAD _mm_load_ps _MM_ALIGN16 fptype NofXd2[SIMD_WIDTH]; #define _MM_STORE _mm_store_ps _MM_ALIGN16 fptype NegNofXd1[SIMD_WIDTH]; #define _MM_MUL _mm_mul_ps _MM_ALIGN16 fptype NegNofXd2[SIMD_WIDTH]; #define _MM_ADD _mm_add_ps #define _MM_SUB _mm_sub_ps xStockPrice = _MM_LOAD(sptprice); #define _MM_DIV _mm_div_ps xStrikePrice = _MM_LOAD(strike); template <typename T> #define _MM_SQRT _mm_sqrt_ps xRiskFreeRate = _MM_LOAD(rate); Vec<T> CND(Vec<T> x) #define _MM_SET(A) _mm_set_ps(A,A,A,A) xVolatility = _MM_LOAD(volatility); { #define _MM_SETR _mm_set_ps xTime = _MM_LOAD(time); Vec<T> l = abs(x); #endif Vec<T> k = 1.0f / ( 1.0f + 0.2316419f * l); xSqrtTime = _MM_SQRT(xTime); __forceinline void CNDF ( fptype * OutputX, fptype * InputX ) Vec<T> w = { for(i=0; i<SIMD_WIDTH;i ++) { 0.31938153f * k - _MM_ALIGN16 int sign[SIMD_WIDTH]; logValues[i] = log(sptprice[i] / strike[i]); 0.356563782f * k * k + int i; } 1.781477937f * k * k * k - _MMR xInput; 1.821255978f * k * k * k * k + _MMR xNPrimeofX; xLogTerm = _MM_LOAD(&(logValues[0])); 1.330274429f * k * k * k * k * k; _MM_ALIGN16 fptype expValues[SIMD_WIDTH]; _MMR xK2; xPowerTerm = _MM_MUL(xVolatility, xVolatility); w = w * inv_sqrt_2xPI * exp(l * l * -0.5f); _MMR xK2_2, xK2_3, xK2_4, xK2_5; xPowerTerm = _MM_MUL(xPowerTerm, _MM_SET(0.5)); w = select(x > 0, 1.0f - w, w); _MMR xLocal, xLocal_1, xLocal_2, xLocal_3; // xPowerTerm = _mm_div_pd(xPowerTerm, _MM_SET(2.0, Ct SSE return w; 2.0)); } for (i=0; i<SIMD_WIDTH; i++) { // Check for negative value of InputX xD1 = _MM_ADD(xRiskFreeRate, xPowerTerm); template <typename T> if (InputX[i] < 0.0) { xD2 = _MM_SUB(xRiskFreeRate, xPowerTerm); void ctBlackScholesKern(Vec<T> s, InputX[i] = -InputX[i]; Vec<T> x, sign[i] = 1; xD1 = _MM_MUL(xD1, xTime); Vec<T> r, } else xD2 = _MM_MUL(xD2, xTime); Vec<T> v, sign[i] = 0; Vec<T> t, } xD1 = _MM_ADD(xD1, xLogTerm); Vec<T>& result) xD2 = _MM_ADD(xD2, xLogTerm); { xInput = _MM_LOAD(InputX); Vec<T> sqrt_value = v * sqrt(t); xDen = _MM_MUL(xVolatility, xSqrtTime); Vec<T> d1 = ln(s / x) + (r + v * v * 0.5f ) * t) / sqrt_value; // Compute NPrimeX term common to both four & six decimal xD1 = _MM_DIV(xD1, xDen); Vec<T> d2 = d1 - sqrt_value; accuracy calcs // VL: 10/15/06. An optimization is not to recompute xD2, but to for (i=0; i<SIMD_WIDTH; i++) { derive it from xD1 result = x * exp(0f - r * t) * (1.0f - CND(d2)) + (-s) * (1.0 - CND(d1)); expValues[i] = exp(-0.5f * InputX[i] * InputX[i]); // xD2 = _MM_DIV(xD2, xDen); } // printf("exp[%d]: %f¥n", i, expValues[i]); xD2 = _MM_SUB(xD1, xDen); } _MM_STORE(d1, xD1); template <typename T> xNPrimeofX = _MM_LOAD(expValues); _MM_STORE(d2, xD2); void ctBlackScholes(T *option_price, int num_options, xNPrimeofX = _MM_MUL(xNPrimeofX, T *stkprice, T *strike, T *rate, T *volatility, _MM_SET(inv_sqrt_2xPI)); CNDF( NofXd1, d1 ); T *time) CNDF( NofXd2, d2 ); { xK2 = _MM_MUL(_MM_SET((fptype)0.2316419), xInput); Vec<T> s(stkprice, num_options); xK2 = _MM_ADD(xK2, _MM_SET((fptype)1.0)); for (i=0; i<SIMD_WIDTH; i++) { Vec<T> x(strike, num_options); xK2 = _MM_DIV(_MM_SET((fptype)1.0), xK2); FutureValueX[i] = strike[i] * (exp(-(rate[i])*(time[i]))); Vec<T> r(rate, num_options); // xK2 = _mm_rcp_pd(xK2); // No rcp function for double- Vec<T> v(volatility, num_options); precision NegNofXd1[i] = ((fptype)1.0 - (NofXd1[i])); Vec<T> t(time, num_options); NegNofXd2[i] = ((fptype)1.0 - (NofXd2[i])); Vec<T> result(option_price, num_options); xK2_2 = _MM_MUL(xK2, xK2); OptionPrice[i] = (FutureValueX[i] * NegNofXd2[i]) - rcall( ctBlackScholesKern<T> )( s,x,r,v,t,result ); xK2_3 = _MM_MUL(xK2_2, xK2); (sptprice[i] * NegNofXd1[i]); } xK2_4 = _MM_MUL(xK2_3, xK2); } xK2_5 = _MM_MUL(xK2_4, xK2); } xLocal_1 = _MM_MUL(xK2, _MM_SET((fptype)0.319381530)); void sseBlackScholes(fptype *option_price, xLocal_2 = _MM_MUL(xK2_2, _MM_SET((fptype)- int num_options, 42 lines  0.356563782)); fptype *stkprice, xLocal_3 = _MM_MUL(xK2_3, fptype *strike, _MM_SET((fptype)1.781477937)); fptype *rate, xLocal_2 = _MM_ADD(xLocal_2, xLocal_3); fptype *volatility, xLocal_3 = _MM_MUL(xK2_4, _MM_SET((fptype)- fptype *time) 1.821255978)); { • ベクトル化 xLocal_2 = _MM_ADD(xLocal_2, xLocal_3); for (int i = 0; i < num_options; i += NCO) { xLocal_3 = _MM_MUL(xK2_5, // Calling main function to calculate option value based on _MM_SET((fptype)1.330274429)); Black & Sholes's xLocal_2 = _MM_ADD(xLocal_2, xLocal_3); // equation. BlkSchlsEqEuroNoDiv(&(option_price[i]), NCO, &(stkprice[i]), xLocal_1 = _MM_ADD(xLocal_2, xLocal_1); &(strike[i]), • スレッド化 xLocal = _MM_MUL(xLocal_1, xNPrimeofX); &(rate[i]), &(volatility[i]), &(time[i]), xLocal = _MM_SUB(_MM_SET((fptype)1.0), xLocal); NULL/*&(otype[i])*/, 0); } _MM_STORE(OutputX, xLocal); } 186 lines  // _mm_storel_pd(&OutputX[0], xLocal); // _mm_storeh_pd(&OutputX[1], xLocal); • マシン非依存 for (i=0; i<SIMD_WIDTH; i++) { if (sign[i]) { OutputX[i] = ((fptype)1.0 - OutputX[i]); • ベクトル化 } } } void BlkSchlsEqEuroNoDiv (fptype * OptionPrice, int numOptions, fptype * sptprice, • 非 スレッド化 • マシン依存 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 35
  • 36. Ctによるフォワード・スケーリング Ct Source • ソースファイルを一度だけコンパイ ルする Ct Binary • 動的に再最適化される: – より多くのコア – より大きいキャッシュ – より広いバンド幅 – より多くの命令セット拡張 Ct はムーアの法則と共に、スループットとビジュアル・コンピューティングのためにソフト ウェアをフォワード・スケールさせる Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 36
  • 37. 両方の良いところをとりましょう 性能 性能 生産性 生産性 生産性と性能 属性 属性 (スレッドとイントリ (スレッドとイントリ (数学/スクリプト言語) (数学/スクリプト言語) (Ctテクノロジー) ンシック) ンシック) 可読性 可読性 明確で理解できる表記法 明確で理解できる表記法 決定性 決定性 入力に対する出力結果が 入力に対する出力結果が 常に一致 常に一致 正確さ 正確さ 誤りをもたらす主要因を取り除けるか 誤りをもたらす主要因を取り除けるか 性能 性能 最高の絶対性能最高の絶対性能 スケーラビリティ スケーラビリティ 増加するコア数を 増加するコア数を 活用する能力がある 活用する能力がある 保守性 保守性 メンテし易い メンテし易い Provides excellent support Provides something in-between Provides little or no support Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 37
  • 38. 何に活用できるのか? 生物情報学 ビジュアル・コンピューティング ・ゲノミクスと遺伝子配列分析 ・デジタル・コンテンツ・クリエイション(DCC) ・分子力学 ・物理エンジンと高度なレンダリング 工学設計 ・可視化 ・有限要素と有限差分シミュレーション ・圧縮/解凍 ・モンテカルロ・シミュレーション 信号処理画像処理 財務分析 ・コンピューター・ビジョン ・オプションと証券の値付け ・レーダーとソナー処理 ・リスク分析 ・顕微鏡画像や衛星画像処理 石油とガス 科学研究 ・地震時の状況再現 ・学習機械と人工知能 ・貯留層シミュレーション ・気候と天候シミュレーション 医療画像 ・惑星探査と天体物理学 ・画像と体積の再現 企業 ・分析とコンピューター支援検出(CAD) ・データベース検索 ・企業情報 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 38
  • 39. スループットとビジュアル・コンピューティング・アプリケーション エンターテイメント “RMS” アプリケーション Recognition(認識) Mining(検索) TIPS 学習と旅行 Synthesis(合成) IPS = Instruction per second RMS パーソナルメディア 計算性能 GIPS 作成と管理 3D & Video Tera-scale MIPS Mult- Media Multi-core Text KIPS Single Core 医療 Kilobytes Megabytes Gigabytes Terabytes データの大きさ Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 39
  • 40. パフォーマンスによって広がる新しい可能性 不規則な/疎データの 新しい並列演算と JITにより並列化を コア数の増加に伴って 並列データ データ構造 補強 スケールする (例:顔面認識) Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 40
  • 41. アプリケーションの例 医療用画像処理 財務分析 *Sentinelle Medicalのご厚意によりデータを提供いただきました Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 41
  • 42. Ctテクノロジーは コードを自動並列化するものではありません – Ctは効果的な並列化コードを効率よく書くためのサポートを提供しま す タスク並列化によるものではありません – タスク並列化では、大量のプロセッサー上で性能をスケールさせること は難しい – デッドロックやデータレースなどはデバッグが難しい – Ct “デフォルトで安全な”データ並列化に重点を置いています 新しい言語ではありません – 既存の標準C++コンパイラー環境内で動作します – CtはC++に新しいタイプとオペレーションを追加します Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 42
  • 43. Ctテクノロジー: システム・コンポーネント プログラミン • ユーザーは逐次的で一貫性のあるセマンティックスを用いて並列化コードを記 述します グ・モデル • シングル・アサイメントと独立したデータスペースによって安全性を持つ • 並列収集型と暗示的な並列化オペレーションを持つ インターフェイス • Cの制御構造そのまま使用します • 一部のコード・カーネルにのみ適用可能であり、アプリケーション全体に影響 API しない • ユーザーは既存のコンパイラーを使用してアプリケーションのビルドが可能 • ハイレベルでのインターフェース抽象化により下層のハードウェアの詳細から HWの抽象化 解放 • 将来リリースされるプロセッサーやプラットフォーム上でもスケールする (フォワード・スケーリング) Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. 43 *Other brands and names are the property of their respective owners. 43
  • 44. インターフェイス:言語としてのAPI C++を拡張するシンタックスとセマンティクス C++に並列集合オブジェクトとメソッドを追加する – テンプレートと、演算子の多重定義を使用して新しい型と演算を定義 標準C++コンパイラー環境内で動作します – インテル® C++コンパイラー – Microsoft* Visual* C++ コンパイラー – Gnu Compiler Collection* 数学的表記を使用してアルゴリズムを表現します – 開発者は、「どうやって行うか」ではなく、「何をするか」に集中できる シーケンシャルなセマンティックスを使用する – 開発者はスレッドやロック、または低レベルの機構を使わずにすみ、それらに伴 う複雑性を回避することができる プログラマは並列化ではなく、処理の流れを考えられる Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 44
  • 45. インターフェイス:プログラミング言語としてのAPI C++を拡張するシンタックスとセマンティクス データ 演算  データは隔離された「データスペー  演算はCt コレクションと/または ス」保持され、収集クラスによって管 スカラー型を通じたオペレーショ 理されます ンにて、C++関数として記述さ  規則的なデータ: れる。 – Vec: 1Dデータの塊 – Vec2D: 2Dデータの塊  コンポーネントごとと集合オペ – Vec3D: 3Dデータの塊 レーションの両方をサポート – Tuple: 固定長 n組  演算が呼び出される要素  不規則なデータ: – Map: 配列の全ての要素上で関数 を並列に実行 – VecIndexed, VecNested – Call: 並列オペレーションを逐次実 行 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 45
  • 46. 集合オブジェクト Vecは基本的な並列集合オブジェ #include "ct.h“ using namespace Ct; クト型 • 値に対する呼び名 int main(int argc, char *argv[]) { • ランタイムによって管理される // A Vec declaration must specify a base • フラット、複数次元、または不規 // type: Vec<basetype> aTypedVector; 則な入れ子 // For example, DoubleVec can refer to any // vector of doubles. • API を介して排他的に生成そして Vec<F64> DoubleVec; 操作される // A regular 2 dimensional vector: –決定性と分離 Vec2D<I8> 2DMatrix (“{{0,1,2}, {3,4,5}, {6,7,8}}”); –パフォーマンス追及のために上書きや 直接操作 //An irregularly nested vector: VecNested<I32> IrregularVector (“{{0,1,2}, {3,4}, {5,6,7,8}}”); return 0; 「デフォルトで安全」を提供する } Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 46
  • 47. 並列集合上での演算 規則的な Vecs 不規則 Vecs Vec Vec2D VecNested VecIndexed Vec3D & 増殖中… Priorities: VecSparse, Vec2DSparse, VecND Vec<Tuple<…>> repeatCol, shuffle, transpose, swapRows, shift, rotate, scatter, … Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 47
  • 48. Ctにおける演算の表現 Ct のJIT が変換を自動的に行う Vector Processing Scalar Processing Native/Intrinsic Coding CMP cviVPREFETCH cviFMADD INC JMP F32 kernel(F32 a, b, c, d) { STRIP<F32>native( return a + (b/c)*d; STRIP<F32> a, b, c, d) { Vec<F32> A, B, C, D; __asm__ { } A += B/C * D; … … またはプログラマーが適切なレベルの抽象化を行う Vec<F32> A, B, C, D; }; } A = map(kernel)(A, B, C, D); … Vec<F32> A, B, C, D; A = nmap(native)(A, B, C, D); Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 48
  • 49. どのようにして動作するのか? 逐次プログラム CPU シリアルなC++アプリ • テンプレート に組み込まれたCtカー • オーバロードさ ネル れた演算子 標準的な C++ コ ンパイラ • 動的にライブラ リとリンク Ct ランタイム • 動的なコンパイラ • スレッド化と異機種 将来製品 用ランタイム 将来製品 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 49
  • 50. Ct 動的処理実行 int ar_a[1024], ar_b[1024] Vec<I32> va(ar_a, …); Vec<I32> vb(ar_b,…); rcall( work ) ( va, vb ); Ct 動的処理 エンジン Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 50
  • 51. Ct 動的処理実行 int ar_a[1024], ar_b[1024] Vec<I32> va(ar_a, …); Vec<I32> vb(ar_b,…); rcall( work ) ( va, vb ); Memory Manager a b Ct 動的処理 エンジン Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 51
  • 52. Ct 動的処理実行 int ar_a[1024], ar_b[1024] Vec<I32> va(ar_a, …); IR Builder Vec<I32> vb(ar_b,…); rcall( work ) ( va, vb ); void work( Vec<I32> a, Vec<I32> & b ) { b = a + 1; } Memory Manager a b Ct 動的処理 エンジン Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 52
  • 53. Ct 動的処理実行 int ar_a[1024], ar_b[1024] Vec<I32> va(ar_a, …); IR Builder Vec<I32> vb(ar_b,…); rcall( work ) ( va, vb ); V1 1 + void work( Vec<I32> a, Vec<I32> & b ) { V2 b = a + 1; } Memory Manager a b Ct 動的処理 エンジン Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 53
  • 54. Ct 動的処理実行 int ar_a[1024], ar_b[1024] Trigger JIT IR Builder JIT Vec<I32> va(ar_a, …); V1 1 Vec<I32> vb(ar_b,…); rcall( work ) ( va, vb ); + void work( Vec<I32> a, Vec<I32> & b ) V2 { b = a + 1; } Memory Manager a b Ct 動的処理 エンジン Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 54
  • 55. Ct 動的処理実行 int ar_a[1024], ar_b[1024] JIT が動作 IR Builder JIT Vec<I32> va(ar_a, …); ハイレベル最適化 V1 1 Vec<I32> vb(ar_b,…); rcall( work ) ( va, vb ); + ローレベル最適化 void work( Vec<I32> a, CVI コード生成 Vec<I32> & b ) V2 { b = a + 1; } SSE LNI AVX Memory Manager a b Ct 動的処理 エンジン Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 55
  • 56. Ct ランタイム Application C++ APIs 他言語のバインディン • インテルCtテクノロジーでは、 calling Ct APIs グ ランタイム付きの標準規格に 準拠したC++ライブラリーを JIT Compiler 提供しています Virtual Machine • ランタイムは以下のようにス Virtual Debug/ Memory Backend Threading JIT レッドやベクターコードを生成 ISA Svcs Manager Compiler Runtime し管理します – ハードウェアに依存しない最適化 – 管理の軽減 – 特定のハードウェアのためのコード 生成と最適化 – (TBBをもとにした!)スケーラブル なスレッド化ランタイム CPU アクセラレータ 将来製品 Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 56
  • 57. Ct 動的エンジンの意味 実行時に第2ステージのコンパイル 実行時に実装に特化できる Ct カーネル:C関数として存在するが、 • 1度だけ実行=>動的コンパイルのため • 演算を記号としてキャプチャーする • 現行のバインディングと状態のスナップショットを取 得する Ct コール:実行は遠隔関数コール • データフロー依存関係を察知 • 自動(そして常に安全な)同期 • 遠隔実行とデータ保存を可能に Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 57
  • 58. なぜこれが重要なのか? 広く使われているライブラリーほど、よくデザインされた 汎用的なインターフェースやモジュール化と引き換えにパ フォーマンスを妥協している – 仮想関数呼び出し、関数ポインター、そして制御フローはランタイ ム時にしか分からないパラメーターに依存しており、パフォーマン スを制限しうる – モジュール性は本来的に様々な処理に分散してしまう – 極端なケースでは、アプリケーションは実行時に決められる計算を 適宜実行しているにすぎない 動的コンパイルは、「遅延結合」のオーバーヘッドを 「コンパイル・アウト」できる この利点によって、並列化を増大化させる作用がある Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 58
  • 59. IDEサポート Ctテクノロジーをお気に入りの開発環 境で使用可能 • Ctデータ構造の表示をユーザーが制御 • 表示フォーマットを選択 例:イメージ、スプレッ ドシート • Ct演算またはIDEからインタラクティブに起動 例:Microsoft* Visual Studio* • 変換ステップを可視化できます • これはプログラム開発生産性向上ための重要 な機能です *Other names and brands may be claimed as the property of others. Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 59
  • 60. まとめ • Ct テクノロジーはマルチコアへのアクセスを容易にし、 データ並列化のアプリケーションのための異機種環境で のメニーコア並列化を容易にします • 逐次セマンティックスは並列プログラミングする負担を 軽減します • 「デフォルトで安全」によって、悩ましいデータレース やデッドロックを回避できます • 今日、Ctテクノロジーで書かれたコードは、新しくリ リースされるメニーコア・プロセッサー上でもスケール する(フォワード・スケーリング) Software & Services Group, Developer Products Division Copyright © 2009, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 60