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
K Nearest Neighbourhood on GPU
Search
Ciel
July 24, 2014
Research
55
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
K Nearest Neighbourhood on GPU
K Nearest Neighbourhood using inverted list on GPU
Ciel
July 24, 2014
More Decks by Ciel
See All by Ciel
LLVM IR & Optimisation Techniques
imwithye
0
180
Other Decks in Research
See All in Research
オーストリア流 都市の公共交通サービス水準評価@公共交通オープンデータ最前線2026
trafficbrain
0
200
typst の使い方:言語学を研究する学生のために
gitomochang
0
510
AIエージェント時代のLLM-jpモデルのあるべき姿
k141303
0
510
計算情報学研究室(数理情報学第7研究室)2026
tomohirokoana
0
640
GLIM とMegaParticles:正規分布近似の限界とタイトカップリング&パーティクルフィルタの進展 / GLIM and MegaParticles : Progress of the distribution representation in SLAM
koide3
0
590
kintone リサーチ副部/UXリサーチャー 業務紹介
cybozuinsideout
PRO
0
110
2026年3月1日(日)福島「除染土」の公共利用をかんがえる
atsukomasano2026
0
670
重要だけど測れていないもの:高齢者ケアの見えない課題
theoriatec2024
0
410
議論 学術ムーブメントを成功させるために何が必要なのだろうか
rmaruy
0
100
敵対生成プロンプト同時探索による内省型プロンプト最適化
kinoue_smarthr
0
310
シングルチャネルマルチトーカー音声認識の進展
ryomasumura
0
190
National high-resolution cropland classification of Japan with agricultural census information and multi-temporal multi-modality datasets
satai
3
370
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
350
Utilizing Notion as your number one productivity tool
mfonobong
4
430
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
610
Art, The Web, and Tiny UX
lynnandtonic
304
22k
The Invisible Side of Design
smashingmag
301
52k
Evolving SEO for Evolving Search Engines
ryanjones
0
240
How to make the Groovebox
asonas
2
2.3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
200
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Music & Morning Musume
bryan
47
7.3k
30 Presentation Tips
portentint
PRO
1
350
Transcript
Genie-and- Lamp-GPU Yiwei Gong K Nearest Neighbourhood using inverted list
on GPU
K Nearest Neighbourhood Fundamental Operator in Data Mining Classification 0
5 10 15 20 0 3 6 9 12 Regression Collaborative Filtering You may like * Apple * Google * Amazon
SELECT SEX M AGE 18 SALARY 2900 Sex Age Salary
… M 20 3000 … F 17 3600 … M 18 4000 … F 19 2900 … K Nearest Neighbourhood A running example
SELECT SEX M AGE 18 SALARY 2900 K Nearest Neighbourhood
Sex Age Salary … M 20 3000 … F 17 3600 … M 18 4000 … F 19 2900 … A running example
DIM + VALUE SEX+M SEX+F AGE+18 AGE+19 … 2 0
3 1 2 Invert list: row_id SELECT SEX M AGE 18 SALARY 2900 3 How do we store the inverted list table on GPU?
DIM + VALUE Inverted List … … AGE+17 1 AGE+18
2, 3 AGE+19 4 AGE+20 9, 10 AGE+21 11 … … Row ID Count AGG … … … 1 0 0 2 0 0 3 0 0 4 0 0 … … … SELECT AGE 18±1 Step 1: Matching & Aggregation
DIM + VALUE Inverted List … … AGE+17 1 AGE+18
2, 3 AGE+19 4 AGE+20 9, 10 AGE+21 11 … … Row ID Count AGG … … … 1 0 0 2 1 1*0.5 3 1 1*0.5 4 0 0 … … … SELECT AGE 18±1 Step 1: Matching & Aggregation
DIM + VALUE Inverted List … … AGE+17 1 AGE+18
2, 3 AGE+19 4 AGE+20 9, 10 AGE+21 11 … … Row ID Count AGG … … … 1 1 1*0.5 2 1 1*0.5 3 1 1*0.5 4 1 1*0.5 … … … SELECT AGE 18±1 Step 1: Matching & Aggregation
DIM + VALUE Inverted List … … SALARY+2500 NULL SALARY+3000
0, 3 SALARY+3500 1 SALARY+4000 2 SALARY+4500 4,5 … … SELECT SALARY 2900±1000 Row ID Count AGG … … … 1 1 0.5 2 1 0.5 3 1 0.5 4 1 0.5 … … … Step 1: Matching & Aggregation
DIM + VALUE Inverted List … … SALARY+2500 NULL SALARY+3000
0, 3 SALARY+3500 1 SALARY+4000 2 SALARY+4500 4,5 … … Row ID Count AGG … … … 1 1 0.5 2 1 0.5 3 2 1*0.3+0.5 4 1 0.5 … … … SELECT SALARY 2900±1000 Step 1: Matching & Aggregation
Block 1 Block 2 Block 2 SEX AGE SALARY GPU
Parallel Matching
Row ID Count AGG … … … 1 1 0.5
2 1 0.5 3 2 0.8 4 1 0.5 … … … K Selection What is the fast K Selection algorithm? Step 2: K Selection
R_id R_id R_id R_id R_id R_id R_id D+V1 D+V2 D+V3
invert_list_idx invert_list_table end_index First approach to store the inverted list table on GPU GPU
Host Device Map Main Memory ! KEY GPU Memory !
VALUE
dimension + value1 dimension + value2 Invert_list_idx Invert_list_table
None
Mapping C P U ! M E M O R
Y
Mapping C P U ! M E M O R
Y
Mapping C P U ! M E M O R
Y MAP(KEY, INDEX) device_vector
Mapping C P U ! M E M O R
Y raw_pointer get(key) map(key, value) freeze() ratio()
Bucket Top K Selection Algorithm 2 4 1 5 2
1 K = 10 First 7 results Bucket_Num = (Value - MIN) / (MAX - MIN) * Number_Of_Buckets
Bucket Top K Selection Algorithm Accept Multi Queries K =
2 K = 5 K = 6 K = 3
#define NAME “YIWEI GONG” #define UNIVERSITY “NTU” #define EMAIL “
[email protected]
”
#define BLOG “http://ciel.im” #define ME “A stupid programmer” THANK YOU
Block 1 Block 2 Block 3 Block 4 Block 5
Block 6 GPU Thread 1 Thread 2 Thread 3 Thread 4 Thread 5 Thread 6 Block