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
04709a27
Commit
04709a27
authored
Feb 15, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring of GPU module
parent
6b6a63ba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
24 deletions
+27
-24
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+9
-6
multi_gpu_manager.cpp
modules/gpu/src/multi_gpu_manager.cpp
+16
-16
multi.cpp
samples/gpu/multi.cpp
+1
-1
stereo_multi.cpp
samples/gpu/stereo_multi.cpp
+1
-1
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
04709a27
...
...
@@ -76,6 +76,8 @@ namespace cv
NATIVE_DOUBLE
=
FEATURE_SET_COMPUTE_13
};
// Gives information about what GPU archs this OpenCV GPU module was
// compiled for
class
CV_EXPORTS
TargetArchs
{
public
:
...
...
@@ -91,6 +93,7 @@ namespace cv
TargetArchs
();
};
// Gives information about the given GPU
class
CV_EXPORTS
DeviceInfo
{
public
:
...
...
@@ -132,11 +135,11 @@ namespace cv
/////////////////////////// Multi GPU Manager //////////////////////////////
// Provides functionality for working with many GPUs
class
CV_EXPORTS
MultiGpuM
g
r
class
CV_EXPORTS
MultiGpuM
anage
r
{
public
:
MultiGpuM
g
r
();
~
MultiGpuM
g
r
();
MultiGpuM
anage
r
();
~
MultiGpuM
anage
r
();
// Must be called before any other GPU calls
void
init
();
...
...
@@ -144,14 +147,14 @@ namespace cv
// Makes the given GPU active
void
gpuOn
(
int
gpu_id
);
// Finishes the piece of work
with
the current GPU
// Finishes the piece of work
on
the current GPU
void
gpuOff
();
static
const
int
BAD_GPU_ID
=
-
1
;
private
:
void
operator
=
(
const
MultiGpuM
g
r
&
);
MultiGpuM
gr
(
const
MultiGpuMg
r
&
);
void
operator
=
(
const
MultiGpuM
anage
r
&
);
MultiGpuM
anager
(
const
MultiGpuManage
r
&
);
class
Impl
;
Ptr
<
Impl
>
impl_
;
...
...
modules/gpu/src/multi_gpu_m
g
r.cpp
→
modules/gpu/src/multi_gpu_m
anage
r.cpp
View file @
04709a27
...
...
@@ -46,17 +46,17 @@
namespace
cv
{
namespace
gpu
{
class
MultiGpuMgr
::
Impl
{};
MultiGpuMgr
::
MultiGpuMgr
()
{
throw_nogpu
();
}
void
MultiGpuMgr
::
init
()
{
throw_nogpu
();
}
void
MultiGpuMgr
::
gpuOn
(
int
)
{
throw_nogpu
();
}
void
MultiGpuMgr
::
gpuOff
()
{
throw_nogpu
();
}
class
MultiGpuManager
::
Impl
{};
MultiGpuManager
::
MultiGpuManager
()
{
throw_nogpu
();
}
MultiGpuManager
::~
MultiGpuManager
()
{
throw_nogpu
();
}
void
MultiGpuManager
::
init
()
{
throw_nogpu
();
}
void
MultiGpuManager
::
gpuOn
(
int
)
{
throw_nogpu
();
}
void
MultiGpuManager
::
gpuOff
()
{
throw_nogpu
();
}
}}
#else
#include <stack>
#include <vector>
#include <cuda.h>
...
...
@@ -67,7 +67,7 @@ using namespace std;
namespace
cv
{
namespace
gpu
{
class
MultiGpuM
g
r
::
Impl
class
MultiGpuM
anage
r
::
Impl
{
public
:
Impl
();
...
...
@@ -81,7 +81,7 @@ public:
void
gpuOn
(
int
gpu_id
)
{
if
(
gpu_id
<
0
||
gpu_id
>=
num_devices_
)
CV_Error
(
CV_StsBadArg
,
"MultiGpuM
g
r::gpuOn: GPU ID is out of range"
);
CV_Error
(
CV_StsBadArg
,
"MultiGpuM
anage
r::gpuOn: GPU ID is out of range"
);
cuSafeCall
(
cuCtxPushCurrent
(
contexts_
[
gpu_id
]));
}
...
...
@@ -103,7 +103,7 @@ private:
};
MultiGpuM
g
r
::
Impl
::
Impl
()
:
num_devices_
(
0
)
MultiGpuM
anage
r
::
Impl
::
Impl
()
:
num_devices_
(
0
)
{
num_devices_
=
getCudaEnabledDeviceCount
();
contexts_
.
resize
(
num_devices_
);
...
...
@@ -121,28 +121,28 @@ MultiGpuMgr::Impl::Impl(): num_devices_(0)
}
MultiGpuM
gr
::
MultiGpuMg
r
()
{}
MultiGpuM
gr
::~
MultiGpuMg
r
()
{}
MultiGpuM
anager
::
MultiGpuManage
r
()
{}
MultiGpuM
anager
::~
MultiGpuManage
r
()
{}
void
MultiGpuM
g
r
::
init
()
void
MultiGpuM
anage
r
::
init
()
{
impl_
=
Ptr
<
Impl
>
(
new
Impl
());
}
void
MultiGpuM
g
r
::
gpuOn
(
int
gpu_id
)
void
MultiGpuM
anage
r
::
gpuOn
(
int
gpu_id
)
{
if
(
impl_
.
empty
())
CV_Error
(
CV_StsNullPtr
,
"MultiGpuM
g
r::gpuOn: must be initialized before any calls"
);
CV_Error
(
CV_StsNullPtr
,
"MultiGpuM
anage
r::gpuOn: must be initialized before any calls"
);
impl_
->
gpuOn
(
gpu_id
);
}
void
MultiGpuM
g
r
::
gpuOff
()
void
MultiGpuM
anage
r
::
gpuOff
()
{
if
(
impl_
.
empty
())
CV_Error
(
CV_StsNullPtr
,
"MultiGpuM
g
r::gpuOff: must be initialized before any calls"
);
CV_Error
(
CV_StsNullPtr
,
"MultiGpuM
anage
r::gpuOff: must be initialized before any calls"
);
impl_
->
gpuOff
();
}
...
...
samples/gpu/multi.cpp
View file @
04709a27
...
...
@@ -36,7 +36,7 @@ using namespace cv::gpu;
struct
Worker
{
void
operator
()(
int
device_id
)
const
;
};
MultiGpuM
g
r
multi_gpu_mgr
;
MultiGpuM
anage
r
multi_gpu_mgr
;
int
main
()
{
...
...
samples/gpu/stereo_multi.cpp
View file @
04709a27
...
...
@@ -38,7 +38,7 @@ using namespace cv::gpu;
struct
Worker
{
void
operator
()(
int
device_id
)
const
;
};
MultiGpuM
g
r
multi_gpu_mgr
;
MultiGpuM
anage
r
multi_gpu_mgr
;
// GPUs data
GpuMat
d_left
[
2
];
...
...
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