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
920
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.1k
3D rotation representation and its implementation
ishitatakeshi
0
250
Other Decks in Programming
See All in Programming
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
370
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
PostmanでAPIの動作確認が楽になった話
h455h1
0
160
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4k
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
940
Milestoner
bkuhlmann
1
410
Semantic search with Django and pgvector
pauloxnet
0
240
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
0
690
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
290
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
250
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
280
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
700
Featured
See All Featured
Designing for Performance
lara
601
67k
[RailsConf 2023] Rails as a piece of cake
palkan
23
3.9k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
659
120k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
Become a Pro
speakerdeck
PRO
11
4.5k
A Modern Web Designer's Workflow
chriscoyier
689
190k
RailsConf 2023
tenderlove
4
540
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Building Your Own Lightsaber
phodgson
99
5.7k
Ruby is Unlike a Banana
tanoku
96
10k
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
結果