Skip to content

Commit 5563786

Browse files
LinuxDev9002claude
andcommitted
Add workloads directory with llama.cpp, vllm, pytorch, and faiss benchmarks
Migrated from schedcp/workloads. Added faiss and llama.cpp source repos as proper submodules. Removed large binary artifacts (.venv, build dirs, dataset files, .so files, model weights) and added .gitignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 35ff4c1 commit 5563786

202 files changed

Lines changed: 27362 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@
1010
[submodule "/home/yunwei37/workspace/gpu/gpu_ext/docs/gpu-ext-paper"]
1111
path = /home/yunwei37/workspace/gpu/gpu_ext/docs/gpu-ext-paper
1212
url = https://github.com/yunwei37/gpu-ext-paper
13+
[submodule "workloads/faiss/faiss"]
14+
path = workloads/faiss/faiss
15+
url = https://github.com/eunomia-bpf/faiss
16+
[submodule "workloads/llama.cpp/llama.cpp"]
17+
path = workloads/llama.cpp/llama.cpp
18+
url = https://github.com/eunomia-bpf/llama.cpp

workloads/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Virtual environments
2+
.venv/
3+
venv/
4+
env/
5+
6+
# Build artifacts
7+
build/
8+
*.so
9+
*.o
10+
*.a
11+
12+
# Python cache
13+
__pycache__/
14+
*.pyc
15+
16+
# Large datasets (download via scripts)
17+
datasets/
18+
19+
# Model weights
20+
*.gguf
21+
*.safetensors
22+
*.bin
23+
*.pt
24+
*.pth
25+
26+
# IDE / editor
27+
.claude/
28+
.vscode/
29+
.idea/
30+
31+
# Logs
32+
*.log

