ディープラーニングとPascal GPU —計算工学へのインパクト— · 本セミナーでは、ディープラーニングとそれを支える最新のGPUコンピューティング技術と、ディープラー
GPU を用いた lattice 計算
description
Transcript of GPU を用いた lattice 計算
![Page 1: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/1.jpg)
1
広島大学 理学研究科 尾崎 裕介石川 健一
![Page 2: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/2.jpg)
1. Graphic Processing Unit (GPU) とは?2. Nvidia CUDA programming model3. GPU の高速化4. QCD with CUDA5. 結果6. まとめ
2
![Page 3: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/3.jpg)
3
GPU を搭載したGraphic Card
価格: 5 ~ 10 万円性能: 数百 GFLOPS ( 単精度 )
主に画像処理を行う PC パーツ滑らかな描画リアルタイム表示
100 ~ 200 基の processer による 超並列高速計算
O(a) 改良した Wilson-Dirac quark のsolver を CUDAによって作成し、GPU でどのくらい加速されたか見てみた
Gyözö I. Egri, hep-lat/0611022“Lattice QCD as a video game”
先行研究 :
→ 単精度
本研究では倍精度
手軽に高性能
![Page 4: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/4.jpg)
4
10-15
10-1510-6 10-12
CPU の倍精度 solver
CPU の単精度 solver
10-1510-6 10-12
GPU の単精度 solver
単精度 solver を用いて倍精度の結果を得る手法
反復改良法、
連立方程式 (Wilson-Dirac) Dx = b を倍精度で解く
単精度で Dx=b を複数回解くと倍精度の解が得られるようにした方法
GPU :単精度計算が非常に高速 (300-900GFlops)単精度で解くところを GPU に担当させると全体がスピードアップ!
![Page 5: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/5.jpg)
L 次元ベクトルの和の計算例 (L=N×M) c = a + b//=== host から呼び出される GPU code ====_global_ void vadd_kernel(float *a, float *b, float *c){ int idx = threadIdx.x+blockIdx.x*blockDim.x; c[idx] = a[idx] + b[idx];}//==== host 側 code ===void main(){ …… // GPU 上にメモリ確保 cudaMalloc((void**)&a,….); ….. // c = a+b カーネルを GPU へ投げる // thread 数 /block = N, block 数 =M で並列実行 vadd_kernel<<<M,N>>>(a,b,c);}
高い並列度をうまく利用する必要がある 5
thread : 最小の実行単位 (max 512/block)thread block :
同一の multiprocessor 上で実行される thread の集まり
(max 65535)grid : thread block の集まり 並列化されたカーネルの全体
thread 1thread 2thread 3thread 4
⋮thread N
block 1block 2block 3block 4
⋮block M
gridblock
![Page 6: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/6.jpg)
6
Nvidia CUDA Programming Guide より
できる限り並列化→ 1thread で 1 格子点の計算
できる限り高速なメモリアクセス→ GPU 上の様々なメモリ領域の最適な使い方
![Page 7: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/7.jpg)
7
Shared Memory
global Memory
•高速なメモリアクセス (4 clock cycles)•read-write アクセス•同一 block 内の thread 間で共有•16KB/block
•device memory 上のメモリ•低速なメモリアクセス (400 ~ 600 clock cycles)•read-write アクセス•全 thread 間で共有
Shared Memory の有効活用
![Page 8: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/8.jpg)
8
1 格子点あたりのデータ量とロード回数•fermion : 8 回 +(1 回 )
3×4×2×4Byte=96Byte•gauge link : 2 回
3×(3-1)×2×4Byte×4=48Byte×4 SU(3) reconstruction method.•clover 項 : 1 回
21×2×2×4Byte=336Byte
fermion を shared memory に乗せた4×4×4×2×96Byte=12.3KB,
(max 16KB/block)gauge link と clover は device memory からロード
CUDA with QCD, programming strategy
データの出入り: 1584 Byte 計算量: 1896 Flop Byte/Flop = 0.83G80 バンド幅 : ~ 80GB/s予想性能: 100 GFlops!!
CUDA ブロックに 43×2 格子点をアサイン スレッド数 =128 スレッド
![Page 9: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/9.jpg)
9
GPU ・・・ NVIDIA GeForce 8800 GTX
CPU ・・・ Intel Core 2 @2.66GHz
354.6GFLOPS
21.3GFLOPS
O(a) 改良の Wilson-Dirac quark solverBi-CGStab 法反復改良法
単精度部分を GPU が担当even-odd preconditioning
•マシン構成
•solver
![Page 10: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/10.jpg)
10
GPU を用いた場合
さらに 1/7 に
•格子サイズ 163×32quench 0.15fm
•quark 質量 [MeV]23 、 52 、 81
単精度 solver で加速効果
10-15
10-12 10-1510-6
10-12 10-1510-6
倍精度単精度
23MeV
52MeV
81MeV
GPU
![Page 11: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/11.jpg)
11
CPUGPU•quark 質量 23MeV
•格子サイズ43×883×16163×32
最大性能 17GFLOPS
今回の結果
ただし、まだ速くなるはず→ coalesced access
![Page 12: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/12.jpg)
12
格子点 0格子点 0格子点 0格子点 1格子点 1格子点 1格子点 2格子点 2格子点 2
⋮
格子点 0格子点 1格子点 2
⋮格子点 0格子点 1格子点 2
⋮格子点 0
⋮
thread 0thread 1thread 2
⋮
thread 0thread 1thread 2
⋮
4,8,or 16Byte
![Page 13: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/13.jpg)
13
Nvidia GeForce GTX 280Core 2 Duo 3.0GHz (6MB)
•non coalesced access•on shared memory 20GFLOPS
石川健一 solver
•coalesced access•on texture cache 40 ~ 50GFLOPS
hopping → 89GFLOPSclover → 100GFLOPS
倍精度 solver GPU solver
220 秒 ~ 10 秒×22
![Page 14: GPU を用いた lattice 計算](https://reader035.fdocument.pub/reader035/viewer/2022062400/56814cfe550346895dba2372/html5/thumbnails/14.jpg)
14
GPU を用いると気軽に高速計算が可能。 ← 格子 QCD でも GPU は単精度計算が高速。 反復改良法を利用した GPU solver を作成した。 ← 倍精度の結果 作成した solver は O(a) の改良を行う clover 項を導入している。 GeForce 8800 GTX での結果
solver の計算性能は最大約 17GFOLPS 。 計算時間は Core 2 Duo 2.66GHz CPU の 1/7 。
GeForce GTX 280 での結果 coalesced access 導入後 40 ~ 50GFLOPS 。 Core 2 Duo 3.0GHz の 22 倍。
高速な計算には coalesced access が必要。
複数の GPU による計算。