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.1k
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.2k
3D rotation representation and its implementation
ishitatakeshi
0
320
Other Decks in Programming
See All in Programming
エラーって何種類あるの?
kajitack
5
310
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
220
Team operations that are not burdened by SRE
kazatohiei
1
260
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
330
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
200
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
240
A2A プロトコルを試してみる
azukiazusa1
2
1.2k
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
480
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
140
GraphRAGの仕組みまるわかり
tosuri13
8
500
Select API from Kotlin Coroutine
jmatsu
1
190
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
240
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Producing Creativity
orderedlist
PRO
346
40k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
The Straight Up "How To Draw Better" Workshop
denniskardys
234
140k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
RailsConf 2023
tenderlove
30
1.1k
How STYLIGHT went responsive
nonsquared
100
5.6k
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
結果