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
120
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
明日業務で役立たない Web 開発 TIPS
hoto17296
0
44
Python をフル活用した工場への AI 導入 & データ活用基盤構築事例
hoto17296
0
2k
クソ bot 実装ライブコーディング
hoto17296
0
160
DeepGBM 論文の紹介
hoto17296
0
460
試行錯誤のための Docker 活用術
hoto17296
4
2.6k
Hive 集計テクニック
hoto17296
0
420
データ分析と Docker / Data Analysis with Docker
hoto17296
0
290
DeepCluster 論文の紹介
hoto17296
7
2.3k
最新論文を追う技術 / Technology to follow the latest paper
hoto17296
2
220
Other Decks in Technology
See All in Technology
頼られるのが大好きな 皆さんへ - 支援相手との期待の合わせ方、突き放し方 -/For_people_who_like_to_be_relied_on
naitosatoshi
1
290
ペパボのオブザーバビリティ研修2024 説明資料
kesompochy
0
1.1k
テスト・設計研修【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
170
Datadog Cloud SIEMを使ってAWS環境の脅威を可視化した話/lifeistech-datadog-cloud-siem
gidajun
0
480
フルリモートワークはエンジニアの夢を叶えたか? #cm_odyssey
mamohacy
2
600
楽しくGoを学び合う、LayerXの勉強会文化 / LayerX's study culture of having fun and learning Go together
ar_tama
2
350
コンテナ・K8s研修 - 後半 Kubernetes 基礎&ハンズオン【MIXI 24新卒技術研修】
mixi_engineers
PRO
1
120
AutomatedLabを使って内部ペンテストを勉強しよう! -やられ社内ネットワークの自動構築-
n_etupirka
1
610
OSSコミットしてZennの課題を解決した話
dyoshikawa1993
0
150
「我々はどこに向かっているのか」を問い続けるための仕組みづくり / Establishing a System for Continuous Inquiry about where we are
daitasu
0
170
開発と事業を繋ぐ!SREのオブザーバビリティ戦略 ~ Developers Summit 2024 Summer ~
leveragestech
0
620
エンジニアリングマネージャーはどう学んでいくのか #devsumi / How Do Engineering Managers Continue to Learn and Grow?
expajp
4
1.3k
Featured
See All Featured
Designing for Performance
lara
604
67k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
129
32k
Robots, Beer and Maslow
schacon
PRO
157
8.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
23
1.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
189
16k
Debugging Ruby Performance
tmm1
71
11k
Docker and Python
trallard
37
2.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
662
120k
The Invisible Side of Design
smashingmag
294
50k
A designer walks into a library…
pauljervisheath
201
24k
A Philosophy of Restraint
colly
200
16k
How to Think Like a Performance Engineer
csswizardry
4
590
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 Ͱ༡Ϳͷͨͷ͍͠ ✌('ω'✌
)ࡾ✌('ω')✌ࡾ( ✌’ω')✌