workloads/faiss/DATASET.md

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# FAISS Dataset Documentation
2+
3+
## Overview
4+
5+
This document describes the datasets used for FAISS benchmarking, their organization, file formats, and usage patterns.
6+
7+
## Dataset Location
8+
9+
All benchmark datasets are stored in:
10+
```
11+
/home/yunwei37/workspace/gpu/schedcp/workloads/faiss/faiss/benchs/bigann/
12+
```
13+
14+
## SIFT1B (BigANN) Dataset
15+
16+
### Description
17+
- **Name**: SIFT1B (also known as BigANN)
18+
- **Source**: http://corpus-texmex.irisa.fr/
19+
- **Purpose**: Billion-scale similarity search benchmark
20+
- **Vector Type**: SIFT descriptors (128-dimensional unsigned byte vectors)
21+
- **Total Size**: ~116 GB (with compressed archives)
22+
23+
### Dataset Files
24+
25+
#### Base Vectors (`bigann_base.bvecs`)
26+
- **Size**: 47 GB (uncompressed)
27+
- **Vectors**: 375,489,504 vectors (375M out of 1B total)
28+
- **Format**: bvecs (binary vectors)
29+
- **Structure**: Each vector is 128 dimensions × uint8
30+
- **Memory Layout**:
31+
```
32+
[dim:4bytes][data:128bytes][dim:4bytes][data:128bytes]...
33+
```
34+
- **Usage**: Primary dataset for index building and search
35+
36+
**Available Scales:**
37+
- SIFT1M: 1,000,000 vectors (~122 MB)
38+
- SIFT2M: 2,000,000 vectors (~244 MB)
39+
- SIFT5M: 5,000,000 vectors (~610 MB)
40+
- SIFT10M: 10,000,000 vectors (~1.22 GB)
41+
- SIFT20M: 20,000,000 vectors (~2.44 GB)
42+
- SIFT50M: 50,000,000 vectors (~6.1 GB)
43+
- SIFT100M: 100,000,000 vectors (~12.2 GB)
44+
- SIFT200M: 200,000,000 vectors (~24.4 GB)
45+
- SIFT375M: 375,489,504 vectors (~45.8 GB) - **Current Maximum**
46+
47+
#### Learn Vectors (`bigann_learn.bvecs`)
48+
- **Size**: 13 GB
49+
- **Vectors**: 100,000,000 vectors
50+
- **Format**: bvecs
51+
- **Usage**: Training data for learning index quantizers and centroids
52+
53+
#### Query Vectors (`bigann_query.bvecs`)
54+
- **Size**: 1.3 MB
55+
- **Vectors**: 10,000 vectors
56+
- **Format**: bvecs
57+
- **Usage**: Query set for evaluating search accuracy and performance
58+
59+
### Ground Truth Files (`gnd/` directory)
60+
61+
Located in `faiss/benchs/bigann/gnd/`, these files provide exact nearest neighbor results for accuracy evaluation.
62+
63+
**Index Files (idx_*.ivecs)**: Nearest neighbor IDs
64+
- `idx_1M.ivecs` - Ground truth for SIFT1M (39 MB)
65+
- `idx_2M.ivecs` - Ground truth for SIFT2M (39 MB)
66+
- `idx_5M.ivecs` - Ground truth for SIFT5M (39 MB)
67+
- `idx_10M.ivecs` - Ground truth for SIFT10M (39 MB)
68+
- `idx_20M.ivecs` - Ground truth for SIFT20M (39 MB)
69+
- `idx_50M.ivecs` - Ground truth for SIFT50M (39 MB)
70+
- `idx_100M.ivecs` - Ground truth for SIFT100M (39 MB)
71+
- `idx_200M.ivecs` - Ground truth for SIFT200M (39 MB)
72+
- `idx_500M.ivecs` - Ground truth for SIFT500M (39 MB)
73+
- `idx_1000M.ivecs` - Ground truth for SIFT1000M (39 MB)
74+
75+
**Distance Files (dis_*.fvecs)**: Distances to nearest neighbors
76+
- `dis_1M.fvecs` through `dis_1000M.fvecs` (39 MB each)
77+
78+
**Ground Truth Format:**
79+
- Each file contains 10,000 rows (one per query)
80+
- Each row contains 1,000 nearest neighbor indices/distances
81+
- Format: `[n:4bytes][ids/dists:n*4bytes]...`
82+
83+
## File Formats
84+
85+
### BVECS Format (Binary Vectors, uint8)
86+
```
87+
Structure per vector:
88+
- Dimension (d): 4 bytes (int32)
89+
- Vector data: d bytes (uint8)
90+
91+
Example for 128D:
92+
[128][v0][v1]...[v127][128][v0][v1]...[v127]...
93+
```
94+
95+
**Reading BVECS in Python:**
96+
```python
97+
import numpy as np
98+
99+
def mmap_bvecs(fname):
100+
"""Memory-map a bvecs file"""
101+
x = np.memmap(fname, dtype='uint8', mode='r')
102+
d = x[:4].view('int32')[0]
103+
return x.reshape(-1, d + 4)[:, 4:]
104+
105+
# Usage
106+
xb = mmap_bvecs('faiss/benchs/bigann/bigann_base.bvecs')
107+
print(f"Shape: {xb.shape}") # (375489504, 128)
108+
print(f"Dtype: {xb.dtype}") # uint8
109+
```
110+
111+
### IVECS Format (Integer Vectors, int32)
112+
```
113+
Structure per vector:
114+
- Dimension (d): 4 bytes (int32)
115+
- Vector data: d * 4 bytes (int32)
116+
117+
Used for: Ground truth indices
118+
```
119+
120+
**Reading IVECS in Python:**
121+
```python
122+
import numpy as np
123+
124+
def ivecs_read(fname):
125+
"""Read ivecs file"""
126+
a = np.fromfile(fname, dtype='int32')
127+
d = a[0]
128+
return a.reshape(-1, d + 1)[:, 1:].copy()
129+
130+
# Usage
131+
gt_I = ivecs_read('faiss/benchs/bigann/gnd/idx_100M.ivecs')
132+
print(f"Shape: {gt_I.shape}") # (10000, 1000) - 10K queries, 1000 neighbors each
133+
```
134+
135+
### FVECS Format (Float Vectors, float32)
136+
```
137+
Structure per vector:
138+
- Dimension (d): 4 bytes (int32)
139+
- Vector data: d * 4 bytes (float32)
140+
141+
Used for: Ground truth distances, embeddings
142+
```
143+
144+
## Memory-Mapped File Usage
145+
146+
Benchmark scripts use memory-mapped files to avoid loading entire datasets into RAM:
147+
148+
```python
149+
# Memory-mapped access (recommended for large files)
150+
xb = np.memmap('bigann_base.bvecs', dtype='uint8', mode='r')
151+
d = xb[:4].view('int32')[0]
152+
xb = xb.reshape(-1, d + 4)[:, 4:]
153+
154+
# Access subset without loading full file
155+
subset = xb[:10_000_000] # First 10M vectors
156+
```
157+
158+
**Benefits:**
159+
- Only accessed portions loaded into RAM
160+
- Enables working with datasets larger than available memory
161+
- OS handles caching and paging automatically
162+
163+
## Dataset Size Selection
164+
165+
### By GPU Memory
166+
167+
**8 GB VRAM:**
168+
- Direct GPU: SIFT10M (~5 GB as float32)
169+
- With UVM: SIFT50M (~25 GB as float32, requires 32+ GB RAM)
170+
171+
**24 GB VRAM (RTX 4090/5090):**
172+
- Direct GPU: SIFT50M (~25 GB as float32)
173+
- With UVM: SIFT200M (~100 GB as float32, requires 128+ GB RAM)
174+
175+
**32 GB VRAM:**
176+
- Direct GPU: SIFT100M (~50 GB as float32)
177+
- With UVM: SIFT375M (~190 GB as float32, requires 256+ GB RAM)
178+
179+
### Dataset Trimming in Benchmarks
180+
181+
Benchmark scripts automatically trim datasets to requested size:
182+
183+
```python
184+
# From bench_gpu_1bn.py
185+
dbsize = 100 # Request 100M vectors
186+
187+
# Load and trim
188+
xb = mmap_bvecs('faiss/benchs/bigann/bigann_base.bvecs')
189+
xb = xb[:dbsize * 1000 * 1000] # Trim to 100,000,000 vectors
190+
191+
print(f"Using {xb.shape[0]} vectors")
192+
```
193+
194+
## Downloading Additional Data
195+
196+
Currently available: **375M vectors** (47 GB)
197+
198+
To download the full 1B dataset:
199+
200+
```bash
201+
cd /home/yunwei37/workspace/gpu/schedcp/workloads/faiss/faiss/benchs/bigann
202+
203+
# Download remaining base vectors (warning: ~120 GB total when complete)
204+
wget ftp://ftp.irisa.fr/local/texmex/corpus/bigann_base.bvecs
205+
206+
# Or download compressed version
207+
wget ftp://ftp.irisa.fr/local/texmex/corpus/bigann_base.bvecs.gz
208+
gunzip bigann_base.bvecs.gz
209+
```
210+
211+
**Download verification:**
212+
```bash
213+
# Check file size
214+
ls -lh bigann_base.bvecs
215+
216+
# Count vectors
217+
python3 -c "
218+
import numpy as np
219+
x = np.memmap('bigann_base.bvecs', dtype='uint8', mode='r')
220+
d = x[:4].view('int32')[0]
221+
n = len(x) // (d + 4)
222+
print(f'Vectors: {n:,}')
223+
print(f'Dimensions: {d}')
224+
"
225+
```
226+
227+
## Dataset Corruption and Repair
228+
229+
If you encounter reshape errors, the file may be incomplete or corrupted:
230+
231+
```bash
232+
# Fix truncated bvecs file
233+
python3 -c "
234+
import os
235+
size = os.path.getsize('faiss/benchs/bigann/bigann_base.bvecs')
236+
vector_size = 132 # 4 bytes (dim) + 128 bytes (data)
237+
complete_size = (size // vector_size) * vector_size
238+
if size != complete_size:
239+
os.truncate('faiss/benchs/bigann/bigann_base.bvecs', complete_size)
240+
print(f'Truncated to {complete_size:,} bytes ({(size-complete_size):+,} bytes)')
241+
else:
242+
print('File is valid')
243+
"
244+
```

0 commit comments

Comments
 (0)