![Page 1: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/1.jpg)
Japan GPU Computing Development Partnership
GPUDirectの現状整理
〜 multi-GPUに取組むために 〜
G-DEP チーフエンジニア 河井博紀([email protected])
![Page 2: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/2.jpg)
Japan GPU Computing Development Partnership
名称: 日本GPUコンピューティングパートナーシップ (G-DEP) 所在: 東京都文京区本郷7丁目3番1号 東京大学アントレプレナープラザ, 他工場
URL http://www.gdep.jp
アライアンスパートナー コアテクノロジーパートナー
NVIDIA JAPAN
ソリューションパートナー 株式会社エルザジャパン、みずほ情報総研株式会社、 株式会社アーク情報システム、日本ネスト株式会社 株式会社システム計画研究所、有限会社イワタシステムサポート、 サーヴァンツインターナショナル株式会社、株式会社ソフテック、 株式会社サイコム、プロメテック・ソフトウェア株式会社、トーワ電機株式会社
![Page 3: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/3.jpg)
Japan GPU Computing Development Partnership
![Page 4: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/4.jpg)
Japan GPU Computing Development Partnership
小型PCから…
高性能ワークステーション、
InfiniBand GPUクラスタ まで。 ノード内 multi-GPU
複数ノード multi-GPU
1 2 3 4
1
4
8
12
16
• • •
• • •
• • •
• • •
![Page 5: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/5.jpg)
Japan GPU Computing Development Partnership
Outline
mult i-GPU プログラミング概論
GPUDirect とは?
GPUDirect の現状整理
![Page 6: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/6.jpg)
Japan GPU Computing Development Partnership
We assume …
・Fermi or later Tesla
・CUDA 4.0 or later
・64-bit Linux / 64-bit Windows with TCC driver
![Page 7: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/7.jpg)
Japan GPU Computing Development Partnership
Why multi-GPU ? ・性能を Scaling-up させるため
・メモリを増やして、大きな問題に取組むため
![Page 8: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/8.jpg)
Japan GPU Computing Development Partnership
・各セルは alive( =1) or dead( =0)
・Rules
誕生
過疎死
過密死
ノード内 Tesla K20 ×2枚で “Game of Life”
Grid Size:N × N
境界条件:periodic b.c.
![Page 9: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/9.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
Grid Size:N × N
境界条件:periodic b.c.
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 10: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/10.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
cudaSetDevice( 0 );
kernel<<<…>>>(…);
cudaSetDevice( 1 );
kernel<<<…>>>(…);
// Tesla 0 を操作
// Tesla 1 を操作
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 11: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/11.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
Tesla 0 の境界の更新にはTesla 1の境界が必要
境界
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 12: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/12.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
境界
隣の境界をcopy “ ghost領域 ”
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 13: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/13.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
隣の境界をcopy
境界 ghost を参照する事で
境界も update できる。
“ ghost領域 ”
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 14: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/14.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
境界 ghost を参照する事で
境界も update できる。
“ ghost領域 ”
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 15: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/15.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
境界
“ ghost領域 ”
ghost を参照する事で
境界も update できる。
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 16: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/16.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
境界
“ ghost領域 ”
ghost を参照する事で
境界も update できる。
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 17: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/17.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
① update
① update
② copy して ghost を更新
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 18: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/18.jpg)
Japan GPU Computing Development Partnership
もう少し工夫できます。
![Page 19: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/19.jpg)
Japan GPU Computing Development Partnership
copy 時間の “隠蔽” が重要に
・「Kernel処理」と「データ送受信」は同時に行える。
update copy
短縮!
△ naive
copy copy
境界
update
◎ 隠蔽
update copy
内部
update
境界
update
内部
update
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 20: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/20.jpg)
Japan GPU Computing Development Partnership
Tesla 0
Tesla 1
② 内部 update
② 同時に、 copyしてghost更新
① 境界 update
① 境界 update
② 内部 update
① 境界 update
① 境界 update
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 21: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/21.jpg)
Japan GPU Computing Development Partnership
更新回数:10 万回
Grid Size:2048 × 2048
境界条件:periodic b.c. 0 10 20 30 40 50
Processing Time [sec]
K20 ×1
K20 ×2 (naive)
K20 ×2 (隠蔽)
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 22: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/22.jpg)
Japan GPU Computing Development Partnership
cudaSetDevice( i );
update_bnd<<<…, stream_up[i]>>>(…);
for ( i=0; i<2; i++) {
}
cudaEventRecord( event[i], stream_up[i] );
update_inner<<<…, stream_up[i]>>>(…);
for ( i=0; i<2; i++) {
cudaStreamWaitEvent( stream_cpy[i], event[i] );
cudaMemcpyAsync(…, stream_cpy[i] ); }
for ( i=0; i<2; i++) cudaMemcpyAsync(…, stream_cpy[i] );
}
for ( n=0; n<NUM_STEPS; n++)
{
cudaSetDevice( i );
for ( i=0; i<2; i++) {
cudaDeviceSynchronize(); }
境界 の update完了まで、cudaMemcpyAsync を停止
内部 update kernel
境界 update kernel
双方向 cudaMemcpyAsync
× 2セット
ここで同期
ノード内 Tesla K20 ×2枚で “Game of Life”
![Page 23: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/23.jpg)
Japan GPU Computing Development Partnership
Outline
GPUDirect とは?
GPUDirect の現状整理
![Page 24: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/24.jpg)
Japan GPU Computing Development Partnership
GPUDirect とは、
「異なる Tesla 間のデータ転送」
を高速に行う機能の事です。
![Page 25: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/25.jpg)
Japan GPU Computing Development Partnership
隠蔽できるのに、恩恵はあるのか?
![Page 26: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/26.jpg)
Japan GPU Computing Development Partnership
copy copy
境界 内部
copy copy
copy copy
隠蔽できなく
なった…
境界
境界
境界
境界
境界
内部 内部
内部 内部
内部
・ ・ ・
Teslaの枚数
![Page 27: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/27.jpg)
Japan GPU Computing Development Partnership
・隠蔽してる暇がない時も、ある。
・原理的に隠蔽出来ない時は、ある。
・Teslaの枚数を増やす可能性を考慮して
使っておくべき。
GPUDirect の恩恵はあるのか?
![Page 28: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/28.jpg)
Japan GPU Computing Development Partnership
Outline
GPUDirect の現状整理
![Page 29: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/29.jpg)
Japan GPU Computing Development Partnership
GPUDirect には現在、
「version 1」と「version 2」
があります。
![Page 30: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/30.jpg)
Japan GPU Computing Development Partnership
InfiniBandクラスタ専用
ノードをまたぐ高速転送
GPUDirect ver.1
GPUDirect ver.2
ノード内の高速転送
=
=
![Page 31: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/31.jpg)
Japan GPU Computing Development Partnership
GPUDirect 用途 ダイレクト転送? CUDA 使用方法 正式リリース
ver.1
IBクラスタ
ノード間
済
ver.2 ノード内 済
Summary
・転送を隠蔽できない/してない時に
GPUDirectは有用。
![Page 32: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/32.jpg)
Japan GPU Computing Development Partnership
GPUDirect ver.2 はノード内のダイレクト転送です。
![Page 33: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/33.jpg)
Japan GPU Computing Development Partnership
M/B
CPU メインメモリ
Tesla 0
Tesla 1
M/B
CPU メインメモリ
Tesla 0
Tesla 1
No GPUDirect ver.2 With GPUDirect ver.2
遠回り… Direct !
![Page 34: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/34.jpg)
Japan GPU Computing Development Partnership
cudaDeviceEnablePeerAccess()
を宣言するだけ。
GPUDirect ver.2 を使用するには
![Page 35: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/35.jpg)
Japan GPU Computing Development Partnership
M/B
CPU メインメモリ
Tesla 0
Tesla 1
cudaDeviceEnablePeerAccess(1, 0);
cudaMemcpy(p1, p0, size, cudaMemcpyDefault);
*p0
*p1
cudaSetDevice(0);
cudaMalloc(&p0, size);
cudaSetDevice(1); cudaMalloc(&p1, size); Direct !
with GPUDirect ver.2 GPUDirect ver.2 の実装
// ※ UVA (CUDA ≧ 4.0) により異なるGPU間の転送が可能
Tesla “1” への
GPUDv2を有効化
![Page 36: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/36.jpg)
Japan GPU Computing Development Partnership
// cudaDeviceEnablePeerAccess(1, 0); cudaSetDevice(0);
cudaMalloc(&p0, size);
cudaSetDevice(1); cudaMalloc(&p1, size);
M/B
CPU メインメモリ
Tesla 0
Tesla 1
*p0
*p1
no GPUDirect ver.2
Fallback …
// ※ UVA (CUDA ≧ 4.0) により異なるGPU間の転送が可能
// ※ 但し、Nsightのタイムラインによるとパイプライン処理
されており、cudaMemcpy ×2回よりは高速
GPUDirect ver.2 の実装
cudaMemcpy(p1, p0, size, cudaMemcpyDefault);
![Page 37: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/37.jpg)
Japan GPU Computing Development Partnership
0
1
2
3
4
5
6
4B 16B 64B 256B 1KB 4KB 16KB 64KB 256KB 1MB 4MB 16MB 64MB 256MB
Ban
dw
idth
[G
B/s
]
転送データサイズ
cudaMemcpy
with GPUDv2
no GPUDv2 Fallback wins
〜 8MB single: 200万個
double: 100万個
int: 200万個
latency with GPUDv2: 11μs
no GPUDv2: 20μs
(fallback)
※ Performance may vary based on system HDW and config.
※ CentOS 6.2, NV Driver 319.32, CUDA5, K20c, X79Chipset
![Page 38: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/38.jpg)
Japan GPU Computing Development Partnership
(fallback) Fallback wins
0
1
2
3
4
5
6
7
8
9
10
8B 32B 128B 512B 2KB 8KB 32KB 128KB 512KB 2MB 8MB 32MB 128MB 512MB
Ban
dw
idth
[G
B/s
]
転送データサイズ
双方向 cudaMemcpyAsync
with GPUDv2
no GPUDv2
〜 32MB single: 800万個
double: 400万個
int: 800万個
latency with GPUDv2: 14μs
no GPUDv2: 31μs
※ Performance may vary based on system HDW and config.
※ CentOS 6.2, NV Driver 319.32, CUDA5, K20c, X79Chipset
![Page 39: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/39.jpg)
Japan GPU Computing Development Partnership
再度、Tesla K20 ×2枚で Game of Life
更新回数:10 万回
Grid Size:2048 × 2048
境界条件:periodic b.c.
K20 ×1
K20 ×2 (naive)
K20 ×2 (隠蔽)
0 10 20 30 40 50
Processing Time [sec]
with GPUDv2
with GPUDv2
11%高速化
隠蔽できているので変わらず
no GPUDv2
no GPUDv2
![Page 40: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/40.jpg)
Japan GPU Computing Development Partnership
GPUDirect 用途 ダイレクト転送? CUDA 使用方法 正式リリース
ver.1
IBクラスタ
ノード間
済
ver.2 ノード内 Yes 4.0〜 cudaDeviceEnablePeerAccess()
※ 同じIOHの必要あり 済
Summary
・転送を隠蔽できない/してない時に
GPUDirectは有用。
![Page 41: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/41.jpg)
Japan GPU Computing Development Partnership
GPUDirect ver.1 はマーケティング・ネームです。
![Page 42: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/42.jpg)
Japan GPU Computing Development Partnership
GPUDirect ver.1 ダイレクト転送ではありません。
メインメモリをしっかり通ります。
![Page 43: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/43.jpg)
Japan GPU Computing Development Partnership
rank0 の M/B
メインメモリ
Tesla 1
*Ad Tesla用 buffer
InfiniBand用 buffer
CPU
InfiniBand クラスタの 1ノード
InfiniBand
![Page 44: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/44.jpg)
Japan GPU Computing Development Partnership
rank0 の M/B
メインメモリ
Tesla 1
*Ad
MPI_Send
{ if ( myrank == 0 )
cudaMemcpy( A, Ad, … ); MPI_Send( A, … );
naive なコード
// 後述の “CUDA-Aware MPI” を除いて
// MPI関数にデバイスポインタは渡せない
*A
*A CPU
InfiniBand クラスタの 1ノード
else if ( myrank == 1 ) }
{
cudaMemcpy( Bd, B, … ); MPI_Recv( B, … );
}
![Page 45: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/45.jpg)
Japan GPU Computing Development Partnership
rank0 の M/B
CPU メインメモリ
Tesla 1
MPI_Send
{ if ( myrank == 0 )
cudaMemcpy( A, Ad, … ); MPI_Send( A, … );
cudaMallocHost( &A, size ); cudaMallocHost( &B, size );
GPUDirect ver.1を使用
*Ad
*A
InfiniBand クラスタの 1ノード
else if ( myrank == 1 ) }
{
cudaMemcpy( Bd, B, … ); MPI_Recv( B, … );
}
![Page 46: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/46.jpg)
Japan GPU Computing Development Partnership
rank0 の M/B
CPU メインメモリ
Tesla 1
*Ad
InfiniBand クラスタの 1ノード
OpenMPI ver. 1.7 以上
Cray, IBM
でのみ
可能
CUDA-Aware MPIを使用
MVAPICH2 ver. 1.8 以上
{ if ( myrank == 0 )
else if ( myrank == 1 )
MPI_Send( Ad, … ); }
{ MPI_Recv( Bd, … );
} デバイスポインタ
を渡せる
パイプライン処理
MPI_Send
![Page 47: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/47.jpg)
Japan GPU Computing Development Partnership
rank0 の M/B
CPU メインメモリ
Tesla 1
*Ad
InfiniBand クラスタの 1ノード
OpenMPI ver. 1.7 以上
Cray, IBM
でのみ
可能
CUDA-Aware MPIを使用
MVAPICH2 ver. 1.8 以上
{ if ( myrank == 0 )
else if ( myrank == 1 )
MPI_Isend( Ad, … ); }
{ MPI_Irecv( Bd, … );
} デバイスポインタ
を渡せる
パイプライン処理
MPI_Isend
![Page 48: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/48.jpg)
Japan GPU Computing Development Partnership
0
0.5
1
1.5
2
2.5
3
3.5
4B 16B 64B 256B 1KB 4KB 16KB 64KB 256KB 1MB 4MB 16MB 64MB 256MB
Ban
dw
idth
[G
B/s
]
転送データサイズ
MPI_Send/Recv
CUDA-Aware MPI
with GPUDv1
no GPUDv1
latency with GPUDv1: 22μs
no GPUDv1: 16μs
CUDA-Aware : 16μs
※ Performance may vary based on system HDW and config.
※ CentOS 6.2, NV Driver 319.32, CUDA5, QDR, K20c, X79Chipset
![Page 49: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/49.jpg)
Japan GPU Computing Development Partnership
0
1
2
3
4
5
6
8B 32B 128B 512B 2KB 8KB 32KB 128KB 512KB 2MB 8MB 32MB 128MB 512MB
Ban
dw
idth
[G
B/s
]
転送データサイズ
双方向 MPI_Isend/Irecv
CUDA-Aware MPI
with GPUDv1
no GPUDv1
latency with GPUDv1: 22μs
no GPUDv1: 17μs
CUDA-Aware : 16μs
※ Performance may vary based on system HDW and config.
※ CentOS 6.2, NV Driver 319.32, CUDA5, QDR, K20c, X79Chipset
![Page 50: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/50.jpg)
Japan GPU Computing Development Partnership
Drawer
InfiniBand Switch
計算ノード
計算ノード
計算ノード
計算ノード
Gigabit Switch
G-DEPはCUDA-Aware MPIをインストール
したGPUクラスタの販売を開始しております。
さらに大規模なクラスタも販売しております。
是非お気軽に [email protected] まで
お問い合わせ下さい。
![Page 51: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/51.jpg)
Japan GPU Computing Development Partnership
GPUDirect 用途 ダイレクト転送? CUDA 使用方法 正式リリース
ver.1
IBクラスタ
ノード間
No
3.1〜
中継メモリをpinnedに
CUDA-Aware MPIが最速
済
ver.2 ノード内 Yes 4.0〜 cudaDeviceEnablePeerAccess()
※ 同じIOHの必要あり 済
Summary
・転送を隠蔽できない/してない時に
GPUDirectは有用。
![Page 52: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/52.jpg)
Japan GPU Computing Development Partnership
GPUDirect ver.3 はまだ正式リリースされてません。
![Page 53: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/53.jpg)
Japan GPU Computing Development Partnership
ノードをまたぐダイレクト転送
![Page 54: GPUDirectの現状整理 multi-GPUに取組むために - …on-demand.gputechconf.com/gtc/2013/jp/sessions/4004.pdfJapan GPU Computing Development Partnership GPUDirectの現状整理](https://reader033.vdocuments.site/reader033/viewer/2022041620/5e3e3a79d3c3df70f47199fd/html5/thumbnails/54.jpg)
Japan GPU Computing Development Partnership
GPUDirect 用途 ダイレクト転送? CUDA 使用方法 正式リリース
ver.1
IBクラスタ
ノード間
No
3.1〜
中継メモリをpinnedに
CUDA-Aware MPIが最速
済
ver.2 ノード内 Yes 4.0〜 cudaDeviceEnablePeerAccess()
※ 同じIOHの必要あり 済
ver.3
IBクラスタ
ノード間
Yes
5.0〜
?
2013 Q4
Summary
・転送を隠蔽できない/してない時に
GPUDirectは有用。