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
68e08bbe
Commit
68e08bbe
authored
Dec 22, 2014
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix null stream initialization for multi-gpu systems
parent
05d40946
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
37 deletions
+18
-37
cuda_stream.cpp
modules/core/src/cuda_stream.cpp
+18
-37
No files found.
modules/core/src/cuda_stream.cpp
View file @
68e08bbe
...
@@ -330,14 +330,11 @@ namespace cv { namespace cuda
...
@@ -330,14 +330,11 @@ namespace cv { namespace cuda
void
initStreams
();
void
initStreams
();
void
initPools
();
void
initPools
();
std
::
vector
<
Ptr
<
Stream
>
>
streams_
;
Mutex
streams_mtx_
;
Mutex
streams_mtx_
;
volatile
bool
streams_initialized_
;
Mutex
pools_mtx_
;
volatile
bool
pools_initialized_
;
std
::
vector
<
Ptr
<
Stream
>
>
streams_
;
std
::
vector
<
MemoryPool
>
pools_
;
std
::
vector
<
MemoryPool
>
pools_
;
Mutex
pools_mtx_
;
};
};
DefaultDeviceInitializer
::
DefaultDeviceInitializer
()
DefaultDeviceInitializer
::
DefaultDeviceInitializer
()
...
@@ -358,60 +355,44 @@ namespace cv { namespace cuda
...
@@ -358,60 +355,44 @@ namespace cv { namespace cuda
}
}
Stream
&
DefaultDeviceInitializer
::
getNullStream
(
int
deviceId
)
Stream
&
DefaultDeviceInitializer
::
getNullStream
(
int
deviceId
)
{
initStreams
();
CV_DbgAssert
(
deviceId
>=
0
&&
deviceId
<
static_cast
<
int
>
(
streams_
.
size
())
);
return
*
streams_
[
deviceId
];
}
MemoryPool
*
DefaultDeviceInitializer
::
getMemoryPool
(
int
deviceId
)
{
initPools
();
CV_DbgAssert
(
deviceId
>=
0
&&
deviceId
<
static_cast
<
int
>
(
pools_
.
size
())
);
return
&
pools_
[
deviceId
];
}
void
DefaultDeviceInitializer
::
initStreams
()
{
{
AutoLock
lock
(
streams_mtx_
);
AutoLock
lock
(
streams_mtx_
);
if
(
!
streams_initialized_
)
if
(
streams_
.
empty
()
)
{
{
int
deviceCount
=
getCudaEnabledDeviceCount
();
int
deviceCount
=
getCudaEnabledDeviceCount
();
if
(
deviceCount
>
0
)
if
(
deviceCount
>
0
)
{
streams_
.
resize
(
deviceCount
);
streams_
.
resize
(
deviceCount
);
}
for
(
int
i
=
0
;
i
<
deviceCount
;
++
i
)
CV_DbgAssert
(
deviceId
>=
0
&&
deviceId
<
static_cast
<
int
>
(
streams_
.
size
())
);
{
cudaStream_t
stream
=
NULL
;
Ptr
<
Stream
::
Impl
>
impl
=
makePtr
<
Stream
::
Impl
>
(
stream
);
streams_
[
i
]
=
Ptr
<
Stream
>
(
new
Stream
(
impl
));
}
}
streams_initialized_
=
true
;
if
(
streams_
[
deviceId
].
empty
())
{
cudaStream_t
stream
=
NULL
;
Ptr
<
Stream
::
Impl
>
impl
=
makePtr
<
Stream
::
Impl
>
(
stream
);
streams_
[
deviceId
]
=
Ptr
<
Stream
>
(
new
Stream
(
impl
));
}
}
return
*
streams_
[
deviceId
];
}
}
void
DefaultDeviceInitializer
::
initPools
(
)
MemoryPool
*
DefaultDeviceInitializer
::
getMemoryPool
(
int
deviceId
)
{
{
AutoLock
lock
(
pools_mtx_
);
AutoLock
lock
(
pools_mtx_
);
if
(
!
pools_initialized_
)
if
(
pools_
.
empty
()
)
{
{
int
deviceCount
=
getCudaEnabledDeviceCount
();
int
deviceCount
=
getCudaEnabledDeviceCount
();
if
(
deviceCount
>
0
)
if
(
deviceCount
>
0
)
pools_
.
resize
(
deviceCount
);
pools_
.
resize
(
deviceCount
);
pools_initialized_
=
true
;
}
}
CV_DbgAssert
(
deviceId
>=
0
&&
deviceId
<
static_cast
<
int
>
(
pools_
.
size
())
);
return
&
pools_
[
deviceId
];
}
}
DefaultDeviceInitializer
initializer
;
DefaultDeviceInitializer
initializer
;
...
...
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