Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PointCloud
Flann
提交
5db67455
F
Flann
项目概览
PointCloud
/
Flann
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flann
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5db67455
编写于
12月 18, 2011
作者:
M
Marius Muja
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updating sources for the flann::Matrix changes
上级
1011d6f9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
27 deletion
+27
-27
src/cpp/flann/algorithms/kdtree_cuda_3d_index.cu
src/cpp/flann/algorithms/kdtree_cuda_3d_index.cu
+17
-17
src/cpp/flann/algorithms/kdtree_cuda_3d_index.h
src/cpp/flann/algorithms/kdtree_cuda_3d_index.h
+4
-4
src/cpp/flann/mpi/queries.h
src/cpp/flann/mpi/queries.h
+2
-2
src/cpp/flann/mpi/server.h
src/cpp/flann/mpi/server.h
+3
-3
src/cpp/flann/util/matrix.h
src/cpp/flann/util/matrix.h
+1
-1
未找到文件。
src/cpp/flann/algorithms/kdtree_cuda_3d_index.cu
浏览文件 @
5db67455
...
...
@@ -298,7 +298,7 @@ void KDTreeCuda3dIndex<Distance>::knnSearchGpu(const Matrix<ElementType>& querie
if
(
!
matrices_on_gpu
)
{
thrust
::
device_vector
<
float
>
queriesDev
(
queries
.
stride
*
queries
.
rows
,
0
);
thrust
::
copy
(
queries
.
data
,
queries
.
data
+
queries
.
stride
*
queries
.
rows
,
queriesDev
.
begin
()
);
thrust
::
copy
(
queries
.
ptr
(),
queries
.
ptr
()
+
queries
.
stride
*
queries
.
rows
,
queriesDev
.
begin
()
);
thrust
::
device_vector
<
float
>
distsDev
(
queries
.
rows
*
dists
.
stride
);
thrust
::
device_vector
<
int
>
indicesDev
(
queries
.
rows
*
dists
.
stride
);
...
...
@@ -359,14 +359,14 @@ void KDTreeCuda3dIndex<Distance>::knnSearchGpu(const Matrix<ElementType>& querie
);
}
}
thrust
::
copy
(
distsDev
.
begin
(),
distsDev
.
end
(),
dists
.
data
);
thrust
::
copy
(
distsDev
.
begin
(),
distsDev
.
end
(),
dists
.
ptr
()
);
thrust
::
transform
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indicesDev
.
begin
(),
map_indices
(
thrust
::
raw_pointer_cast
(
&
((
*
gpu_helper_
->
gpu_vind_
))[
0
])
));
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
data
);
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
ptr
()
);
}
else
{
thrust
::
device_ptr
<
float
>
qd
=
thrust
::
device_pointer_cast
(
queries
.
data
);
thrust
::
device_ptr
<
float
>
dd
=
thrust
::
device_pointer_cast
(
dists
.
data
);
thrust
::
device_ptr
<
int
>
id
=
thrust
::
device_pointer_cast
(
indices
.
data
);
thrust
::
device_ptr
<
float
>
qd
=
thrust
::
device_pointer_cast
(
queries
.
ptr
()
);
thrust
::
device_ptr
<
float
>
dd
=
thrust
::
device_pointer_cast
(
dists
.
ptr
()
);
thrust
::
device_ptr
<
int
>
id
=
thrust
::
device_pointer_cast
(
indices
.
ptr
()
);
...
...
@@ -444,7 +444,7 @@ int KDTreeCuda3dIndex<Distance >::radiusSearchGpu(const Matrix<ElementType>& que
if
(
dists
.
size
()
<
queries
.
rows
)
dists
.
resize
(
queries
.
rows
);
thrust
::
device_vector
<
float
>
queriesDev
(
queries
.
stride
*
queries
.
rows
,
0
);
thrust
::
copy
(
queries
.
data
,
queries
.
data
+
queries
.
stride
*
queries
.
rows
,
queriesDev
.
begin
()
);
thrust
::
copy
(
queries
.
ptr
(),
queries
.
ptr
()
+
queries
.
stride
*
queries
.
rows
,
queriesDev
.
begin
()
);
thrust
::
device_vector
<
int
>
countsDev
(
queries
.
rows
);
typename
GpuDistance
<
Distance
>::
type
distance
;
...
...
@@ -583,7 +583,7 @@ int KDTreeCuda3dIndex< Distance >::radiusSearchGpu(const Matrix<ElementType>& qu
if
(
!
matrices_on_gpu
)
{
thrust
::
device_vector
<
float
>
queriesDev
(
queries
.
stride
*
queries
.
rows
,
0
);
thrust
::
copy
(
queries
.
data
,
queries
.
data
+
queries
.
stride
*
queries
.
rows
,
queriesDev
.
begin
()
);
thrust
::
copy
(
queries
.
ptr
(),
queries
.
ptr
()
+
queries
.
stride
*
queries
.
rows
,
queriesDev
.
begin
()
);
typename
GpuDistance
<
Distance
>::
type
distance
;
int
threadsPerBlock
=
128
;
int
blocksPerGrid
=
(
queries
.
rows
+
threadsPerBlock
-
1
)
/
threadsPerBlock
;
...
...
@@ -603,7 +603,7 @@ int KDTreeCuda3dIndex< Distance >::radiusSearchGpu(const Matrix<ElementType>& qu
queries
.
rows
,
flann
::
cuda
::
CountingRadiusResultSet
<
float
>
(
radius
,
-
1
),
distance
);
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
data
);
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
ptr
()
);
return
thrust
::
reduce
(
indicesDev
.
begin
(),
indicesDev
.
end
()
);
}
...
...
@@ -641,17 +641,17 @@ int KDTreeCuda3dIndex< Distance >::radiusSearchGpu(const Matrix<ElementType>& qu
queries
.
rows
,
flann
::
cuda
::
KnnRadiusResultSet
<
float
,
false
>
(
max_neighbors
,
sorted
,
epsError
,
radius
),
distance
);
}
thrust
::
copy
(
distsDev
.
begin
(),
distsDev
.
end
(),
dists
.
data
);
thrust
::
copy
(
distsDev
.
begin
(),
distsDev
.
end
(),
dists
.
ptr
()
);
thrust
::
transform
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indicesDev
.
begin
(),
map_indices
(
thrust
::
raw_pointer_cast
(
&
((
*
gpu_helper_
->
gpu_vind_
))[
0
])
));
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
data
);
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
ptr
()
);
return
thrust
::
count_if
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
isNotMinusOne
()
);
}
else
{
thrust
::
device_ptr
<
float
>
qd
=
thrust
::
device_pointer_cast
(
queries
.
data
);
thrust
::
device_ptr
<
float
>
dd
=
thrust
::
device_pointer_cast
(
dists
.
data
);
thrust
::
device_ptr
<
int
>
id
=
thrust
::
device_pointer_cast
(
indices
.
data
);
thrust
::
device_ptr
<
float
>
qd
=
thrust
::
device_pointer_cast
(
queries
.
ptr
()
);
thrust
::
device_ptr
<
float
>
dd
=
thrust
::
device_pointer_cast
(
dists
.
ptr
()
);
thrust
::
device_ptr
<
int
>
id
=
thrust
::
device_pointer_cast
(
indices
.
ptr
()
);
typename
GpuDistance
<
Distance
>::
type
distance
;
int
threadsPerBlock
=
128
;
int
blocksPerGrid
=
(
queries
.
rows
+
threadsPerBlock
-
1
)
/
threadsPerBlock
;
...
...
@@ -672,7 +672,7 @@ int KDTreeCuda3dIndex< Distance >::radiusSearchGpu(const Matrix<ElementType>& qu
queries
.
rows
,
flann
::
cuda
::
CountingRadiusResultSet
<
float
>
(
radius
,
-
1
),
distance
);
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
data
);
thrust
::
copy
(
indicesDev
.
begin
(),
indicesDev
.
end
(),
indices
.
ptr
()
);
return
thrust
::
reduce
(
indicesDev
.
begin
(),
indicesDev
.
end
()
);
}
// bool sorted = get_param(params,"sorted",true);
...
...
@@ -725,7 +725,7 @@ void KDTreeCuda3dIndex<Distance>::uploadTreeToGpu()
thrust
::
device_vector
<
float4
>
tmp
(
size_
);
if
(
get_param
(
index_params_
,
"input_is_gpu_float4"
,
false
)
)
{
assert
(
dataset_
.
cols
==
3
&&
dataset_
.
stride
==
4
);
thrust
::
copy
(
thrust
::
device_pointer_cast
((
float4
*
)
dataset_
.
data
),
thrust
::
device_pointer_cast
((
float4
*
)(
dataset_
.
data
))
+
size_
,
tmp
.
begin
());
thrust
::
copy
(
thrust
::
device_pointer_cast
((
float4
*
)
dataset_
.
ptr
()),
thrust
::
device_pointer_cast
((
float4
*
)(
dataset_
.
ptr
()
))
+
size_
,
tmp
.
begin
());
}
else
{
...
...
@@ -743,7 +743,7 @@ void KDTreeCuda3dIndex<Distance>::uploadTreeToGpu()
data_
[
i
][
j
]
=
0
;
}
}
thrust
::
copy
((
float4
*
)
data_
.
data
,(
float4
*
)(
data_
.
data
)
+
size_
,
tmp
.
begin
());
thrust
::
copy
((
float4
*
)
data_
.
ptr
(),(
float4
*
)(
data_
.
ptr
()
)
+
size_
,
tmp
.
begin
());
}
CudaKdTreeBuilder
builder
(
tmp
,
leaf_max_size_
);
...
...
src/cpp/flann/algorithms/kdtree_cuda_3d_index.h
浏览文件 @
5db67455
...
...
@@ -109,7 +109,7 @@ public:
*/
~
KDTreeCuda3dIndex
()
{
delete
[]
data_
.
data
;
delete
[]
data_
.
ptr
()
;
clearGpuBuffers
();
}
...
...
@@ -124,7 +124,7 @@ public:
// tree_.reserve(log2((double)size_/leaf_max_size_));
// divideTree(0, size_, root_bbox_,-1 ); // construct the tree
delete
[]
data_
.
data
;
delete
[]
data_
.
ptr
()
;
uploadTreeToGpu
();
}
...
...
@@ -260,8 +260,8 @@ public:
dists
[
i
][
j
]
=
dist
[
i
][
j
];
}
}
delete
[]
ind
.
data
;
delete
[]
dist
.
data
;
delete
[]
ind
.
ptr
()
;
delete
[]
dist
.
ptr
()
;
return
knn
*
queries
.
rows
;
// hack...
}
...
...
src/cpp/flann/mpi/queries.h
浏览文件 @
5db67455
...
...
@@ -43,9 +43,9 @@ void serialize(Archive & ar, flann::Matrix<T> & matrix, const unsigned int versi
{
ar
&
matrix
.
rows
&
matrix
.
cols
&
matrix
.
stride
;
if
(
Archive
::
is_loading
::
value
)
{
matrix
.
data
=
new
T
[
matrix
.
rows
*
matrix
.
cols
]
;
matrix
=
flann
::
Matrix
<
T
>
(
new
T
[
matrix
.
rows
*
matrix
.
cols
],
matrix
.
rows
,
matrix
.
cols
,
matrix
.
stride
)
;
}
ar
&
boost
::
serialization
::
make_array
(
matrix
.
data
,
matrix
.
rows
*
matrix
.
cols
);
ar
&
boost
::
serialization
::
make_array
(
matrix
.
ptr
()
,
matrix
.
rows
*
matrix
.
cols
);
}
}
...
...
src/cpp/flann/mpi/server.h
浏览文件 @
5db67455
...
...
@@ -84,10 +84,10 @@ class Server
write_object
(
*
sock
,
resp
);
}
delete
[]
req
.
queries
.
data
;
delete
[]
req
.
queries
.
ptr
()
;
if
(
world
.
rank
()
==
0
)
{
delete
[]
resp
.
indices
.
data
;
delete
[]
resp
.
dists
.
data
;
delete
[]
resp
.
indices
.
ptr
()
;
delete
[]
resp
.
dists
.
ptr
()
;
}
}
...
...
src/cpp/flann/util/matrix.h
浏览文件 @
5db67455
...
...
@@ -107,7 +107,7 @@ public:
fprintf
(
stderr
,
"The flann::Matrix<T>::free() method is deprecated "
"and it does not do any memory deallocation any more. You are"
"responsible for deallocating the matrix memory (by doing"
"'delete[] matrix.
data
' for example)"
);
"'delete[] matrix.
ptr()
' for example)"
);
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录