refactoring of GPU module
authorAlexey Spizhevoy <no@email>
Tue, 15 Feb 2011 13:25:24 +0000 (13:25 +0000)
committerAlexey Spizhevoy <no@email>
Tue, 15 Feb 2011 13:25:24 +0000 (13:25 +0000)
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/src/multi_gpu_manager.cpp [moved from modules/gpu/src/multi_gpu_mgr.cpp with 81% similarity]
samples/gpu/multi.cpp
samples/gpu/stereo_multi.cpp

index a112755..029c029 100644 (file)
@@ -76,6 +76,8 @@ namespace cv
             NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13\r
         };\r
 \r
+        // Gives information about what GPU archs this OpenCV GPU module was \r
+        // compiled for\r
         class CV_EXPORTS TargetArchs\r
         {\r
         public:\r
@@ -91,6 +93,7 @@ namespace cv
             TargetArchs();\r
         };\r
 \r
+        // Gives information about the given GPU\r
         class CV_EXPORTS DeviceInfo\r
         {\r
         public:\r
@@ -132,11 +135,11 @@ namespace cv
         /////////////////////////// Multi GPU Manager //////////////////////////////\r
 \r
         // Provides functionality for working with many GPUs\r
-        class CV_EXPORTS MultiGpuMgr\r
+        class CV_EXPORTS MultiGpuManager\r
         {\r
         public:\r
-            MultiGpuMgr();\r
-            ~MultiGpuMgr();\r
+            MultiGpuManager();\r
+            ~MultiGpuManager();\r
 \r
             // Must be called before any other GPU calls\r
             void init();\r
@@ -144,14 +147,14 @@ namespace cv
             // Makes the given GPU active\r
             void gpuOn(int gpu_id);\r
 \r
-            // Finishes the piece of work with the current GPU\r
+            // Finishes the piece of work on the current GPU\r
             void gpuOff();\r
 \r
             static const int BAD_GPU_ID = -1;\r
 \r
         private:\r
-            void operator=(const MultiGpuMgr&);\r
-            MultiGpuMgr(const MultiGpuMgr&);\r
+            void operator=(const MultiGpuManager&);\r
+            MultiGpuManager(const MultiGpuManager&);\r
 \r
             class Impl;\r
             Ptr<Impl> impl_;\r
similarity index 81%
rename from modules/gpu/src/multi_gpu_mgr.cpp
rename to modules/gpu/src/multi_gpu_manager.cpp
index b251366..68bab7e 100644 (file)
 
 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 MultiGpuMgr::Impl
+class MultiGpuManager::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, "MultiGpuMgr::gpuOn: GPU ID is out of range");
+            CV_Error(CV_StsBadArg, "MultiGpuManager::gpuOn: GPU ID is out of range");
         cuSafeCall(cuCtxPushCurrent(contexts_[gpu_id]));
     }
 
@@ -103,7 +103,7 @@ private:
 };
 
 
-MultiGpuMgr::Impl::Impl(): num_devices_(0)
+MultiGpuManager::Impl::Impl(): num_devices_(0)
 {
     num_devices_ = getCudaEnabledDeviceCount();
     contexts_.resize(num_devices_);
@@ -121,28 +121,28 @@ MultiGpuMgr::Impl::Impl(): num_devices_(0)
 }
 
 
-MultiGpuMgr::MultiGpuMgr() {}
-MultiGpuMgr::~MultiGpuMgr() {}
+MultiGpuManager::MultiGpuManager() {}
+MultiGpuManager::~MultiGpuManager() {}
 
 
-void MultiGpuMgr::init()
+void MultiGpuManager::init()
 {
     impl_ = Ptr<Impl>(new Impl());
 }
 
 
-void MultiGpuMgr::gpuOn(int gpu_id)
+void MultiGpuManager::gpuOn(int gpu_id)
 {
     if (impl_.empty())
-        CV_Error(CV_StsNullPtr, "MultiGpuMgr::gpuOn: must be initialized before any calls");
+        CV_Error(CV_StsNullPtr, "MultiGpuManager::gpuOn: must be initialized before any calls");
     impl_->gpuOn(gpu_id);
 }
 
 
-void MultiGpuMgr::gpuOff()
+void MultiGpuManager::gpuOff()
 {
     if (impl_.empty())
-        CV_Error(CV_StsNullPtr, "MultiGpuMgr::gpuOff: must be initialized before any calls");
+        CV_Error(CV_StsNullPtr, "MultiGpuManager::gpuOff: must be initialized before any calls");
     impl_->gpuOff();
 }
 
index 447816d..e02a490 100644 (file)
@@ -36,7 +36,7 @@ using namespace cv::gpu;
 \r
 struct Worker { void operator()(int device_id) const; };\r
 \r
-MultiGpuMgr multi_gpu_mgr;\r
+MultiGpuManager multi_gpu_mgr;\r
 \r
 int main()\r
 {\r
index 6e6cfe5..54dcf3b 100644 (file)
@@ -38,7 +38,7 @@ using namespace cv::gpu;
 \r
 struct Worker { void operator()(int device_id) const; };\r
 \r
-MultiGpuMgr multi_gpu_mgr;\r
+MultiGpuManager multi_gpu_mgr;\r
 \r
 // GPUs data\r
 GpuMat d_left[2];\r