SlideShare a Scribd company logo
1 of 15
Download to read offline
Copyright © 2017 OCAEL All rights reserved. 1
今野 雅
(株式会社OCAEL・東京大学情報基盤センター客員研究員)
OpenFOAMにおけるCommunication Avoiding
CG法の実装と性能評価
2017年12月9日@名古屋大学
オープンCAEシンポジウム2017講演会
Copyright © 2017 OCAEL All rights reserved.
•Krylov(クリロフ)部分空間法を用いた連立一次方程
式の反復解法の一種
•実対称正定値行列用のため,拡散方程式や圧力
Poisson方程式の解法に用いられる
•N次の係数行列に対し高々N回で収束が保証される
•係数行列に対して,前処理を行う事により,より少
ない反復で収束
•代数多重格子法(AMG)よりスケーラビリティが高
く,並列数が増加すると通常AMGより高速となる
•大規模並列流体解析では,圧力Poisson方程式のソル
バーとしてPCGを用いることが多い
2
CG法(共役勾配法)
緑:最急降下法(SD)
赤:共役勾配法(CG)
図出典:Wikipedia
Copyright © 2017 OCAEL All rights reserved.
•MPIプロセス数が多いと,CG法自体の計算量に比べ,MPI通信が卓越
•並列化性能向上にはMPI通信を削減,または隠蔽することが重要
•GhyselらのCommunication Avoiding/ReducingのCG法は,内積で必要な集
団通信に対してMPI-3の非同期集団通信を用い,集団通信を隠蔽可能
•OpenFOAMにCACGを実装し,チャネル流れを対象にCACGの性能評価
3
Communication Avoiding CG法
MPI関連
PCG前処理
行列ベクトル積
メモリ関連
OS関連
Intel VTune
advanced
-hotspots
格子数0.37Mの
チャネル流
(MVAPICH2)の
プロファイル結果
2%以下の関数PCG本体
Copyright © 2017 OCAEL All rights reserved.
Preconditioned CG (PCG)
1: r0 := b-Ax0; u0 := M-1 r0; p0 := u0
2: for i = 0, … do
3: s := A pi
4: α := (ri , ui ) / (s , pi )
5: xi+1 := xi + α pi
6: ri+1 := ri - α s
7: ui+1 := M-1 ri+1
8: β := (ri+1 , ui+1) / (ri , ui )
9: pi+1 := ui+1 + β pi
4
前処理付き共役勾配法(PCG)
•並列計算では,内積はMPIプロセス全体の集合通信が必要
•MPIプロセス数が大きくなると,集団通信の完了待ち時間が大きくなる
•4,8の内積の集団通信が終わるまで,5,9のベクトル定数倍加減積(DAXPY)が
始められないので,MPI数の増加で効率が急激に悪化する.
疎行列ベクトル積(SpMV)
内積(Dot Products)
内積(Dot Products)
前処理(Precondition)
他はベクトル定数倍加減算(DAXPY)
Copyright © 2017 OCAEL All rights reserved.
Preconditioned pipelined CG
1: r0 := b-Ax0 ; u0 := M-1 r0 ; w0 := Au0
2: for i = 0, … do
3: γi := (ri , ui )
4: δ := (wi , ui )
5: mi := M-1 wi
6: ni := A mi
7: βi := γi / γi-1 (i=0→βi: = 0)
8: αi := γi / (δ - βi γi / αi-1 ) (i=0→αi:= γi / δ)
9: zi := ni + βi zi-1
10: qi := mi + βi qi-1
11: si := wi + βi si-1
12: pi := ui + βi pi-1
13: xi+1 := xi + αi pi
14: ri+1 := ri - αi si
15: ui+1 := ui - αi qi
16: wi+1 := wi - αi zi
5
Preconditioned Pipelined CG
内積(Dot Products)
内積(Dot Products)
前処理(Precondition)
疎行列ベクトル積(SpMV)
内積の演算と,その結果を使用す
る演算の間に高コストな前処理や
SpMVが挟まれている
•内積の集団通信をMPI-3でサポートされた非同期型
(MPI_Iallreduce)で行うことで,前処理とSpMVを
オーバラップさせることが可能なので,MPIプロセ
スが増えても,性能劣化が少ないことが期待される
他はベクトル定数倍加減算
(DAXPY)
Copyright © 2017 OCAEL All rights reserved.
各CG法の演算量比較と特性
6
線形ソルバ SpMV 前処理 内積(注) DAXPY
Original PCG 1 1 2+1 3
Pipelined PCG 1 1 2+1 8
Grppp’s Asynchronous PCG 1 1 2+1 5
•DAXPYの演算は低コストなので,前処理が高コスト(今回はFDIC)であれば,
DAXPYの演算量の差は無視できるオーダーになる
•各手法は数学的にはOriginal PCGと等価だが,丸め誤差の影響により,収束性
が異なる場合がある
•Pipelined CGは残差ベクトルを直接算出せずに漸化式で求めるので,反復途中
で残差ベクトルを直接求める必要がある場合がある(今回は該当無し)
•なお,DAXPYを減らしたGroppアルゴリズムは,本問題では収束しない場合が
あった
注) 内積における+1は残差ノルム演算部
Copyright © 2017 OCAEL All rights reserved.
オープンCAE学会チャネル流ベンチマーク
7
Lx × Ly × Lz = 5π × 2 × 2π
Reτ = uτ δ/ μ = 110 [-]
ここで
Lx , Ly , Lz : 各方向のチャネル幅 [m]
uτ : 壁面摩擦速度 [m/s]
δ : チャネル半幅 [m] ( =Ly / 2 )
μ : 動粘性係数 [m2/s2]
主流方向(x): 一定の圧力勾配
主流方向(x), スパン方向(z): 周期境界
ソルバ: pimpleFoam
乱流モデル: 無し(laminar)
速度線型ソルバ: BiCG (前処理DILU)
圧力線型ソルバ: PCG (前処理FDIC)
領域分割手法:scotch(周期境界面は同領域)
解析条件チャネル流れ (Reτ = 110)
•2〜51ステップのCPU時間(Execution time)から1時間あたりのステップ数を算出
✓メッシュ生成に時間を要しない
✓構造格子のため,格子数変更が容易
✓圧力と速度のみ解くので,「圧力線
形ソルバの解析時間が支配的」という
非圧縮性流体解析の特性を素直に示す
Copyright © 2017 OCAEL All rights reserved. 8
格子生成 (blockMesh)
Hardware
Name Reedbush-U (The University of Tokyo)
CPU Intel Xeon E5-2695 v4 (Broadwell-EP, 2.1GHz, 18cores) × 2socket
Memory 256GB (DDR4-2400, 153.6GB/sec)
Interconnect InfiniBand EDR 4x (100 Gbps), Full-bisection Fat Tree
Solver OpenFOAM 4.1, pimpleFoam
Flow problem Channel flow (Reτ = 110,laminar)
Processors per node 32 (Decomposition merthod: scotch)
Mesh division
M1: 120×65×48=374,400 (0.37M)
M2: 240×130×96=2,995,200 (3M)
M3: 480×260×192=23,961,600 (24M)
Compiler and MPI
library
C1: Icc 2016.4, Intel MPI 5.1.3.258
C2: Icc 2017.4, Intel MPI 2017.3
C3: Icc 2017.4, MVAPICH2 2.2
Pressure solver
CG: Original PCG
CACG: Pipelined PCG
解析条件・検討ケース
Reedbush-U上ではOF
4.x, 5.0以外ではIntel
MPIでエラーとなった
Copyright © 2017 OCAEL All rights reserved.
格子数0.37Mでの解析速度・CACGとCGの速度比
9
32 64 128 256 512 1024 2048 4096
Number of MPI processes
50
75
100
125
150
Relativespeed[%]
M1-C1-CACG
M1-C2-CACG
M1-C3-CACG
• C2(Inltel MPI 2017)を除き,
256プロセス以上でCGよりCACG
のほうが高速
32 64 128 256 512 1024 2048 4096
Number of MPI processes
104
105
Speed[Step/h]
M1-C3-CG
M1-C3-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
104
105
Speed[Step/h]
M1-C2-CG
M1-C2-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
104
105
Speed[Step/h]
M1-C1-CG
M1-C1-CACG
C1:	Icc	2016.4	
Intel	MPI	5.1.3.258
C2:	Icc	2017.4	
Intel	MPI	2017.3
C3:	Icc	2017.4	
MVAPICH2	2.2
CACG
Higher	is	
Better
Higher	is	Better
CACG
CACG
CGCGCG
Linear
Linear
Linear
133%
116%
Copyright © 2017 OCAEL All rights reserved. 10
FDICPrecondi
<oner::preco
ndi<on
lduMatrix::
Amul
PCG::solve
CACG::solve
PMPIDI_CH3I_Progress
poll_all_Foxes
0	
32 64 128 256 512 1024 2048 4096
Number	of	MPI	processes
PCG
CACG
MPIpthreadvdsodaploucm
格子数0.37M・Intel MPI 5.1.3でのCPU Time
100	
[%]
VTune
advanced
-hotspots
2%以下の関数
Copyright © 2017 OCAEL All rights reserved. 11
FDICPrecondi
<oner::preco
ndi<on
lduMatrix::
Amul
PCG::solve
PMPIDI_CH3I_Progress
0	
32 64 128 256 512 1024 2048 4096
Number	of	MPI	processes
PCG
CACG
pthreadvdsodaploucm
格子数0.37M・Intel MPI 2017でのCPU Time
100	
[%]
VTune
advanced
-hotspots
CACG::solve
2%以下の関数
I_MPI_COLL_SHM_GEN
ERIC_RELEASE_BCAST
Copyright © 2017 OCAEL All rights reserved.
格子数0.37M・MVAPICH2でのCPU Time
12
FDICPrecondi
<oner::preco
ndi<on
lduMatrix::
Amul
osq_lock
CACG::solve
__intel_avx_rep_memset
100	
[%]
0	
32 64 128 256 512 1024 2048 4096
Number	of	MPI	processes
PCG
CACG
VTune
advanced
-hotspots
PCG::solve
MPIDI_CH3
I_SMP_writ
e_progress
2%以下の関数
Copyright © 2017 OCAEL All rights reserved.
32 64 128 256 512 1024 2048 4096
Number of MPI processes
103
104
105
Speed[Step/h]
M1-C3-CG
M1-C3-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
103
104
105
Speed[Step/h]
M1-C2-CG
M1-C2-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
103
104
105
Speed[Step/h]
M1-C1-CG
M1-C1-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
50
75
100
125
150
Relativespeed[%]
M2-C1-CACG
M2-C2-CACG
M2-C3-CACG
格子数3Mでの解析速度・CACGとCGの速度比
13
• C2(Inltel MPI 2017)を除き,
2048プロセス以上でCGより
CACGのほうが高速
C1:	Icc	2016.4	
Intel	MPI	5.1.3.258
C2:	Icc	2017.4	
Intel	MPI	2017.3
C3:	Icc	2017.4	
MVAPICH2	2.2
CACG
Higher	is	
Better
Higher	is	Better
CACG
CACG
CGCGCG
Linear
Linear
Linear
141%
104%
119%
Copyright © 2017 OCAEL All rights reserved.
32 64 128 256 512 1024 2048 4096
Number of MPI processes
101
102
103
104
Speed[Step/h]
M1-C3-CG
M1-C3-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
101
102
103
104
Speed[Step/h]
M1-C2-CG
M1-C2-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
101
102
103
104
Speed[Step/h]
M1-C1-CG
M1-C1-CACG
32 64 128 256 512 1024 2048 4096
Number of MPI processes
50
75
100
125
150
Relativespeed[%]
M3-C1-CACG
M3-C2-CACG
M3-C3-CACG
格子数24Mでの解析速度・CACGとCGの速度比
14
• 今回検討した4096プロセッサま
での範囲では,CACGによる明確
な高速化は得られない
• なお,格子数24Mのみ2〜9ス
テップのExecution timeから1時
間あたりのステップ数を算出した
C1:	Icc	2016.4	
Intel	MPI	5.1.3.258
C2:	Icc	2017.4	
Intel	MPI	2017.3
C3:	Icc	2017.4	
MVAPICH2	2.2
CACG
Higher	is	
Better
Higher	is	Better
CACG CACG
CGCGCG
Linear
Linear
Linear
110% 108%105%
Copyright © 2017 OCAEL All rights reserved. 15
まとめ
•OpenFOAMにComunication Avoiding CG法(CACG)を実装し,チャネル流
れを対象にPCGとCACGの性能評価を行なった
•格子数0.37Mの256プロセス以上では,Intel MPI 2017.3を除けば,相対的
にCGよりCACGが高速であった.
•格子数3Mでも2048プロセス以上で同様の傾向であった.
•格子数24Mは,今回検討した4096プロセスまでの範囲では,CACGによる
高速化が明確に得られなかった.
•Intel MPI 2017.3ではCACGがPCGより低速となった.
•Oakforest-PACSで同様の検討を行なったが,CACGによる高速化は得られ
なかった.
•今後,より多くのプロセス数が扱える名古屋FX100でも同様な検討を行う.
参考文献:
• P. Ghysels, W. Vanroose: Hiding global synchronization latency in the preconditioned Conjugate Gradient
algorithm, Parallel Computing, 40-7, pp.224-238,2014.
• 中島研吾: 大規模並列シミュレーション手法に関する研究,教育, 東京大学情報基盤センター年報,第17号,
pp.180-189, 2016年.

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

