Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b8a7fad
add pytorch script for Subsampled Randomized Hadamard Transform (SRHT)
darthnoward May 25, 2023
ffa0c29
1. add the c++ function of loading prototype from python, see test/sy…
TONYSKYZENG Jun 19, 2023
71f489c
Merge pull request #18 from intellistream/SRHT
darthnoward Jun 19, 2023
ad92bd0
implement BlockLRA algorithm, under decomposition SVD-based method
heyyuhao Jun 23, 2023
a532af4
1. add the experimental feature of single thread streaming
TONYSKYZENG Jun 23, 2023
8203e25
1. add the experimental feature of single thread streaming
TONYSKYZENG Jun 24, 2023
0def735
1. now make the streaming on both A and B possible
TONYSKYZENG Jun 24, 2023
fcdc517
Merge pull request #46 from intellistream/Streaming
TONYSKYZENG Jun 25, 2023
37e5d3a
add raw PQ, using Euclidean distance to find matching prototypes.
darthnoward Jun 25, 2023
9f102ec
add PQ Hash, using hash function to find matching prototypes
darthnoward Jun 25, 2023
a7ee25f
Merge branch 'main' into PQ
TONYSKYZENG Jun 26, 2023
330079d
Merge pull request #47 from intellistream/PQ
TONYSKYZENG Jun 26, 2023
aad5a3c
1. fix doxygen bugs
TONYSKYZENG Jun 26, 2023
70bb787
Merge pull request #48 from intellistream/Nightly_fix
TONYSKYZENG Jun 26, 2023
76d6bab
1. fix doxygen bugs
TONYSKYZENG Jun 26, 2023
38ba531
1. fix doxygen bugs
TONYSKYZENG Jun 26, 2023
c45fdb2
Merge pull request #49 from intellistream/Nightly_fix_2
TONYSKYZENG Jun 26, 2023
c046216
Added Fast JLT algo
Lutetium-Vanadium Jun 26, 2023
62023a5
Merge branch 'main' into FastJLT
Lutetium-Vanadium Jun 26, 2023
d275f1a
1. fix latency calculation bugs
TONYSKYZENG Jun 27, 2023
7463ef1
Merge pull request #51 from intellistream/Nightly_fix_2
TONYSKYZENG Jun 27, 2023
88ccfad
add more algorithm config for streaming
darthnoward Jun 27, 2023
6f4bf67
add RIP algorithm
heyyuhao Jun 29, 2023
d2b13e5
add matrix loader
heyyuhao Jun 29, 2023
af265d4
merge main
heyyuhao Jun 29, 2023
6ec557c
Merge pull request #52 from intellistream/decomposition-svd-yuhao
heyyuhao Jun 29, 2023
5ffdf81
merge main
heyyuhao Jun 29, 2023
a519692
Merge pull request #53 from intellistream/improved_JL_RIP
heyyuhao Jun 29, 2023
29528de
Merge branch 'main' into FastJLT
darthnoward Jun 29, 2023
042ba1e
Merge pull request #50 from intellistream/FastJLT
darthnoward Jun 29, 2023
d55fa26
Merge branch 'main' into sift
heyyuhao Jun 29, 2023
94a4b13
Hotfix RIPCPPAlgo.cpp
heyyuhao Jun 29, 2023
3c25403
add block partition streamer, the stream is partitioned by rows per m…
darthnoward Jun 29, 2023
3a5bece
add benchmark script for scanning number of threads in block partitio…
darthnoward Jun 29, 2023
7cdf3d9
add SIFT table
heyyuhao Jun 29, 2023
02dd0dd
finish MNIST matrix dataloader
heyyuhao Jun 30, 2023
52923a1
switch to use of threadpool instead of threading in streaming block p…
darthnoward Jul 1, 2023
7579879
add block partition for two-sided stream
darthnoward Jul 4, 2023
526c90d
fix the bug regrading core binding in streaming block partition
darthnoward Jul 5, 2023
a0433a2
able to run PCA task
heyyuhao Jul 5, 2023
c1127fa
Merge pull request #54 from intellistream/StreamingBlockPartition
darthnoward Jul 6, 2023
f8efd81
compare different sketch size on PCA
heyyuhao Jul 6, 2023
48c703c
add some PCA experiments
heyyuhao Jul 7, 2023
5f21605
switch to pre-partition for one-sided stream
darthnoward Jul 9, 2023
404260f
Merge remote-tracking branch 'origin/main' into sift
heyyuhao Jul 10, 2023
c3a1700
add unified Streamer interface to better support the downstream tasks
darthnoward Jul 10, 2023
3e7d862
Merge pull request #55 from intellistream/sift
heyyuhao Jul 10, 2023
3ef84b4
extend unified Streamer interface to support non-streaming runtime
darthnoward Jul 11, 2023
5d3db9e
Merge pull request #56 from intellistream/prePartition
darthnoward Jul 11, 2023
f9d687b
integrate Streamer interface with PCA task
darthnoward Jul 14, 2023
dd7f35d
1. fix latency calculation bugs
TONYSKYZENG Jul 16, 2023
fa193a1
1. fix latency calculation bugs
TONYSKYZENG Jul 16, 2023
2f6e2f4
Merge pull request #58 from intellistream/pyBoundings
TONYSKYZENG Jul 16, 2023
e8694a8
add Vector Quantization
darthnoward Jul 17, 2023
1b20a5f
Merge pull request #57 from intellistream/Streamer
darthnoward Jul 17, 2023
816d4b0
Merge pull request #59 from intellistream/VQ
darthnoward Jul 18, 2023
9b2847f
1. fix latency calculation bugs
TONYSKYZENG Jul 18, 2023
152d46c
Merge pull request #60 from intellistream/ipmTest
TONYSKYZENG Jul 18, 2023
e0ee8c1
Merge branch 'BACKUP_OPENCL' into BACKUP_CL_P0
TONYSKYZENG Jul 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ jobs:
./sketch_test "--success"
./crs_test "--success"
./weighted_cr_test "--success"
./block_partition_test "--success"
./block_partition_test "--success"
./streaming_test "--success"
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@ install(DIRECTORY "include" DESTINATION "/IntelliStream" COMPONENT IntelliStream
file(GLOB allCopyFiles "${PROJECT_SOURCE_DIR}/scripts/*")
file(COPY ${allCopyFiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/benchmark/scripts)
file(COPY ${allCopyFiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/benchmark/scripts)
#file(COPY ${allCopyFiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/scripts)

# copy files needed for real world matrix loader
set(source_directory "${CMAKE_SOURCE_DIR}/benchmark/datasets/")
set(destination_directory "${CMAKE_BINARY_DIR}/benchmark/datasets/")
file(COPY ${source_directory} DESTINATION ${destination_directory})
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,6 @@ You will find the figures then.
to validate the highlight when you need it, and comment it during a compile. :)
4. When setting up torch for cpu under python version > 3.10, torch == 1.13.0 would conflict with torchaudio according
to https://pytorch.org/audio/stable/installation.html. Use Python version <= 3.10 for smooth installation.
5. Some heavy-weight algos like co-occurring FD may be treated as a zombie thread by some OS like ubuntu if running in default benchmark program, in this case
, please force them to be executed as a running child thread by setting forceMP(U64)=1 and threads(U64)=1 in config
5. Some heavy-weight algos like co-occurring FD may be treated as a zombie thread by some OS like ubuntu if running in
default benchmark program, in this case
, please force them to be executed as a running child thread by setting forceMP(U64)=1 and threads(U64)=1 in config
6 changes: 6 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ if (BUILD_BENCHMARKS)
include_directories("include/")
add_executable(benchmark "src/Benchmark.cpp")
target_link_libraries(benchmark IntelliStream)
add_executable(benchmarkPCA "src/BenchmarkPCA.cpp")
target_link_libraries(benchmarkPCA IntelliStream)

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/scripts
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
Expand All @@ -27,6 +29,10 @@ if (BUILD_BENCHMARKS)
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/config.csv
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

set_target_properties(benchmarkPCA PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripts/PCA)


file(COPY ${PROJECT_SOURCE_DIR}/src/CL
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
message("---Done building benchmarks")
Expand Down
Binary file added benchmark/datasets/siftsmall_base.fvecs
Binary file not shown.
Binary file added benchmark/datasets/train-images.idx3-ubyte
Binary file not shown.
18 changes: 9 additions & 9 deletions benchmark/pythonTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ def main():
# load the library, assume it is located together with this file
torch.ops.load_library("../libIntelliStream.so")
# gen the input tensor
a = torch.randn(2, 10)
b = torch.randn(2, 10)
a = torch.rand(100, 100)
b = torch.rand(100, 100)
# The pytorch +
print('/****test add****/')
print('pytorch+:', a + b)
print('pytorch-mm:', torch.matmul(a,b))
# our c++ extension of +
print('myLib+:', torch.ops.myLib.myVecAdd(a, b))
# The pytorch -
print('/****test sub****/')
print('pytorch-:', a - b)
# our c++ extension of -
print('myLib-:', torch.ops.myLib.myVecSub(a, b))
torch.ops.load_library("../libIntelliStream.so")
torch.ops.AMMBench.setTag('mm')
print('AMMBench-MM+:', torch.ops.AMMBench.ammDefault(a, b))
torch.ops.AMMBench.setTag('crs')
print('AMMBench-CRS+:', torch.ops.AMMBench.ammDefault(a, b))



if __name__ == "__main__":
Expand Down
8 changes: 0 additions & 8 deletions benchmark/results/threads/MM/2/config_threads2.csv

This file was deleted.

8 changes: 0 additions & 8 deletions benchmark/results/threads/MM/4/config_threads4.csv

This file was deleted.

8 changes: 0 additions & 8 deletions benchmark/results/threads/MM/6/config_threads6.csv

This file was deleted.

8 changes: 0 additions & 8 deletions benchmark/results/threads/MM/8/config_threads8.csv

This file was deleted.

73 changes: 73 additions & 0 deletions benchmark/scripts/PCA/preprocess.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import glob\n",
"import sys\n",
"sys.path.append('/home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/benchmark/scripts/PCA/scanSketchSize_SIFT')\n",
"from OoOCommon import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Change aRow, aCol, bCol in config file"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"for csv in glob.glob('/home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/benchmark/scripts/PCA/scanSketchSize_100000*1000*100000/config*.csv'):\n",
" aRow = csv.split('/')[-2].split('_')[1].split('*')[0]\n",
" aCol = csv.split('/')[-2].split('_')[1].split('*')[1]\n",
" bCol = csv.split('/')[-2].split('_')[1].split('*')[2]\n",
" editConfig(csv, csv, 'aRow', aRow)\n",
" editConfig(csv, csv, 'aCol', aCol)\n",
" editConfig(csv, csv, 'bCol', bCol)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
34 changes: 34 additions & 0 deletions benchmark/scripts/PCA/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_SIFT
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_SIFT
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_SIFT

cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_100*10000*100
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_100*10000*100
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_100*10000*100

cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_1000*1000*1000
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_1000*1000*1000
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_1000*1000*1000

cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_10000*100*10000
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_10000*100*10000
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_10000*100*10000

cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_1000*100000*1000
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_1000*100000*1000
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_1000*100000*1000

cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_10000*10000*10000
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_10000*10000*10000
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_10000*10000*10000

cd /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/scanSketchSize_100000*1000*100000
python3 drawTogether.py
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/figures/sketchDimension_100000*1000*100000
mv /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension /home/yuhao/Documents/work/SUTD/AMM/codespace/AMMBench/build/benchmark/scripts/PCA/results/sketchDimension_100000*1000*100000
125 changes: 125 additions & 0 deletions benchmark/scripts/PCA/scanSketchSize_100*10000*100/OoOCommon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import csv
import numpy as np
import matplotlib.pyplot as plt
import itertools as it
import os

import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pylab
from matplotlib.font_manager import FontProperties
from matplotlib.ticker import LogLocator, LinearLocator
import os
import pandas as pd
import sys
import matplotlib.ticker as mtick

OPT_FONT_NAME = 'Helvetica'
TICK_FONT_SIZE = 22
LABEL_FONT_SIZE = 28
LEGEND_FONT_SIZE = 30
LABEL_FP = FontProperties(style='normal', size=LABEL_FONT_SIZE)
LEGEND_FP = FontProperties(style='normal', size=LEGEND_FONT_SIZE)
TICK_FP = FontProperties(style='normal', size=TICK_FONT_SIZE)

MARKERS = (['*', '|', 'v', "^", "", "h", "<", ">", "+", "d", "<", "|", "", "+", "_"])
# you may want to change the color map for different figures
COLOR_MAP = (
'#B03A2E', '#2874A6', '#239B56', '#7D3C98', '#FFFFFF', '#F1C40F', '#F5CBA7', '#82E0AA', '#AEB6BF', '#AA4499')
# you may want to change the patterns for different figures
PATTERNS = (["////", "o", "", "||", "-", "//", "\\", "o", "O", "////", ".", "|||", "o", "---", "+", "\\\\", "*"])
LABEL_WEIGHT = 'bold'
LINE_COLORS = COLOR_MAP
LINE_WIDTH = 3.0
MARKER_SIZE = 15.0
MARKER_FREQUENCY = 1000


def editConfig(src, dest, key, value):
df = pd.read_csv(src, header=None)
rowIdx = 0
idxt = 0
for cell in df[0]:
# print(cell)
if (cell == key):
rowIdx = idxt
break
idxt = idxt + 1
df[1][rowIdx] = str(value)
df.to_csv(dest, index=False, header=False)


def readConfig(src, key):
df = pd.read_csv(src, header=None)
rowIdx = 0
idxt = 0
for cell in df[0]:
# print(cell)
if (cell == key):
rowIdx = idxt
break
idxt = idxt + 1
return df[1][rowIdx]


def draw2yLine(NAME, Com, R1, R2, l1, l2, m1, m2, fname):
fig, ax1 = plt.subplots(figsize=(10, 6.4))
lines = [None] * 2
# ax1.set_ylim(0, 1)
print(Com)
print(R1)
lines[0], = ax1.plot(Com, R1, color=LINE_COLORS[0], \
linewidth=LINE_WIDTH, marker=MARKERS[0], \
markersize=MARKER_SIZE
#
)

# plt.show()
ax1.set_ylabel(m1, fontproperties=LABEL_FP)
ax1.set_xlabel(NAME, fontproperties=LABEL_FP)
# ax1.set_xticklabels(ax1.get_xticklabels()) # 设置共用的x轴
plt.xticks(rotation=0, size=TICK_FONT_SIZE)
plt.yticks(rotation=0, size=TICK_FONT_SIZE)
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
ax2 = ax1.twinx()

# ax2.set_ylabel('latency/us')
# ax2.set_ylim(0, 0.5)
lines[1], = ax2.plot(Com, R2, color=LINE_COLORS[1], \
linewidth=LINE_WIDTH, marker=MARKERS[1], \
markersize=MARKER_SIZE)

ax2.set_ylabel(m2, fontproperties=LABEL_FP)
# ax2.vlines(192000, min(R2)-1, max(R2)+1, colors = "GREEN", linestyles = "dashed",label='total L1 size')
# plt.grid(axis='y', color='gray')

# style = dict(size=10, color='black')
# ax2.hlines(tset, 0, x2_list[len(x2_list)-1]+width, colors = "r", linestyles = "dashed",label="tset")
# ax2.text(4, tset, "$T_{set}$="+str(tset)+"us", ha='right', **style)

# plt.xlabel('batch', fontproperties=LABEL_FP)

# plt.xscale('log')
# figure.xaxis.set_major_locator(LinearLocator(5))
ax1.yaxis.set_major_locator(LinearLocator(5))
ax2.yaxis.set_major_locator(LinearLocator(5))
ax1.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.1f'))
ax2.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.1f'))
ax1.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.1f'))
ax2.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.1f'))
plt.legend(lines,
[l1, l2],
prop=LEGEND_FP,
loc='upper center',
ncol=1,
bbox_to_anchor=(0.55, 1.3
), shadow=False,
columnspacing=0.1,
frameon=True, borderaxespad=-1.5, handlelength=1.2,
handletextpad=0.1,
labelspacing=0.1)
plt.yticks(rotation=0, size=TICK_FONT_SIZE)
plt.tight_layout()

plt.savefig(fname + ".pdf")
Loading