Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
dc7fa790
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dc7fa790
编写于
7月 10, 2019
作者:
X
xj.lin
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/branch-0.3.1' into add_unittest
Former-commit-id: f974346f7a52f1eef43526376c21a7bcbbda4ce5
上级
3d3047af
c6608ba9
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
81 addition
and
32 deletion
+81
-32
cpp/cmake/ThirdPartyPackages.cmake
cpp/cmake/ThirdPartyPackages.cmake
+1
-1
cpp/src/db/Factories.cpp
cpp/src/db/Factories.cpp
+0
-2
cpp/unittest/CMakeLists.txt
cpp/unittest/CMakeLists.txt
+1
-1
cpp/unittest/db/CMakeLists.txt
cpp/unittest/db/CMakeLists.txt
+5
-3
cpp/unittest/faiss_wrapper/CMakeLists.txt
cpp/unittest/faiss_wrapper/CMakeLists.txt
+3
-3
cpp/unittest/license/CMakeLists.txt
cpp/unittest/license/CMakeLists.txt
+3
-3
cpp/unittest/metrics/CMakeLists.txt
cpp/unittest/metrics/CMakeLists.txt
+2
-2
cpp/unittest/server/CMakeLists.txt
cpp/unittest/server/CMakeLists.txt
+3
-3
cpp/unittest/server/cache_test.cpp
cpp/unittest/server/cache_test.cpp
+61
-12
cpp/unittest/storage/CMakeLists.txt
cpp/unittest/storage/CMakeLists.txt
+1
-1
cpp/unittest/utils/CMakeLists.txt
cpp/unittest/utils/CMakeLists.txt
+1
-1
未找到文件。
cpp/cmake/ThirdPartyPackages.cmake
浏览文件 @
dc7fa790
...
@@ -534,7 +534,7 @@ if(MILVUS_BOOST_VENDORED)
...
@@ -534,7 +534,7 @@ if(MILVUS_BOOST_VENDORED)
""
""
${
EP_LOG_OPTIONS
}
)
${
EP_LOG_OPTIONS
}
)
set
(
Boost_INCLUDE_DIR
"
${
BOOST_PREFIX
}
"
)
set
(
Boost_INCLUDE_DIR
"
${
BOOST_PREFIX
}
"
)
set
(
Boost_INCLUDE_DIRS
"
${
B
OOST
_INCLUDE_DIR
}
"
)
set
(
Boost_INCLUDE_DIRS
"
${
B
oost
_INCLUDE_DIR
}
"
)
add_dependencies
(
boost_system_static boost_ep
)
add_dependencies
(
boost_system_static boost_ep
)
add_dependencies
(
boost_filesystem_static boost_ep
)
add_dependencies
(
boost_filesystem_static boost_ep
)
add_dependencies
(
boost_serialization_static boost_ep
)
add_dependencies
(
boost_serialization_static boost_ep
)
...
...
cpp/src/db/Factories.cpp
浏览文件 @
dc7fa790
...
@@ -26,8 +26,6 @@ namespace zilliz {
...
@@ -26,8 +26,6 @@ namespace zilliz {
namespace
milvus
{
namespace
milvus
{
namespace
engine
{
namespace
engine
{
#define USE_NEW_MEM_MANAGER 1
DBMetaOptions
DBMetaOptionsFactory
::
Build
(
const
std
::
string
&
path
)
{
DBMetaOptions
DBMetaOptionsFactory
::
Build
(
const
std
::
string
&
path
)
{
auto
p
=
path
;
auto
p
=
path
;
if
(
p
==
""
)
{
if
(
p
==
""
)
{
...
...
cpp/unittest/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -37,7 +37,7 @@ set(unittest_libs
...
@@ -37,7 +37,7 @@ set(unittest_libs
${
CUDA_TOOLKIT_ROOT_DIR
}
/lib64/stubs/libnvidia-ml.so
${
CUDA_TOOLKIT_ROOT_DIR
}
/lib64/stubs/libnvidia-ml.so
)
)
#
add_subdirectory(server)
add_subdirectory
(
server
)
add_subdirectory
(
db
)
add_subdirectory
(
db
)
add_subdirectory
(
index_wrapper
)
add_subdirectory
(
index_wrapper
)
#add_subdirectory(faiss_wrapper)
#add_subdirectory(faiss_wrapper)
...
...
cpp/unittest/db/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -24,6 +24,8 @@ link_directories("/usr/local/cuda/lib64")
...
@@ -24,6 +24,8 @@ link_directories("/usr/local/cuda/lib64")
include_directories
(
/usr/include/mysql
)
include_directories
(
/usr/include/mysql
)
#add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
set
(
db_test_src
set
(
db_test_src
#${unittest_srcs}
#${unittest_srcs}
${
config_files
}
${
config_files
}
...
@@ -40,8 +42,8 @@ cuda_add_executable(db_test ${db_test_src})
...
@@ -40,8 +42,8 @@ cuda_add_executable(db_test ${db_test_src})
set
(
db_libs
set
(
db_libs
sqlite
sqlite
boost_system
boost_system
_static
boost_filesystem
boost_filesystem
_static
lz4
lz4
mysqlpp
mysqlpp
)
)
...
@@ -59,6 +61,6 @@ set(knowhere_libs
...
@@ -59,6 +61,6 @@ set(knowhere_libs
cublas
cublas
)
)
target_link_libraries
(
db_test
${
db_libs
}
${
unittest_libs
}
${
knowhere
_libs
}
)
target_link_libraries
(
db_test
${
knowhere_libs
}
${
db_libs
}
${
unittest
_libs
}
)
install
(
TARGETS db_test DESTINATION bin
)
install
(
TARGETS db_test DESTINATION bin
)
cpp/unittest/faiss_wrapper/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -22,13 +22,13 @@ add_executable(wrapper_test ${wrapper_test_src})
...
@@ -22,13 +22,13 @@ add_executable(wrapper_test ${wrapper_test_src})
set
(
wrapper_libs
set
(
wrapper_libs
stdc++
stdc++
boost_system
boost_system
_static
boost_filesystem
boost_filesystem
_static
libgpufaiss.a
libgpufaiss.a
faiss
faiss
cudart
cudart
cublas
cublas
sqlite
3
sqlite
snappy
snappy
bz2
bz2
z
z
...
...
cpp/unittest/license/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -33,11 +33,11 @@ set(db_libs
...
@@ -33,11 +33,11 @@ set(db_libs
nvidia-ml
nvidia-ml
cudart
cudart
cublas
cublas
boost_system
boost_system
_static
boost_filesystem
boost_filesystem
_static
lz4
lz4
crypto
crypto
boost_serialization
boost_serialization
_static
)
)
target_link_libraries
(
license_test
${
db_libs
}
${
unittest_libs
}
)
target_link_libraries
(
license_test
${
db_libs
}
${
unittest_libs
}
)
cpp/unittest/metrics/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -78,8 +78,8 @@ target_link_libraries(metrics_test
...
@@ -78,8 +78,8 @@ target_link_libraries(metrics_test
cudart
cudart
cublas
cublas
sqlite
sqlite
boost_system
boost_system
_static
boost_filesystem
boost_filesystem
_static
lz4
lz4
metrics
metrics
gtest
gtest
...
...
cpp/unittest/server/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -39,9 +39,9 @@ set(require_libs
...
@@ -39,9 +39,9 @@ set(require_libs
stdc++
stdc++
cudart
cudart
cublas
cublas
sqlite
3
sqlite
boost_system
boost_system
_static
boost_filesystem
boost_filesystem
_static
snappy
snappy
z
z
bz2
bz2
...
...
cpp/unittest/server/cache_test.cpp
浏览文件 @
dc7fa790
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include "cache/GpuCacheMgr.h"
#include "cache/GpuCacheMgr.h"
#include "wrapper/Index.h"
#include "wrapper/Index.h"
#include "wrapper/knowhere/vec_index.h"
using
namespace
zilliz
::
milvus
;
using
namespace
zilliz
::
milvus
;
...
@@ -26,6 +27,54 @@ public:
...
@@ -26,6 +27,54 @@ public:
}
}
};
};
class
MockVecIndex
:
public
engine
::
VecIndex
{
public:
virtual
void
BuildAll
(
const
long
&
nb
,
const
float
*
xb
,
const
long
*
ids
,
const
engine
::
Config
&
cfg
,
const
long
&
nt
=
0
,
const
float
*
xt
=
nullptr
)
{
}
virtual
void
Add
(
const
long
&
nb
,
const
float
*
xb
,
const
long
*
ids
,
const
engine
::
Config
&
cfg
=
engine
::
Config
())
{
}
virtual
void
Search
(
const
long
&
nq
,
const
float
*
xq
,
float
*
dist
,
long
*
ids
,
const
engine
::
Config
&
cfg
=
engine
::
Config
())
{
}
virtual
int64_t
Dimension
()
{
return
dimension_
;
}
virtual
int64_t
Count
()
{
return
ntotal_
;
}
virtual
zilliz
::
knowhere
::
BinarySet
Serialize
()
{
zilliz
::
knowhere
::
BinarySet
binset
;
return
binset
;
}
virtual
void
Load
(
const
zilliz
::
knowhere
::
BinarySet
&
index_binary
)
{
}
public:
int64_t
dimension_
=
512
;
int64_t
ntotal_
=
0
;
};
}
}
TEST
(
CacheTest
,
CPU_CACHE_TEST
)
{
TEST
(
CacheTest
,
CPU_CACHE_TEST
)
{
...
@@ -40,9 +89,9 @@ TEST(CacheTest, CPU_CACHE_TEST) {
...
@@ -40,9 +89,9 @@ TEST(CacheTest, CPU_CACHE_TEST) {
const
int
dim
=
256
;
const
int
dim
=
256
;
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
std
::
shared_ptr
<
faiss
::
Index
>
raw_index
(
faiss
::
index_factory
(
dim
,
"IDMap,Flat"
)
);
MockVecIndex
*
mock_index
=
new
MockVecIndex
(
);
engine
::
Index_ptr
index
=
std
::
make_shared
<
engine
::
Index
>
(
raw_index
);
mock_index
->
ntotal_
=
1000000
;
//less 1G per index
index
->
ntotal
=
1000000
;
//less 1G per index
engine
::
Index_ptr
index
(
mock_index
);
cpu_mgr
->
InsertItem
(
"index_"
+
std
::
to_string
(
i
),
index
);
cpu_mgr
->
InsertItem
(
"index_"
+
std
::
to_string
(
i
),
index
);
}
}
...
@@ -65,9 +114,9 @@ TEST(CacheTest, CPU_CACHE_TEST) {
...
@@ -65,9 +114,9 @@ TEST(CacheTest, CPU_CACHE_TEST) {
g_num
=
5
;
g_num
=
5
;
cpu_mgr
->
SetCapacity
(
g_num
*
gbyte
);
cpu_mgr
->
SetCapacity
(
g_num
*
gbyte
);
std
::
shared_ptr
<
faiss
::
Index
>
raw_index
(
faiss
::
index_factory
(
dim
,
"IDMap,Flat"
)
);
MockVecIndex
*
mock_index
=
new
MockVecIndex
(
);
engine
::
Index_ptr
index
=
std
::
make_shared
<
engine
::
Index
>
(
raw_index
);
mock_index
->
ntotal_
=
6000000
;
//6G less
index
->
ntotal
=
6000000
;
//6G less
engine
::
Index_ptr
index
(
mock_index
);
cpu_mgr
->
InsertItem
(
"index_6g"
,
index
);
cpu_mgr
->
InsertItem
(
"index_6g"
,
index
);
ASSERT_EQ
(
cpu_mgr
->
ItemCount
(),
0
);
//data greater than capacity can not be inserted sucessfully
ASSERT_EQ
(
cpu_mgr
->
ItemCount
(),
0
);
//data greater than capacity can not be inserted sucessfully
...
@@ -82,9 +131,9 @@ TEST(CacheTest, GPU_CACHE_TEST) {
...
@@ -82,9 +131,9 @@ TEST(CacheTest, GPU_CACHE_TEST) {
const
int
dim
=
256
;
const
int
dim
=
256
;
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
std
::
shared_ptr
<
faiss
::
Index
>
raw_index
(
faiss
::
index_factory
(
dim
,
"IDMap,Flat"
)
);
MockVecIndex
*
mock_index
=
new
MockVecIndex
(
);
engine
::
Index_ptr
index
=
std
::
make_shared
<
engine
::
Index
>
(
raw_index
)
;
mock_index
->
ntotal_
=
1000
;
index
->
ntotal
=
1000
;
engine
::
Index_ptr
index
(
mock_index
)
;
cache
::
DataObjPtr
obj
=
std
::
make_shared
<
cache
::
DataObj
>
(
index
);
cache
::
DataObjPtr
obj
=
std
::
make_shared
<
cache
::
DataObj
>
(
index
);
...
@@ -117,9 +166,9 @@ TEST(CacheTest, INVALID_TEST) {
...
@@ -117,9 +166,9 @@ TEST(CacheTest, INVALID_TEST) {
{
{
LessItemCacheMgr
mgr
;
LessItemCacheMgr
mgr
;
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
std
::
shared_ptr
<
faiss
::
Index
>
raw_index
(
faiss
::
index_factory
(
2
,
"IDMap,Flat"
)
);
MockVecIndex
*
mock_index
=
new
MockVecIndex
(
);
engine
::
Index_ptr
index
=
std
::
make_shared
<
engine
::
Index
>
(
raw_index
)
;
mock_index
->
ntotal_
=
2
;
index
->
ntotal
=
2
;
engine
::
Index_ptr
index
(
mock_index
)
;
cache
::
DataObjPtr
obj
=
std
::
make_shared
<
cache
::
DataObj
>
(
index
);
cache
::
DataObjPtr
obj
=
std
::
make_shared
<
cache
::
DataObj
>
(
index
);
mgr
.
InsertItem
(
"index_"
+
std
::
to_string
(
i
),
obj
);
mgr
.
InsertItem
(
"index_"
+
std
::
to_string
(
i
),
obj
);
...
...
cpp/unittest/storage/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -25,7 +25,7 @@ set(s3_client_libs
...
@@ -25,7 +25,7 @@ set(s3_client_libs
stdc++
stdc++
aws-cpp-sdk-s3
aws-cpp-sdk-s3
aws-cpp-sdk-core
aws-cpp-sdk-core
boost_filesystem
boost_filesystem
_static
)
)
target_link_libraries
(
s3_test
target_link_libraries
(
s3_test
${
s3_client_libs
}
${
s3_client_libs
}
...
...
cpp/unittest/utils/CMakeLists.txt
浏览文件 @
dc7fa790
...
@@ -25,6 +25,6 @@ add_executable(valication_util_test
...
@@ -25,6 +25,6 @@ add_executable(valication_util_test
target_link_libraries
(
valication_util_test
target_link_libraries
(
valication_util_test
${
unittest_libs
}
${
unittest_libs
}
boost_filesystem
)
boost_filesystem
_static
)
install
(
TARGETS valication_util_test DESTINATION bin
)
install
(
TARGETS valication_util_test DESTINATION bin
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录