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
CUDAでヒストグラム計算を書いてcupyにmergeしてもらった
Search
Ishita Takeshi
May 24, 2018
Programming
0
1.2k
CUDAでヒストグラム計算を書いてcupyにmergeしてもらった
Ishita Takeshi
May 24, 2018
Tweet
Share
More Decks by Ishita Takeshi
See All by Ishita Takeshi
Sparse Bundle Adjustment
ishitatakeshi
1
1.3k
3D rotation representation and its implementation
ishitatakeshi
0
340
Other Decks in Programming
See All in Programming
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
100
CSC509 Lecture 13
javiergs
PRO
0
260
AIと協働し、イベントソーシングとアクターモデルで作る後悔しないアーキテクチャ Regret-Free Architecture with AI, Event Sourcing, and Actors
tomohisa
2
8.7k
詳細の決定を遅らせつつ実装を早くする
shimabox
2
1.3k
AI時代もSEOを頑張っている話
shirahama_x
0
170
All(?) About Point Sets
hole
0
210
モビリティSaaSにおけるデータ利活用の発展
nealle
1
620
AI駆動開発ライフサイクル(AI-DLC)のホワイトペーパーを解説
swxhariu5
0
1.4k
PHPライセンス変更の議論を通じて学ぶOSSライセンスの基礎
matsuo_atsushi
0
170
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
32
14k
「文字列→日付」の落とし穴 〜Ruby Date.parseの意外な挙動〜
sg4k0
0
270
2025 컴포즈 마법사
jisungbin
0
150
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
Music & Morning Musume
bryan
46
7k
4 Signs Your Business is Dying
shpigford
186
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
Making Projects Easy
brettharned
120
6.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
How to train your dragon (web standard)
notwaldorf
97
6.4k
KATA
mclloyd
PRO
32
15k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Transcript
CUDAでヒストグラム計算を書いて cupyにmergeしてもらった
石田 岳志 (@sonicair) 東京高専 専攻科 2年 (B4) • qiita.com/IshitaTakeshi •
日経ソフトウエア 2017年8月号 • 特許6306770 日経ソフトウエア 2017年8月号 日経BP社
やったこと PCANet (Chan et al. 2014) を実装した → CUDAでヒストグラム計算を書いた →
CuPyにpull requestを送った → mergeしてもらった
動機:PCANetの実装 • フィルタの重みをPCAで計算できるCNN • (論文によると) PCAなので学習が速い Chan, Tsung-Han, et al.
"PCANet: A simple deep learning baseline for image classification?." IEEE Transactions on Image Processing 24.12 (2015): 5017-5032.
None
CUDAで書こう!
Poolingが重い → CUDAで書こう! cupy.ElementwiseKernel • 並列処理をCUDAで直接書ける
戦略: 並列化してそれぞれ二分探索 2 0 1 2 3 4 5 6
-0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 -0.5 = bins[0] <= 2 <= bins[6] =
5.5 0 1 2 3 4 5 6 -0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 0 1 2 3 4 5 6 -0.5
0.5 1.5 2.5 3.5 4.5 5.5 3 = (0 + 6) / 2 bins[3] = 2.5
戦略: 並列化してそれぞれ二分探索 3 = (0 + 6) / 2 bins[3]
= 2.5 >= 2 0 1 2 3 4 5 6 -0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 1 = (0 + 3) / 2 bins[1]
= 0.5 0 1 2 3 4 5 6 -0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 1 = (0 + 3) / 2 bins[1]
= 0.5 <= 2 0 1 2 3 4 5 6 -0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 2 = (1 + 3) / 2 bins[2]
= 1.5 0 1 2 3 4 5 6 -0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 2 = (1 + 3) / 2 bins[2]
= 1.5 <= 2 0 1 2 3 4 5 6 -0.5 0.5 1.5 2.5 3.5 4.5 5.5
戦略: 並列化してそれぞれ二分探索 0 1 2 3 4 5 6 -0.5
0.5 1.5 2.5 3.5 4.5 5.5 2 -> 2
https://github.com/cupy/cupy/pull/298
https://github.com/cupy/cupy/pull/298
PFNの方々にご協力いただきました @unnonouno さん @okuta さん ありがとうございました
評価 GPU TITAN X (Pascal) CPU Intel Core i7-6700 Binの数,サンプル数
を 24~216 の範囲で 変化させて実行時間を調査
None
結果