Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
8abd1634
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,发现更多精彩内容 >>
提交
8abd1634
编写于
3月 21, 2017
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8404 from khnaba:stream-with-custom-allocator
上级
e5dbd2c3
29680100
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
5 deletion
+25
-5
modules/core/include/opencv2/core/cuda.hpp
modules/core/include/opencv2/core/cuda.hpp
+3
-0
modules/core/src/cuda_stream.cpp
modules/core/src/cuda_stream.cpp
+22
-5
未找到文件。
modules/core/include/opencv2/core/cuda.hpp
浏览文件 @
8abd1634
...
...
@@ -507,6 +507,9 @@ public:
//! creates a new asynchronous stream
Stream
();
//! creates a new asynchronous stream with custom allocator
Stream
(
const
Ptr
<
GpuMat
::
Allocator
>&
allocator
);
/** @brief Returns true if the current stream queue is finished. Otherwise, it returns false.
*/
bool
queryIfComplete
()
const
;
...
...
modules/core/src/cuda_stream.cpp
浏览文件 @
8abd1634
...
...
@@ -282,9 +282,10 @@ public:
cudaStream_t
stream
;
bool
ownStream
;
Ptr
<
StackAllocator
>
stackA
llocator
;
Ptr
<
GpuMat
::
Allocator
>
a
llocator
;
Impl
();
Impl
(
const
Ptr
<
GpuMat
::
Allocator
>&
allocator
);
explicit
Impl
(
cudaStream_t
stream
);
~
Impl
();
...
...
@@ -295,17 +296,23 @@ cv::cuda::Stream::Impl::Impl() : stream(0), ownStream(false)
cudaSafeCall
(
cudaStreamCreate
(
&
stream
)
);
ownStream
=
true
;
stackAllocator
=
makePtr
<
StackAllocator
>
(
stream
);
allocator
=
makePtr
<
StackAllocator
>
(
stream
);
}
cv
::
cuda
::
Stream
::
Impl
::
Impl
(
const
Ptr
<
GpuMat
::
Allocator
>&
allocator
)
:
stream
(
0
),
ownStream
(
false
),
allocator
(
allocator
)
{
cudaSafeCall
(
cudaStreamCreate
(
&
stream
)
);
ownStream
=
true
;
}
cv
::
cuda
::
Stream
::
Impl
::
Impl
(
cudaStream_t
stream_
)
:
stream
(
stream_
),
ownStream
(
false
)
{
stackA
llocator
=
makePtr
<
StackAllocator
>
(
stream
);
a
llocator
=
makePtr
<
StackAllocator
>
(
stream
);
}
cv
::
cuda
::
Stream
::
Impl
::~
Impl
()
{
stackA
llocator
.
release
();
a
llocator
.
release
();
if
(
stream
&&
ownStream
)
{
...
...
@@ -417,6 +424,16 @@ cv::cuda::Stream::Stream()
#endif
}
cv
::
cuda
::
Stream
::
Stream
(
const
Ptr
<
GpuMat
::
Allocator
>&
allocator
)
{
#ifndef HAVE_CUDA
(
void
)
allocator
;
throw_no_cuda
();
#else
impl_
=
makePtr
<
Impl
>
(
allocator
);
#endif
}
bool
cv
::
cuda
::
Stream
::
queryIfComplete
()
const
{
#ifndef HAVE_CUDA
...
...
@@ -675,7 +692,7 @@ cv::cuda::BufferPool::BufferPool(Stream& stream)
throw_no_cuda
();
}
#else
cv
::
cuda
::
BufferPool
::
BufferPool
(
Stream
&
stream
)
:
allocator_
(
stream
.
impl_
->
stackA
llocator
)
cv
::
cuda
::
BufferPool
::
BufferPool
(
Stream
&
stream
)
:
allocator_
(
stream
.
impl_
->
a
llocator
)
{
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录