Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to GPU Programming in Python
Search
Yuki Ishikawa
April 21, 2018
Technology
0
130
Introduction to GPU Programming in Python
PyData.Okinawa Meetup #34
https://pydataokinawa.connpass.com/event/82009/
Yuki Ishikawa
April 21, 2018
Tweet
Share
More Decks by Yuki Ishikawa
See All by Yuki Ishikawa
ORM と向き合う
hoto17296
8
7.3k
明日業務で役立たない Web 開発 TIPS
hoto17296
0
110
Python をフル活用した工場への AI 導入 & データ活用基盤構築事例
hoto17296
0
2.5k
クソ bot 実装ライブコーディング
hoto17296
0
180
DeepGBM 論文の紹介
hoto17296
0
500
試行錯誤のための Docker 活用術
hoto17296
4
2.7k
Hive 集計テクニック
hoto17296
0
440
データ分析と Docker / Data Analysis with Docker
hoto17296
0
320
DeepCluster 論文の紹介
hoto17296
7
2.4k
Other Decks in Technology
See All in Technology
Wantedly での Datadog 活用事例
bgpat
1
410
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
マイクロサービスにおける容易なトランザクション管理に向けて
scalar
0
110
生成AIのガバナンスの全体像と現実解
fnifni
1
180
C++26 エラー性動作
faithandbrave
2
670
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
1
110
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
250
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
2
240
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
The Cult of Friendly URLs
andyhume
78
6.1k
Site-Speed That Sticks
csswizardry
2
190
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
A designer walks into a library…
pauljervisheath
204
24k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Done Done
chrislema
181
16k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
160
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Thoughts on Productivity
jonyablonski
67
4.4k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Transcript
Introduction to GPU Programming in Python 2018.04.21 PyData.Okinawa #34 @hoto17296
None
None
@hoto17296 • ͪΎΒσʔλגࣜձࣾ • σʔλੳϚϯ • JavaScript / Python /
AWS • IPv6 ͕Θ͔Βͳ͍ࠓ͜ͷ͝Ζ
Ͳͷ͝Ոఉʹ͋Δ GPU Ϛγϯ
͍͜ͳͯ͠·͔͢ʁʁʁ
ࣗͷ GPU ͷΠϝʔδ Λ͘ಈ͔ͤΔͭʂ
͍ͬͨͳ͍
GPU Λ͍ͨ͢Ίʹ CUDA Λ৮ͬͯΈΑ͏
GPU ͱ • Graphics Processing Unit • άϥϑΟοΫॲཧͷͨΊͷϓϩηοα • ୯७ͳॲཧΛฒྻԋࢉͰ͖Δ
• άϥϑΟοΫҎ֎ʹ׆༻͞ΕΔ (GPGPU) • σΟʔϓϥʔχϯάͱ͔
(NVIDIA) GPU ͷத ετϦʔϛϯά Ϛϧνϓϩηοα ଞʹϝϞϦͱ͔ Ωϟογϡͱ͔ ৭ʑ͋Δ͚Ͳলུ CUDA ίΞ
CUDA ͱ • Compute Unified Device Architecture • NVIDIA GPU
ΛͬͯฒྻܭࢉΛ͢ΔͨΊͷ ϓϩάϥϛϯάϞσϧ
CUDA ༻ޠ • ϗετͱσόΠε • CPU ଆΛϗετ, GPU ଆΛσόΠε ͱݺͿ
• Χʔωϧؔ • GPU ଆͰ࣮ߦ͢ΔॲཧΛهड़ͨؔ͠
CUDA ϓϩάϥϛϯάϞσϧ • ฒྻ͕େʹͳΔ • εϨου, ϒϩοΫ, άϦου ͱ͍͏ ·ͱ·ΓͰฒྻॲཧΛߦ͏
ग़యɿ http://www.nvidia.co.jp/object/cuda_education_jp_old.html
CUDA ϓϩάϥϛϯάϞσϧ • ฒྻ = εϨου x ϒϩοΫ x άϦου
• 1ϒϩοΫ͋ͨΓ࠷େ 512 εϨου • 1άϦου͋ͨΓ࠷େ 65536^2 ϒϩοΫ 1GPU ͋ͨΓ࠷େ 2 ஹ ฒྻʂʂʂ ✌('ω'✌ )ࡾ✌('ω')✌ࡾ( ✌’ω')✌
CUDA ϓϩάϥϛϯά Γͨ͘ͳ͖ͬͯ·ͨ͠Ͷ ʁʁʁ
CUDA ϓϩάϥϛϯάͷํ๏ • C Έ͍ͨͳݴޠͰΧʔωϧؔΛ࣮ͯ͠ nvcc ͱ͍͏ίϯύΠϥͰίϯύΠϧ͢Δ • μϧ͍ •
GPU Λར༻ͨ͠ฒྻॲཧΛॻ͍ͯΈ͍͕ͨ C ͕ॻ͖͍ͨΘ͚Ͱͳ͍ • Python Ͱॻ͔ͤͯ͘Ε
Numba • JIT ίϯύΠϧͯ͠ Python ΛߴԽͰ͖Δͭ • GPU ར༻Ͱ͖Δ (Numba
CUDA)
Χʔωϧؔͷ ఆٛ σίϨʔλΛࢦఆ͢Δ͜ͱͰ Χʔωϧؔͱͯ͠ఆٛ ͜ͷΧʔωϧ͕ؔ ฒྻ࣮ߦ͞ΕΔ ݱࡏͲͷҐஔ (ʁ) ͷεϨουͰ ࣮ߦ͍ͯ͠Δ͔औಘͰ͖Δ
εϨουͷҐஔใ͔Β ॲཧ͢Δରཁૉͷ࠲ඪΛܭࢉ͢Δ ߦྻͷରཁૉʹରͯ͠ॲཧΛߦ͏
Χʔωϧؔͷ࣮ߦ ฒྻ (griddim, blockdim) Λࢦఆ͔ͯ͠Β࣮ߦ͢Δ
͏গ͠ෳࡶͳྫɿ ΈࠐΈԋࢉ ग़యɿ http://tecmemo.wpblog.jp/category/machine-learning/deep-learning/page/2/
ϥϓϥγΞϯϑΟϧλ • ΈࠐΈԋࢉͰը૾ͷΤοδݕग़Λߦ͏ख๏ • ը૾ͷ৭ͷඍʹ૬͢Δ • ͜ͷߦྻΛϑΟϧλͱͯ͠ ΈࠐΈԋࢉΛߦ͏ 1 1
1 1 -8 1 1 1 1
ΈࠐΈԋࢉΛߦ͏ ΧʔωϧؔΛ ࣮
None
ೖྗը૾ ϑΟϧλ݁Ռ
·ͱΊ • Python Ͱ GPU ϓϩάϥϛϯάͰ͖Δ • GPU Ͱ༡Ϳͷͨͷ͍͠ ✌('ω'✌
)ࡾ✌('ω')✌ࡾ( ✌’ω')✌