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.5k
明日業務で役立たない Web 開発 TIPS
hoto17296
0
120
Python をフル活用した工場への AI 導入 & データ活用基盤構築事例
hoto17296
0
2.6k
クソ bot 実装ライブコーディング
hoto17296
0
190
DeepGBM 論文の紹介
hoto17296
0
500
試行錯誤のための Docker 活用術
hoto17296
4
2.8k
Hive 集計テクニック
hoto17296
0
450
データ分析と Docker / Data Analysis with Docker
hoto17296
0
320
DeepCluster 論文の紹介
hoto17296
7
2.4k
Other Decks in Technology
See All in Technology
月間60万ユーザーを抱える 個人開発サービス「Walica」の 技術スタック変遷
miyachin
1
140
今年一年で頑張ること / What I will do my best this year
pauli
1
220
JuliaTokaiとJuliaLangJaの紹介 for NGK2025S
antimon2
1
110
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
180
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
180
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
Amazon Q Developerで.NET Frameworkプロジェクトをモダナイズしてみた
kenichirokimura
1
200
re:Invent 2024のふりかえり
beli68
0
110
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
54k
信頼されるためにやったこと、 やらなかったこと。/What we did to be trusted, What we did not do.
bitkey
PRO
0
2.2k
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
850
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
How GitHub (no longer) Works
holman
312
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Code Reviewing Like a Champion
maltzj
521
39k
Designing Experiences People Love
moore
139
23k
Side Projects
sachag
452
42k
Done Done
chrislema
182
16k
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 Ͱ༡Ϳͷͨͷ͍͠ ✌('ω'✌
)ࡾ✌('ω')✌ࡾ( ✌’ω')✌