Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8abd1634
Commit
8abd1634
authored
Mar 21, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8404 from khnaba:stream-with-custom-allocator
parents
e5dbd2c3
29680100
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
cuda.hpp
modules/core/include/opencv2/core/cuda.hpp
+3
-0
cuda_stream.cpp
modules/core/src/cuda_stream.cpp
+22
-5
No files found.
modules/core/include/opencv2/core/cuda.hpp
View file @
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
View file @
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment