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
1
710
明日業務で役立たない Web 開発 TIPS
hoto17296
0
55
Python をフル活用した工場への AI 導入 & データ活用基盤構築事例
hoto17296
0
2.1k
クソ bot 実装ライブコーディング
hoto17296
0
170
DeepGBM 論文の紹介
hoto17296
0
470
試行錯誤のための Docker 活用術
hoto17296
4
2.6k
Hive 集計テクニック
hoto17296
0
430
データ分析と Docker / Data Analysis with Docker
hoto17296
0
300
DeepCluster 論文の紹介
hoto17296
7
2.4k
Other Decks in Technology
See All in Technology
GitHub Actions/Docker/Terraform/Renovate で最小限の Monorepo CD パイプラインを作る / Minimalistic Monorepo CD Pipeline with GitHub Actions, Docker, Terraform and Renovate
yuyatakeyama
4
290
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
510
CDK Pipelinesをざっくり理解する
smt7174
0
200
つよつよリーダーが 抜けたらどうする? 〜ナビタイムのAgile⽀援組織の変遷〜
navitimejapan
PRO
7
1.6k
Sansanにおける全社横断データ分析基盤の挑戦と未来 / Challenges and Future of Cross-Organizational Data Analytics Platform at Sansan
sansan_randd
1
200
Difyを活用した「内省支援」エージェント開発の所感
gmoriki
2
860
社内でのサーバーレスアプリケーション開発を、プラットフォームエンジニアリングを整備して 迅速化・安定化させる取り組み
wakatsuki
0
2.6k
Passkey Autofill に賭けるマネーフォワード ID - Money Forward Tech Day 2024
nov
1
840
Platform Engineeringのエッセンスを小規模な開発組織に取り入れた事例紹介
ham0215
5
800
mcwithcode プロジェクト概要
takunology
0
7.9k
Plartform TeamのないPlatform Engineering
yashiro
2
290
Walking the minefield of Service Mesh
drequena
0
170
Featured
See All Featured
What the flash - Photography Introduction
edds
67
11k
The World Runs on Bad Software
bkeepers
PRO
64
11k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
26
4k
Being A Developer After 40
akosma
84
590k
Building an army of robots
kneath
302
42k
Designing on Purpose - Digital PM Summit 2013
jponch
114
6.9k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
322
23k
Typedesign – Prime Four
hannesfritz
39
2.3k
How to Ace a Technical Interview
jacobian
274
23k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
109
6.9k
GitHub's CSS Performance
jonrohan
1030
450k
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 Ͱ༡Ϳͷͨͷ͍͠ ✌('ω'✌
)ࡾ✌('ω')✌ࡾ( ✌’ω')✌