Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
88cf5e2b
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,发现更多精彩内容 >>
未验证
提交
88cf5e2b
编写于
3月 30, 2020
作者:
X
Xiaohai Xu
提交者:
GitHub
3月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize functions (#1803)
Signed-off-by:
N
sahuang
<
xiaohai.xu@zilliz.com
>
上级
dbbf91db
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
12 addition
and
20 deletion
+12
-20
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu
+1
-3
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu
+1
-3
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu
+1
-3
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu
.../index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu
+1
-3
core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu
core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu
+3
-2
core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh
core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh
+1
-2
core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu
core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu
+3
-2
core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh
core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh
+1
-2
未找到文件。
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFFlat.cu
浏览文件 @
88cf5e2b
...
...
@@ -212,13 +212,11 @@ GpuIndexIVFFlat::addImpl_(int n,
// Data is already resident on the GPU
Tensor
<
float
,
2
,
true
>
data
(
const_cast
<
float
*>
(
x
),
{
n
,
(
int
)
this
->
d
});
auto
bitset
=
toDevice
<
uint8_t
,
1
>
(
resources_
,
device_
,
nullptr
,
stream
,
{
0
});
static_assert
(
sizeof
(
long
)
==
sizeof
(
Index
::
idx_t
),
"size mismatch"
);
Tensor
<
long
,
1
,
true
>
labels
(
const_cast
<
long
*>
(
xids
),
{
n
});
// Not all vectors may be able to be added (some may contain NaNs etc)
index_
->
classifyAndAddVectors
(
data
,
labels
,
bitset
);
index_
->
classifyAndAddVectors
(
data
,
labels
);
// but keep the ntotal based on the total number of vectors that we attempted
// to add
...
...
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFPQ.cu
浏览文件 @
88cf5e2b
...
...
@@ -335,13 +335,11 @@ GpuIndexIVFPQ::addImpl_(int n,
// Data is already resident on the GPU
Tensor
<
float
,
2
,
true
>
data
(
const_cast
<
float
*>
(
x
),
{
n
,
(
int
)
this
->
d
});
auto
bitset
=
toDevice
<
uint8_t
,
1
>
(
resources_
,
device_
,
nullptr
,
stream
,
{
0
});
static_assert
(
sizeof
(
long
)
==
sizeof
(
Index
::
idx_t
),
"size mismatch"
);
Tensor
<
long
,
1
,
true
>
labels
(
const_cast
<
long
*>
(
xids
),
{
n
});
// Not all vectors may be able to be added (some may contain NaNs etc)
index_
->
classifyAndAddVectors
(
data
,
labels
,
bitset
);
index_
->
classifyAndAddVectors
(
data
,
labels
);
// but keep the ntotal based on the total number of vectors that we attempted
// to add
...
...
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFSQHybrid.cu
浏览文件 @
88cf5e2b
...
...
@@ -309,13 +309,11 @@ GpuIndexIVFSQHybrid::addImpl_(int n,
// Data is already resident on the GPU
Tensor
<
float
,
2
,
true
>
data
(
const_cast
<
float
*>
(
x
),
{
n
,
(
int
)
this
->
d
});
auto
bitset
=
toDevice
<
uint8_t
,
1
>
(
resources_
,
device_
,
nullptr
,
stream
,
{
0
});
static_assert
(
sizeof
(
long
)
==
sizeof
(
Index
::
idx_t
),
"size mismatch"
);
Tensor
<
long
,
1
,
true
>
labels
(
const_cast
<
long
*>
(
xids
),
{
n
});
// Not all vectors may be able to be added (some may contain NaNs etc)
index_
->
classifyAndAddVectors
(
data
,
labels
,
bitset
);
index_
->
classifyAndAddVectors
(
data
,
labels
);
// but keep the ntotal based on the total number of vectors that we attempted
// to add
...
...
core/src/index/thirdparty/faiss/gpu/GpuIndexIVFScalarQuantizer.cu
浏览文件 @
88cf5e2b
...
...
@@ -244,13 +244,11 @@ GpuIndexIVFScalarQuantizer::addImpl_(int n,
// Data is already resident on the GPU
Tensor
<
float
,
2
,
true
>
data
(
const_cast
<
float
*>
(
x
),
{
n
,
(
int
)
this
->
d
});
auto
bitset
=
toDevice
<
uint8_t
,
1
>
(
resources_
,
device_
,
nullptr
,
stream
,
{
0
});
static_assert
(
sizeof
(
long
)
==
sizeof
(
Index
::
idx_t
),
"size mismatch"
);
Tensor
<
long
,
1
,
true
>
labels
(
const_cast
<
long
*>
(
xids
),
{
n
});
// Not all vectors may be able to be added (some may contain NaNs etc)
index_
->
classifyAndAddVectors
(
data
,
labels
,
bitset
);
index_
->
classifyAndAddVectors
(
data
,
labels
);
// but keep the ntotal based on the total number of vectors that we attempted
// to add
...
...
core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cu
浏览文件 @
88cf5e2b
...
...
@@ -157,14 +157,15 @@ IVFFlat::addCodeVectorsFromCpu(int listId,
int
IVFFlat
::
classifyAndAddVectors
(
Tensor
<
float
,
2
,
true
>&
vecs
,
Tensor
<
long
,
1
,
true
>&
indices
,
Tensor
<
uint8_t
,
1
,
true
>&
bitset
)
{
Tensor
<
long
,
1
,
true
>&
indices
)
{
FAISS_ASSERT
(
vecs
.
getSize
(
0
)
==
indices
.
getSize
(
0
));
FAISS_ASSERT
(
vecs
.
getSize
(
1
)
==
dim_
);
auto
&
mem
=
resources_
->
getMemoryManagerCurrentDevice
();
auto
stream
=
resources_
->
getDefaultStreamCurrentDevice
();
DeviceTensor
<
uint8_t
,
1
,
true
>
bitset
(
mem
,
{
0
},
stream
);
// Number of valid vectors that we actually add; we return this
int
numAdded
=
0
;
...
...
core/src/index/thirdparty/faiss/gpu/impl/IVFFlat.cuh
浏览文件 @
88cf5e2b
...
...
@@ -44,8 +44,7 @@ class IVFFlat : public IVFBase {
/// Returns the number of vectors successfully added. Vectors may
/// not be able to be added because they contain NaNs.
int
classifyAndAddVectors
(
Tensor
<
float
,
2
,
true
>&
vecs
,
Tensor
<
long
,
1
,
true
>&
indices
,
Tensor
<
uint8_t
,
1
,
true
>&
bitset
);
Tensor
<
long
,
1
,
true
>&
indices
);
/// Find the approximate k nearest neigbors for `queries` against
...
...
core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cu
浏览文件 @
88cf5e2b
...
...
@@ -110,8 +110,7 @@ IVFPQ::setPrecomputedCodes(bool enable) {
int
IVFPQ
::
classifyAndAddVectors
(
Tensor
<
float
,
2
,
true
>&
vecs
,
Tensor
<
long
,
1
,
true
>&
indices
,
Tensor
<
uint8_t
,
1
,
true
>&
bitset
)
{
Tensor
<
long
,
1
,
true
>&
indices
)
{
FAISS_ASSERT
(
vecs
.
getSize
(
0
)
==
indices
.
getSize
(
0
));
FAISS_ASSERT
(
vecs
.
getSize
(
1
)
==
dim_
);
...
...
@@ -119,6 +118,8 @@ IVFPQ::classifyAndAddVectors(Tensor<float, 2, true>& vecs,
auto
&
coarseCentroids
=
quantizer_
->
getVectorsFloat32Ref
();
auto
&
mem
=
resources_
->
getMemoryManagerCurrentDevice
();
auto
stream
=
resources_
->
getDefaultStreamCurrentDevice
();
DeviceTensor
<
uint8_t
,
1
,
true
>
bitset
(
mem
,
{
0
},
stream
);
// Number of valid vectors that we actually add; we return this
int
numAdded
=
0
;
...
...
core/src/index/thirdparty/faiss/gpu/impl/IVFPQ.cuh
浏览文件 @
88cf5e2b
...
...
@@ -52,8 +52,7 @@ class IVFPQ : public IVFBase {
/// Returns the number of vectors successfully added. Vectors may
/// not be able to be added because they contain NaNs.
int
classifyAndAddVectors
(
Tensor
<
float
,
2
,
true
>&
vecs
,
Tensor
<
long
,
1
,
true
>&
indices
,
Tensor
<
uint8_t
,
1
,
true
>&
bitset
);
Tensor
<
long
,
1
,
true
>&
indices
);
/// Find the approximate k nearest neigbors for `queries` against
/// our database
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录