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
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.7k
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
360
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
1
16k
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
20250116_JAWS_Osaka
takuyay0ne
2
200
TSのコードをRustで書き直した話
askua
2
190
メールヘッダーを見てみよう
hinono
0
110
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
180
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
350
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
860
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.5k
2024年活動報告会(人材育成推進WG・ビジネスサブWG) / 20250114-OIDF-J-EduWG-BizSWG
oidfj
0
230
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
67
4.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Typedesign – Prime Four
hannesfritz
40
2.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Making Projects Easy
brettharned
116
6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Gamification - CAS2011
davidbonilla
80
5.1k
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 Ͱ༡Ϳͷͨͷ͍͠ ✌('ω'✌
)ࡾ✌('ω')✌ࡾ( ✌’ω')✌