Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
0c749fd7
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c749fd7
编写于
7月 28, 2014
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2998 from ernest-galbrun:cuda_concurrency
上级
00263dd6
551ab83c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
10 deletion
+45
-10
modules/core/src/cuda_buffer_pool.cpp
modules/core/src/cuda_buffer_pool.cpp
+24
-7
modules/core/src/cuda_stream.cpp
modules/core/src/cuda_stream.cpp
+14
-2
modules/nonfree/src/surf.cuda.cpp
modules/nonfree/src/surf.cuda.cpp
+7
-1
未找到文件。
modules/core/src/cuda_buffer_pool.cpp
浏览文件 @
0c749fd7
...
...
@@ -207,7 +207,6 @@ namespace
MemoryStack
*
MemoryPool
::
getFreeMemStack
()
{
AutoLock
lock
(
mtx_
);
if
(
!
initialized_
)
initilizeImpl
();
...
...
@@ -256,22 +255,31 @@ namespace
namespace
{
Mutex
mtx_
;
bool
memory_pool_manager_initialized
;
class
MemoryPoolManager
{
public:
MemoryPoolManager
();
~
MemoryPoolManager
();
void
Init
();
MemoryPool
*
getPool
(
int
deviceId
);
private:
std
::
vector
<
MemoryPool
>
pools_
;
};
}
manager
;
//MemoryPoolManager ;
MemoryPoolManager
::
MemoryPoolManager
()
{
int
deviceCount
=
getCudaEnabledDeviceCount
();
}
void
MemoryPoolManager
::
Init
()
{
int
deviceCount
=
getCudaEnabledDeviceCount
();
if
(
deviceCount
>
0
)
pools_
.
resize
(
deviceCount
);
}
...
...
@@ -280,7 +288,7 @@ namespace
{
for
(
size_t
i
=
0
;
i
<
pools_
.
size
();
++
i
)
{
cudaSetDevice
(
i
);
cudaSetDevice
(
static_cast
<
int
>
(
i
)
);
pools_
[
i
].
release
();
}
}
...
...
@@ -293,7 +301,14 @@ namespace
MemoryPool
*
memPool
(
int
deviceId
)
{
static
MemoryPoolManager
manager
;
{
AutoLock
lock
(
mtx_
);
if
(
!
memory_pool_manager_initialized
)
{
memory_pool_manager_initialized
=
true
;
manager
.
Init
();
}
}
return
manager
.
getPool
(
deviceId
);
}
}
...
...
@@ -311,8 +326,10 @@ cv::cuda::StackAllocator::StackAllocator(cudaStream_t stream) : stream_(stream),
if
(
enableMemoryPool
)
{
const
int
deviceId
=
getDevice
();
memStack_
=
memPool
(
deviceId
)
->
getFreeMemStack
();
{
AutoLock
lock
(
mtx_
);
memStack_
=
memPool
(
deviceId
)
->
getFreeMemStack
();
}
DeviceInfo
devInfo
(
deviceId
);
alignment_
=
devInfo
.
textureAlignment
();
}
...
...
modules/core/src/cuda_stream.cpp
浏览文件 @
0c749fd7
...
...
@@ -190,10 +190,22 @@ void cv::cuda::Stream::enqueueHostCallback(StreamCallback callback, void* userDa
#endif
}
namespace
{
bool
default_stream_is_initialized
;
Mutex
mtx
;
Ptr
<
Stream
>
default_stream
;
}
Stream
&
cv
::
cuda
::
Stream
::
Null
()
{
static
Stream
s
(
Ptr
<
Impl
>
(
new
Impl
(
0
)));
return
s
;
AutoLock
lock
(
mtx
);
if
(
!
default_stream_is_initialized
)
{
default_stream
=
Ptr
<
Stream
>
(
new
Stream
(
Ptr
<
Impl
>
(
new
Impl
(
0
))));
default_stream_is_initialized
=
true
;
}
return
*
default_stream
;
}
cv
::
cuda
::
Stream
::
operator
bool_type
()
const
...
...
modules/nonfree/src/surf.cuda.cpp
浏览文件 @
0c749fd7
...
...
@@ -93,6 +93,8 @@ using namespace ::cv::cuda::device::surf;
namespace
{
Mutex
mtx
;
int
calcSize
(
int
octave
,
int
layer
)
{
/* Wavelet size at first layer of first octave. */
...
...
@@ -166,7 +168,6 @@ namespace
{
const
int
layer_rows
=
img_rows
>>
octave
;
const
int
layer_cols
=
img_cols
>>
octave
;
loadOctaveConstants
(
octave
,
layer_rows
,
layer_cols
);
icvCalcLayerDetAndTrace_gpu
(
surf_
.
det
,
surf_
.
trace
,
img_rows
,
img_cols
,
octave
,
surf_
.
nOctaveLayers
);
...
...
@@ -354,6 +355,7 @@ void cv::cuda::SURF_CUDA::downloadDescriptors(const GpuMat& descriptorsGPU, std:
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
GpuMat
&
keypoints
)
{
AutoLock
lock
(
mtx
);
if
(
!
img
.
empty
())
{
SURF_CUDA_Invoker
surf
(
*
this
,
img
,
mask
);
...
...
@@ -365,6 +367,7 @@ void cv::cuda::SURF_CUDA::operator()(const GpuMat& img, const GpuMat& mask, GpuM
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
GpuMat
&
keypoints
,
GpuMat
&
descriptors
,
bool
useProvidedKeypoints
)
{
AutoLock
lock
(
mtx
);
if
(
!
img
.
empty
())
{
SURF_CUDA_Invoker
surf
(
*
this
,
img
,
mask
);
...
...
@@ -382,6 +385,7 @@ void cv::cuda::SURF_CUDA::operator()(const GpuMat& img, const GpuMat& mask, GpuM
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
std
::
vector
<
KeyPoint
>&
keypoints
)
{
AutoLock
lock
(
mtx
);
GpuMat
keypointsGPU
;
(
*
this
)(
img
,
mask
,
keypointsGPU
);
...
...
@@ -392,6 +396,7 @@ void cv::cuda::SURF_CUDA::operator()(const GpuMat& img, const GpuMat& mask, std:
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
std
::
vector
<
KeyPoint
>&
keypoints
,
GpuMat
&
descriptors
,
bool
useProvidedKeypoints
)
{
AutoLock
lock
(
mtx
);
GpuMat
keypointsGPU
;
if
(
useProvidedKeypoints
)
...
...
@@ -405,6 +410,7 @@ void cv::cuda::SURF_CUDA::operator()(const GpuMat& img, const GpuMat& mask, std:
void
cv
::
cuda
::
SURF_CUDA
::
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
std
::
vector
<
KeyPoint
>&
keypoints
,
std
::
vector
<
float
>&
descriptors
,
bool
useProvidedKeypoints
)
{
AutoLock
lock
(
mtx
);
GpuMat
descriptorsGPU
;
(
*
this
)(
img
,
mask
,
keypoints
,
descriptorsGPU
,
useProvidedKeypoints
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录