2011-02-23 04:43:26 +08:00
Initalization and Information
=============================
2011-08-30 16:27:23 +08:00
2011-02-23 04:43:26 +08:00
.. highlight :: cpp
2011-08-30 16:27:23 +08:00
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::getCudaEnabledDeviceCount
2013-01-13 20:27:11 +08:00
------------------------------
2011-08-30 16:27:23 +08:00
Returns the number of installed CUDA-enabled devices.
2011-02-23 04:43:26 +08:00
2011-08-14 00:49:40 +08:00
.. ocv:function :: int gpu::getCudaEnabledDeviceCount()
2011-03-23 18:56:20 +08:00
2011-08-30 16:27:23 +08:00
Use this function before any other GPU functions calls. If OpenCV is compiled without GPU support, this function returns 0.
2011-03-23 18:56:20 +08:00
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::setDevice
2013-01-13 20:27:11 +08:00
--------------
2011-08-30 16:27:23 +08:00
Sets a device and initializes it for the current thread.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::setDevice(int device)
2011-03-23 18:56:20 +08:00
2011-03-29 07:16:20 +08:00
:param device: System index of a GPU device starting with 0.
2011-03-23 18:56:20 +08:00
2011-08-30 16:27:23 +08:00
If the call of this function is omitted, a default device is initialized at the fist GPU usage.
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::getDevice
2013-01-13 20:27:11 +08:00
--------------
2011-08-30 16:27:23 +08:00
Returns the current device index set by :ocv:func: `gpu::setDevice` or initialized by default.
2011-08-14 00:49:40 +08:00
.. ocv:function :: int gpu::getDevice()
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
gpu::resetDevice
2013-01-13 20:27:11 +08:00
----------------
2011-08-30 16:27:23 +08:00
Explicitly destroys and cleans up all resources associated with the current device in the current process.
.. ocv:function :: void gpu::resetDevice()
Any subsequent API call to this device will reinitialize the device.
gpu::FeatureSet
2011-02-23 04:43:26 +08:00
---------------
2013-02-19 18:19:59 +08:00
Enumeration providing GPU computing features.
2011-02-23 04:43:26 +08:00
2013-02-19 18:19:59 +08:00
.. ocv:enum :: gpu::FeatureSet
.. ocv:emember :: FEATURE_SET_COMPUTE_10
.. ocv:emember :: FEATURE_SET_COMPUTE_11
.. ocv:emember :: FEATURE_SET_COMPUTE_12
.. ocv:emember :: FEATURE_SET_COMPUTE_13
.. ocv:emember :: FEATURE_SET_COMPUTE_20
.. ocv:emember :: FEATURE_SET_COMPUTE_21
.. ocv:emember :: GLOBAL_ATOMICS
.. ocv:emember :: SHARED_ATOMICS
.. ocv:emember :: NATIVE_DOUBLE
2011-03-01 05:26:43 +08:00
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
gpu::TargetArchs
----------------
.. ocv:class :: gpu::TargetArchs
Class providing a set of static methods to check what NVIDIA* card architecture the GPU module was built for.
The following method checks whether the module was built with the support of the given feature:
2012-05-30 19:13:07 +08:00
.. ocv:function :: static bool gpu::TargetArchs::builtWith( FeatureSet feature_set )
2011-08-30 16:27:23 +08:00
2013-02-19 18:19:59 +08:00
:param feature_set: Features to be checked. See :ocv:enum:`gpu::FeatureSet`.
2011-08-30 16:27:23 +08:00
There is a set of methods to check whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
.. ocv:function :: static bool gpu::TargetArchs::has(int major, int minor)
.. ocv:function :: static bool gpu::TargetArchs::hasPtx(int major, int minor)
.. ocv:function :: static bool gpu::TargetArchs::hasBin(int major, int minor)
.. ocv:function :: static bool gpu::TargetArchs::hasEqualOrLessPtx(int major, int minor)
.. ocv:function :: static bool gpu::TargetArchs::hasEqualOrGreater(int major, int minor)
.. ocv:function :: static bool gpu::TargetArchs::hasEqualOrGreaterPtx(int major, int minor)
.. ocv:function :: static bool gpu::TargetArchs::hasEqualOrGreaterBin(int major, int minor)
:param major: Major compute capability version.
:param minor: Minor compute capability version.
According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute capability can always be compiled to binary code of greater or equal compute capability".
2011-02-23 04:43:26 +08:00
gpu::DeviceInfo
---------------
2011-06-16 20:48:23 +08:00
.. ocv:class :: gpu::DeviceInfo
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
Class providing functionality for querying the specified GPU properties. ::
2011-02-23 04:43:26 +08:00
2011-03-29 07:16:20 +08:00
class CV_EXPORTS DeviceInfo
2011-02-23 04:43:26 +08:00
{
public:
DeviceInfo();
DeviceInfo(int device_id);
2011-02-26 19:05:10 +08:00
2013-03-23 00:51:45 +08:00
String name() const;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int majorVersion() const;
int minorVersion() const;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int multiProcessorCount() const;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
size_t freeMemory() const;
size_t totalMemory() const;
2011-02-26 19:05:10 +08:00
2011-08-30 16:27:23 +08:00
bool supports(FeatureSet feature) const;
2011-02-23 04:43:26 +08:00
bool isCompatible() const;
2011-08-30 16:27:23 +08:00
int deviceID() const;
2011-02-23 04:43:26 +08:00
};
2011-03-01 05:26:43 +08:00
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::DeviceInfo
2013-01-13 20:27:11 +08:00
---------------------------
2011-08-30 16:27:23 +08:00
The constructors.
2011-06-16 20:48:23 +08:00
.. ocv:function :: gpu::DeviceInfo::DeviceInfo()
2011-02-23 04:43:26 +08:00
2011-06-16 20:48:23 +08:00
.. ocv:function :: gpu::DeviceInfo::DeviceInfo(int device_id)
2011-02-23 04:43:26 +08:00
2011-03-29 07:16:20 +08:00
:param device_id: System index of the GPU device starting with 0.
2011-03-23 18:56:20 +08:00
2011-08-30 16:27:23 +08:00
Constructs the `` DeviceInfo `` object for the specified device. If `` device_id `` parameter is missed, it constructs an object for the current device.
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::name
2013-01-13 20:27:11 +08:00
---------------------
2011-08-30 16:27:23 +08:00
Returns the device name.
2013-03-23 00:51:45 +08:00
.. ocv:function :: String gpu::DeviceInfo::name() const
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::majorVersion
2013-01-13 20:27:11 +08:00
-----------------------------
2011-08-30 16:27:23 +08:00
Returns the major compute capability version.
2011-06-16 20:48:23 +08:00
.. ocv:function :: int gpu::DeviceInfo::majorVersion()
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::minorVersion
2013-01-13 20:27:11 +08:00
-----------------------------
2011-08-30 16:27:23 +08:00
Returns the minor compute capability version.
2011-06-16 20:48:23 +08:00
.. ocv:function :: int gpu::DeviceInfo::minorVersion()
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::multiProcessorCount
2013-01-13 20:27:11 +08:00
------------------------------------
2011-08-30 16:27:23 +08:00
Returns the number of streaming multiprocessors.
2011-06-16 20:48:23 +08:00
.. ocv:function :: int gpu::DeviceInfo::multiProcessorCount()
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::freeMemory
2013-01-13 20:27:11 +08:00
---------------------------
2011-08-30 16:27:23 +08:00
Returns the amount of free memory in bytes.
2011-06-16 20:48:23 +08:00
.. ocv:function :: size_t gpu::DeviceInfo::freeMemory()
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::totalMemory
2013-01-13 20:27:11 +08:00
----------------------------
2011-08-30 16:27:23 +08:00
Returns the amount of total memory in bytes.
2011-06-16 20:48:23 +08:00
.. ocv:function :: size_t gpu::DeviceInfo::totalMemory()
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
gpu::DeviceInfo::supports
2013-01-13 20:27:11 +08:00
-------------------------
2011-08-30 16:27:23 +08:00
Provides information on GPU feature support.
2011-02-23 04:43:26 +08:00
2012-05-30 19:13:07 +08:00
.. ocv:function :: bool gpu::DeviceInfo::supports( FeatureSet feature_set ) const
2011-02-23 04:43:26 +08:00
2013-02-19 18:19:59 +08:00
:param feature_set: Features to be checked. See :ocv:enum:`gpu::FeatureSet`.
2011-03-23 18:56:20 +08:00
2011-08-30 16:27:23 +08:00
This function returns `` true `` if the device has the specified GPU feature. Otherwise, it returns `` false `` .
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
gpu::DeviceInfo::isCompatible
2013-01-13 20:27:11 +08:00
-----------------------------
2011-08-30 16:27:23 +08:00
Checks the GPU module and device compatibility.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: bool gpu::DeviceInfo::isCompatible()
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
This function returns `` true `` if the GPU module can be run on the specified device. Otherwise, it returns `` false `` .
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
gpu::DeviceInfo::deviceID
2013-01-13 20:27:11 +08:00
-------------------------
2011-08-30 16:27:23 +08:00
Returns system index of the GPU device starting with 0.
2011-03-23 18:56:20 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: int gpu::DeviceInfo::deviceID()