Skip to content

Commit

Permalink
1. add PyQt
Browse files Browse the repository at this point in the history
  • Loading branch information
TONYSKYZENG committed Oct 30, 2024
1 parent 5391d2a commit 4482374
Show file tree
Hide file tree
Showing 6 changed files with 390 additions and 96 deletions.
5 changes: 2 additions & 3 deletions benchmark/scripts/PyCANDY/benchmark_tool/1.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
key,value,type
vecDim,768,I64
vecDim,4,I64
vecVolume,100000,I64
deleteRows,10000,I64
batchSize,4000,I64
metricType,IP,String
DCOBatchSize,5000,I64
initialRows,50000,I64
initialRows,5000,I64
indexTag,onlineIVFLSH,String
eventRateTps,4000,I64
querySize,100,I64
Expand All @@ -14,7 +14,6 @@ numberOfBuckets,8192,I64
sampleRows,2048,I64
useCRS,0,I64
dataLoaderTag,random,String
initialRows,50000,I64
staticDataSet,1,I64
lshMatrixType,random,String
ANNK,10,I64
Expand Down
5 changes: 5 additions & 0 deletions benchmark/scripts/PyCANDY/benchmark_tool/2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
key,value,type
95%latency(Del),0.000000,Double
95%latency(Insert),299785.000000,Double
QPS,549.637817,Double
recall,1.000000,Double
34 changes: 34 additions & 0 deletions benchmark/scripts/PyCANDY/benchmark_tool/BenchmarkTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,40 @@ def loadConfigFromFile(self, fileName,isRef=0,refTag ='flat'):
indexTag = self.configMap.get("indexTag", 'flat')
print(f"Data loader initialized with tag: {dataLoaderTag}")
self.dataLoader = candy.createDataLoader(dataLoaderTag)
self.isRef = isRef
if(isRef==1):
self.indexPtr = candy.createIndex(refTag)
print("This is just a ref")
else:
self.indexPtr = candy.createIndex(indexTag)
self.indexPtr.setConfig(configMap)
self.dataLoader.setConfig(configMap)
# 配置数据加载器
return self.configMap
def refFlag(self):
return self.isRef
def loadConfigFromDict(self, dict,isRef=0,refTag ='flat'):
"""
从Python字典读取内容并将其加载为配置字典。
:param dict: Dic - python字典
:param isRef: int - 是否用作参照而非评估
:para, refTag: str - 如果用作参照,启动哪一个算法作为基线
:return: dict - 配置内容的字典表示
"""
# 创建一个配置映射对象并从文件加载配置
configMap = candy.dictToConfigMap(dict)
self.configMapRaw = configMap
# 将配置映射对象转换为字典
self.configMap = candy.configMapToDict(configMap)
self.indexPtr = None
# 打印或返回配置字典以便进一步处理
print("Loaded configuration:", self.configMap)
dataLoaderTag = self.configMap.get("dataLoaderTag", "random")
indexTag = self.configMap.get("indexTag", 'flat')
print(f"Data loader initialized with tag: {dataLoaderTag}")
self.dataLoader = candy.createDataLoader(dataLoaderTag)
self.isRef = isRef
if(isRef==1):
self.indexPtr = candy.createIndex(refTag)
print("This is just a ref")
Expand Down
26 changes: 26 additions & 0 deletions benchmark/scripts/PyCANDY/benchmark_tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
### Simple benchmark tool under python

Test basic outcomes of delete, insert and search vectors, the result looks like the following
```shell
key,value,type
95%latency(Del),9426.000000,Double
95%latency(Insert),139137.000000,Double
QPS,644.554138,Double
recall,0.001000,Double
```
Advanced features like congestion and drop in C++ is not supported yet. Please make sure PyCandy is compliled and installed

#### Command line
```shell
python3 main.py <your config file>
```
### GUI (experimental)
You should install PyQT first, by
```shell
pip PyQt5
```
Then, run the following
```shell
python3 mainWindow.py
```
This GUI allows you to load config, modify some commom stream and batch settings, and run. If you don't load extra config, you can still use the basic field to assign and run.
Loading

0 comments on commit 4482374

Please sign in to comment.