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.2k
3D rotation representation and its implementation
ishitatakeshi
0
340
Other Decks in Programming
See All in Programming
CSC509 Lecture 07
javiergs
PRO
0
240
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
190
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
1
120
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
110
なんでRustの環境構築してないのにRust製のツールが動くの? / Why Do Rust-Based Tools Run Without a Rust Environment?
ssssota
2
2.8k
monorepo の Go テストをはやくした〜い!~最小の依存解決への道のり~ / faster-testing-of-monorepos
convto
2
520
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
1.1k
Pythonに漸進的に型をつける
nealle
1
110
Google Opalで使える37のライブラリ
mickey_kubo
3
130
XP, Testing and ninja testing ZOZ5
m_seki
3
790
ALL CODE BASE ARE BELONG TO STUDY
uzulla
27
6.6k
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
3
940
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
How STYLIGHT went responsive
nonsquared
100
5.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Producing Creativity
orderedlist
PRO
347
40k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Bash Introduction
62gerente
615
210k
Embracing the Ebb and Flow
colly
88
4.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
The Power of CSS Pseudo Elements
geoffreycrofte
79
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
結果