OpenFOAMにおけるCommunication Avoiding CG法の実装と性能評価

  • 1. Copyright © 2017 OCAEL All rights reserved. 1 今野 雅 (株式会社OCAEL・東京大学情報基盤センター客員研究員) OpenFOAMにおけるCommunication Avoiding CG法の実装と性能評価 2017年12月9日@名古屋大学 オープンCAEシンポジウム2017講演会
  • 2. Copyright © 2017 OCAEL All rights reserved. •Krylov(クリロフ)部分空間法を用いた連立一次方程 式の反復解法の一種 •実対称正定値行列用のため,拡散方程式や圧力 Poisson方程式の解法に用いられる •N次の係数行列に対し高々N回で収束が保証される •係数行列に対して,前処理を行う事により,より少 ない反復で収束 •代数多重格子法(AMG)よりスケーラビリティが高 く,並列数が増加すると通常AMGより高速となる •大規模並列流体解析では,圧力Poisson方程式のソル バーとしてPCGを用いることが多い 2 CG法(共役勾配法) 緑:最急降下法(SD) 赤:共役勾配法(CG) 図出典:Wikipedia
  • 3. Copyright © 2017 OCAEL All rights reserved. •MPIプロセス数が多いと,CG法自体の計算量に比べ,MPI通信が卓越 •並列化性能向上にはMPI通信を削減,または隠蔽することが重要 •GhyselらのCommunication Avoiding/ReducingのCG法は,内積で必要な集 団通信に対してMPI-3の非同期集団通信を用い,集団通信を隠蔽可能 •OpenFOAMにCACGを実装し,チャネル流れを対象にCACGの性能評価 3 Communication Avoiding CG法 MPI関連 PCG前処理 行列ベクトル積 メモリ関連 OS関連 Intel VTune advanced -hotspots 格子数0.37Mの チャネル流 (MVAPICH2)の プロファイル結果 2%以下の関数PCG本体
  • 4. Copyright © 2017 OCAEL All rights reserved. Preconditioned CG (PCG) 1: r0 := b-Ax0; u0 := M-1 r0; p0 := u0 2: for i = 0, … do 3: s := A pi 4: α := (ri , ui ) / (s , pi ) 5: xi+1 := xi + α pi 6: ri+1 := ri - α s 7: ui+1 := M-1 ri+1 8: β := (ri+1 , ui+1) / (ri , ui ) 9: pi+1 := ui+1 + β pi 4 前処理付き共役勾配法(PCG) •並列計算では,内積はMPIプロセス全体の集合通信が必要 •MPIプロセス数が大きくなると,集団通信の完了待ち時間が大きくなる •4,8の内積の集団通信が終わるまで,5,9のベクトル定数倍加減積(DAXPY)が 始められないので,MPI数の増加で効率が急激に悪化する. 疎行列ベクトル積(SpMV) 内積(Dot Products) 内積(Dot Products) 前処理(Precondition) 他はベクトル定数倍加減算(DAXPY)
  • 5. Copyright © 2017 OCAEL All rights reserved. Preconditioned pipelined CG 1: r0 := b-Ax0 ; u0 := M-1 r0 ; w0 := Au0 2: for i = 0, … do 3: γi := (ri , ui ) 4: δ := (wi , ui ) 5: mi := M-1 wi 6: ni := A mi 7: βi := γi / γi-1 (i=0→βi: = 0) 8: αi := γi / (δ - βi γi / αi-1 ) (i=0→αi:= γi / δ) 9: zi := ni + βi zi-1 10: qi := mi + βi qi-1 11: si := wi + βi si-1 12: pi := ui + βi pi-1 13: xi+1 := xi + αi pi 14: ri+1 := ri - αi si 15: ui+1 := ui - αi qi 16: wi+1 := wi - αi zi 5 Preconditioned Pipelined CG 内積(Dot Products) 内積(Dot Products) 前処理(Precondition) 疎行列ベクトル積(SpMV) 内積の演算と,その結果を使用す る演算の間に高コストな前処理や SpMVが挟まれている •内積の集団通信をMPI-3でサポートされた非同期型 (MPI_Iallreduce)で行うことで,前処理とSpMVを オーバラップさせることが可能なので,MPIプロセ スが増えても,性能劣化が少ないことが期待される 他はベクトル定数倍加減算 (DAXPY)
  • 6. Copyright © 2017 OCAEL All rights reserved. 各CG法の演算量比較と特性 6 線形ソルバ SpMV 前処理 内積(注) DAXPY Original PCG 1 1 2+1 3 Pipelined PCG 1 1 2+1 8 Grppp’s Asynchronous PCG 1 1 2+1 5 •DAXPYの演算は低コストなので,前処理が高コスト(今回はFDIC)であれば, DAXPYの演算量の差は無視できるオーダーになる •各手法は数学的にはOriginal PCGと等価だが,丸め誤差の影響により,収束性 が異なる場合がある •Pipelined CGは残差ベクトルを直接算出せずに漸化式で求めるので,反復途中 で残差ベクトルを直接求める必要がある場合がある(今回は該当無し) •なお,DAXPYを減らしたGroppアルゴリズムは,本問題では収束しない場合が あった 注) 内積における+1は残差ノルム演算部
  • 7. Copyright © 2017 OCAEL All rights reserved. オープンCAE学会チャネル流ベンチマーク 7 Lx × Ly × Lz = 5π × 2 × 2π Reτ = uτ δ/ μ = 110 [-] ここで Lx , Ly , Lz : 各方向のチャネル幅 [m] uτ : 壁面摩擦速度 [m/s] δ : チャネル半幅 [m] ( =Ly / 2 ) μ : 動粘性係数 [m2/s2] 主流方向(x): 一定の圧力勾配 主流方向(x), スパン方向(z): 周期境界 ソルバ: pimpleFoam 乱流モデル: 無し(laminar) 速度線型ソルバ: BiCG (前処理DILU) 圧力線型ソルバ: PCG (前処理FDIC) 領域分割手法:scotch(周期境界面は同領域) 解析条件チャネル流れ (Reτ = 110) •2〜51ステップのCPU時間(Execution time)から1時間あたりのステップ数を算出 ✓メッシュ生成に時間を要しない ✓構造格子のため,格子数変更が容易 ✓圧力と速度のみ解くので,「圧力線 形ソルバの解析時間が支配的」という 非圧縮性流体解析の特性を素直に示す
  • 8. Copyright © 2017 OCAEL All rights reserved. 8 格子生成 (blockMesh) Hardware Name Reedbush-U (The University of Tokyo) CPU Intel Xeon E5-2695 v4 (Broadwell-EP, 2.1GHz, 18cores) × 2socket Memory 256GB (DDR4-2400, 153.6GB/sec) Interconnect InfiniBand EDR 4x (100 Gbps), Full-bisection Fat Tree Solver OpenFOAM 4.1, pimpleFoam Flow problem Channel flow (Reτ = 110,laminar) Processors per node 32 (Decomposition merthod: scotch) Mesh division M1: 120×65×48=374,400 (0.37M) M2: 240×130×96=2,995,200 (3M) M3: 480×260×192=23,961,600 (24M) Compiler and MPI library C1: Icc 2016.4, Intel MPI 5.1.3.258 C2: Icc 2017.4, Intel MPI 2017.3 C3: Icc 2017.4, MVAPICH2 2.2 Pressure solver CG: Original PCG CACG: Pipelined PCG 解析条件・検討ケース Reedbush-U上ではOF 4.x, 5.0以外ではIntel MPIでエラーとなった
  • 9. Copyright © 2017 OCAEL All rights reserved. 格子数0.37Mでの解析速度・CACGとCGの速度比 9 32 64 128 256 512 1024 2048 4096 Number of MPI processes 50 75 100 125 150 Relativespeed[%] M1-C1-CACG M1-C2-CACG M1-C3-CACG • C2(Inltel MPI 2017)を除き, 256プロセス以上でCGよりCACG のほうが高速 32 64 128 256 512 1024 2048 4096 Number of MPI processes 104 105 Speed[Step/h] M1-C3-CG M1-C3-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 104 105 Speed[Step/h] M1-C2-CG M1-C2-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 104 105 Speed[Step/h] M1-C1-CG M1-C1-CACG C1: Icc 2016.4 Intel MPI 5.1.3.258 C2: Icc 2017.4 Intel MPI 2017.3 C3: Icc 2017.4 MVAPICH2 2.2 CACG Higher is Better Higher is Better CACG CACG CGCGCG Linear Linear Linear 133% 116%
  • 10. Copyright © 2017 OCAEL All rights reserved. 10 FDICPrecondi <oner::preco ndi<on lduMatrix:: Amul PCG::solve CACG::solve PMPIDI_CH3I_Progress poll_all_Foxes 0 32 64 128 256 512 1024 2048 4096 Number of MPI processes PCG CACG MPIpthreadvdsodaploucm 格子数0.37M・Intel MPI 5.1.3でのCPU Time 100 [%] VTune advanced -hotspots 2%以下の関数
  • 11. Copyright © 2017 OCAEL All rights reserved. 11 FDICPrecondi <oner::preco ndi<on lduMatrix:: Amul PCG::solve PMPIDI_CH3I_Progress 0 32 64 128 256 512 1024 2048 4096 Number of MPI processes PCG CACG pthreadvdsodaploucm 格子数0.37M・Intel MPI 2017でのCPU Time 100 [%] VTune advanced -hotspots CACG::solve 2%以下の関数 I_MPI_COLL_SHM_GEN ERIC_RELEASE_BCAST
  • 12. Copyright © 2017 OCAEL All rights reserved. 格子数0.37M・MVAPICH2でのCPU Time 12 FDICPrecondi <oner::preco ndi<on lduMatrix:: Amul osq_lock CACG::solve __intel_avx_rep_memset 100 [%] 0 32 64 128 256 512 1024 2048 4096 Number of MPI processes PCG CACG VTune advanced -hotspots PCG::solve MPIDI_CH3 I_SMP_writ e_progress 2%以下の関数
  • 13. Copyright © 2017 OCAEL All rights reserved. 32 64 128 256 512 1024 2048 4096 Number of MPI processes 103 104 105 Speed[Step/h] M1-C3-CG M1-C3-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 103 104 105 Speed[Step/h] M1-C2-CG M1-C2-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 103 104 105 Speed[Step/h] M1-C1-CG M1-C1-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 50 75 100 125 150 Relativespeed[%] M2-C1-CACG M2-C2-CACG M2-C3-CACG 格子数3Mでの解析速度・CACGとCGの速度比 13 • C2(Inltel MPI 2017)を除き, 2048プロセス以上でCGより CACGのほうが高速 C1: Icc 2016.4 Intel MPI 5.1.3.258 C2: Icc 2017.4 Intel MPI 2017.3 C3: Icc 2017.4 MVAPICH2 2.2 CACG Higher is Better Higher is Better CACG CACG CGCGCG Linear Linear Linear 141% 104% 119%
  • 14. Copyright © 2017 OCAEL All rights reserved. 32 64 128 256 512 1024 2048 4096 Number of MPI processes 101 102 103 104 Speed[Step/h] M1-C3-CG M1-C3-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 101 102 103 104 Speed[Step/h] M1-C2-CG M1-C2-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 101 102 103 104 Speed[Step/h] M1-C1-CG M1-C1-CACG 32 64 128 256 512 1024 2048 4096 Number of MPI processes 50 75 100 125 150 Relativespeed[%] M3-C1-CACG M3-C2-CACG M3-C3-CACG 格子数24Mでの解析速度・CACGとCGの速度比 14 • 今回検討した4096プロセッサま での範囲では,CACGによる明確 な高速化は得られない • なお,格子数24Mのみ2〜9ス テップのExecution timeから1時 間あたりのステップ数を算出した C1: Icc 2016.4 Intel MPI 5.1.3.258 C2: Icc 2017.4 Intel MPI 2017.3 C3: Icc 2017.4 MVAPICH2 2.2 CACG Higher is Better Higher is Better CACG CACG CGCGCG Linear Linear Linear 110% 108%105%
  • 15. Copyright © 2017 OCAEL All rights reserved. 15 まとめ •OpenFOAMにComunication Avoiding CG法(CACG)を実装し,チャネル流 れを対象にPCGとCACGの性能評価を行なった •格子数0.37Mの256プロセス以上では,Intel MPI 2017.3を除けば,相対的 にCGよりCACGが高速であった. •格子数3Mでも2048プロセス以上で同様の傾向であった. •格子数24Mは,今回検討した4096プロセスまでの範囲では,CACGによる 高速化が明確に得られなかった. •Intel MPI 2017.3ではCACGがPCGより低速となった. •Oakforest-PACSで同様の検討を行なったが,CACGによる高速化は得られ なかった. •今後,より多くのプロセス数が扱える名古屋FX100でも同様な検討を行う. 参考文献: • P. Ghysels, W. Vanroose: Hiding global synchronization latency in the preconditioned Conjugate Gradient algorithm, Parallel Computing, 40-7, pp.224-238,2014. • 中島研吾: 大規模並列シミュレーション手法に関する研究,教育, 東京大学情報基盤センター年報,第17号, pp.180-189, 2016年.