Commit 837f6578 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

update gpu docs

parent 50d012b5
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Initalization and Information Initalization and Information
============================= =============================
.. highlight:: cpp .. highlight:: cpp
.. index:: gpu::getCudaEnabledDeviceCount
gpu::getCudaEnabledDeviceCount gpu::getCudaEnabledDeviceCount
---------------------------------- ----------------------------------
Returns the number of installed CUDA-enabled devices.
.. ocv:function:: int gpu::getCudaEnabledDeviceCount() .. ocv:function:: int gpu::getCudaEnabledDeviceCount()
Returns the number of installed CUDA-enabled devices. Use this function before any other GPU functions calls. If OpenCV is compiled without GPU support, this function returns 0. Use this function before any other GPU functions calls. If OpenCV is compiled without GPU support, this function returns 0.
.. index:: gpu::setDevice
gpu::setDevice gpu::setDevice
------------------ ------------------
.. ocv:function:: void gpu::setDevice(int device) Sets a device and initializes it for the current thread.
Sets a device and initializes it for the current thread. If the call of this function is omitted, a default device is initialized at the fist GPU usage. .. ocv:function:: void gpu::setDevice(int device)
:param device: System index of a GPU device starting with 0. :param device: System index of a GPU device starting with 0.
.. index:: gpu::getDevice If the call of this function is omitted, a default device is initialized at the fist GPU usage.
gpu::getDevice gpu::getDevice
------------------ ------------------
Returns the current device index set by :ocv:func:`gpu::setDevice` or initialized by default.
.. ocv:function:: int gpu::getDevice() .. ocv:function:: int gpu::getDevice()
Returns the current device index set by ``{gpu::getDevice}`` or initialized by default.
.. index:: gpu::GpuFeature
gpu::GpuFeature gpu::resetDevice
------------------
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
--------------- ---------------
.. ocv:class:: gpu::GpuFeature .. ocv:class:: gpu::FeatureSet
Class providing GPU computing features. Class providing GPU computing features. ::
::
enum GpuFeature enum FeatureSet
{ {
COMPUTE_10, COMPUTE_11, FEATURE_SET_COMPUTE_10,
COMPUTE_12, COMPUTE_13, FEATURE_SET_COMPUTE_11,
COMPUTE_20, COMPUTE_21, FEATURE_SET_COMPUTE_12,
ATOMICS, NATIVE_DOUBLE FEATURE_SET_COMPUTE_13,
FEATURE_SET_COMPUTE_20,
FEATURE_SET_COMPUTE_21,
GLOBAL_ATOMICS,
NATIVE_DOUBLE
}; };
.. index:: gpu::DeviceInfo
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:
.. ocv:function:: static bool gpu::TargetArchs::builtWith(FeatureSet feature)
:param feature: Feature to be checked. See :ocv:class:`gpu::FeatureSet`.
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".
gpu::DeviceInfo gpu::DeviceInfo
--------------- ---------------
.. ocv:class:: gpu::DeviceInfo .. ocv:class:: gpu::DeviceInfo
Class providing functionality for querying the specified GPU properties. Class providing functionality for querying the specified GPU properties. ::
::
class CV_EXPORTS DeviceInfo class CV_EXPORTS DeviceInfo
{ {
...@@ -72,123 +123,100 @@ Class providing functionality for querying the specified GPU properties. ...@@ -72,123 +123,100 @@ Class providing functionality for querying the specified GPU properties.
size_t freeMemory() const; size_t freeMemory() const;
size_t totalMemory() const; size_t totalMemory() const;
bool supports(GpuFeature feature) const; bool supports(FeatureSet feature) const;
bool isCompatible() const; bool isCompatible() const;
int deviceID() const;
}; };
.. index:: gpu::DeviceInfo::DeviceInfo
.. Comment: two lines below look like a bug
gpu::DeviceInfo::DeviceInfo gpu::DeviceInfo::DeviceInfo
------------------------------- -------------------------------
The constructors.
.. ocv:function:: gpu::DeviceInfo::DeviceInfo() .. ocv:function:: gpu::DeviceInfo::DeviceInfo()
.. ocv:function:: gpu::DeviceInfo::DeviceInfo(int device_id) .. ocv:function:: gpu::DeviceInfo::DeviceInfo(int device_id)
Constructs the ``DeviceInfo`` object for the specified device. If ``device_id`` parameter is missed, it constructs an object for the current device.
:param device_id: System index of the GPU device starting with 0. :param device_id: System index of the GPU device starting with 0.
.. index:: gpu::DeviceInfo::name Constructs the ``DeviceInfo`` object for the specified device. If ``device_id`` parameter is missed, it constructs an object for the current device.
gpu::DeviceInfo::name gpu::DeviceInfo::name
------------------------- -------------------------
Returns the device name.
.. ocv:function:: string gpu::DeviceInfo::name() .. ocv:function:: string gpu::DeviceInfo::name()
Returns the device name.
.. index:: gpu::DeviceInfo::majorVersion
gpu::DeviceInfo::majorVersion gpu::DeviceInfo::majorVersion
--------------------------------- ---------------------------------
Returns the major compute capability version.
.. ocv:function:: int gpu::DeviceInfo::majorVersion() .. ocv:function:: int gpu::DeviceInfo::majorVersion()
Returns the major compute capability version.
.. index:: gpu::DeviceInfo::minorVersion
gpu::DeviceInfo::minorVersion gpu::DeviceInfo::minorVersion
--------------------------------- ---------------------------------
Returns the minor compute capability version.
.. ocv:function:: int gpu::DeviceInfo::minorVersion() .. ocv:function:: int gpu::DeviceInfo::minorVersion()
Returns the minor compute capability version.
.. index:: gpu::DeviceInfo::multiProcessorCount
gpu::DeviceInfo::multiProcessorCount gpu::DeviceInfo::multiProcessorCount
---------------------------------------- ----------------------------------------
Returns the number of streaming multiprocessors.
.. ocv:function:: int gpu::DeviceInfo::multiProcessorCount() .. ocv:function:: int gpu::DeviceInfo::multiProcessorCount()
Returns the number of streaming multiprocessors.
.. index:: gpu::DeviceInfo::freeMemory
gpu::DeviceInfo::freeMemory gpu::DeviceInfo::freeMemory
------------------------------- -------------------------------
Returns the amount of free memory in bytes.
.. ocv:function:: size_t gpu::DeviceInfo::freeMemory() .. ocv:function:: size_t gpu::DeviceInfo::freeMemory()
Returns the amount of free memory in bytes.
.. index:: gpu::DeviceInfo::totalMemory
gpu::DeviceInfo::totalMemory gpu::DeviceInfo::totalMemory
-------------------------------- --------------------------------
Returns the amount of total memory in bytes.
.. ocv:function:: size_t gpu::DeviceInfo::totalMemory() .. ocv:function:: size_t gpu::DeviceInfo::totalMemory()
Returns the amount of total memory in bytes.
.. index:: gpu::DeviceInfo::supports
gpu::DeviceInfo::supports gpu::DeviceInfo::supports
----------------------------- -----------------------------
.. ocv:function:: bool gpu::DeviceInfo::supports(GpuFeature feature) Provides information on GPU feature support.
Provides information on GPU feature support. This function returns true if the device has the specified GPU feature. Otherwise, it returns false.
:param feature: Feature to be checked. See :ocv:class:`gpu::GpuFeature`.
.. index:: gpu::DeviceInfo::isCompatible .. ocv:function:: bool gpu::DeviceInfo::supports(FeatureSet feature)
gpu::DeviceInfo::isCompatible
---------------------------------
.. ocv:function:: bool gpu::DeviceInfo::isCompatible()
Checks the GPU module and device compatibility. This function returns ``true`` if the GPU module can be run on the specified device. Otherwise, it returns false. :param feature: Feature to be checked. See :ocv:class:`gpu::FeatureSet`.
.. index:: gpu::TargetArchs This function returns ``true`` if the device has the specified GPU feature. Otherwise, it returns ``false`` .
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: gpu::DeviceInfo::isCompatible
---------------------------------
.. ocv:function:: static bool gpu::TargetArchs::builtWith(GpuFeature feature) Checks the GPU module and device compatibility.
:param feature: Feature to be checked. See :ocv:class:`gpu::GpuFeature`.
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:: bool gpu::DeviceInfo::isCompatible()
.. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreaterPtx(int major, int minor) This function returns ``true`` if the GPU module can be run on the specified device. Otherwise, it returns ``false`` .
.. 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". gpu::DeviceInfo::deviceID
---------------------------------
Returns system index of the GPU device starting with 0.
.. ocv:function:: int gpu::DeviceInfo::deviceID()
...@@ -3,13 +3,13 @@ Matrix Reductions ...@@ -3,13 +3,13 @@ Matrix Reductions
.. highlight:: cpp .. highlight:: cpp
.. index:: gpu::meanStdDev
gpu::meanStdDev gpu::meanStdDev
------------------- -------------------
.. ocv:function:: void gpu::meanStdDev(const GpuMat\& mtx, Scalar\& mean, Scalar\& stddev) Computes a mean value and a standard deviation of matrix elements.
Computes a mean value and a standard deviation of matrix elements. .. ocv:function:: void gpu::meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev)
:param mtx: Source matrix. ``CV_8UC1`` matrices are supported for now. :param mtx: Source matrix. ``CV_8UC1`` matrices are supported for now.
...@@ -17,18 +17,19 @@ gpu::meanStdDev ...@@ -17,18 +17,19 @@ gpu::meanStdDev
:param stddev: Standard deviation value. :param stddev: Standard deviation value.
.. seealso:: .. seealso:: :ocv:func:`meanStdDev`
:ocv:func:`meanStdDev`
.. index:: gpu::norm
gpu::norm gpu::norm
------------- -------------
.. ocv:function:: double gpu::norm(const GpuMat\& src1, int normType=NORM_L2) Returns the norm of a matrix (or difference of two matrices).
.. ocv:function:: double gpu::norm(const GpuMat\& src1, int normType, GpuMat\& buf)
.. ocv:function:: double norm(const GpuMat\& src1, const GpuMat\& src2, int normType=NORM_L2) .. ocv:function:: double gpu::norm(const GpuMat& src1, int normType=NORM_L2)
.. ocv:function:: double gpu::norm(const GpuMat& src1, int normType, GpuMat& buf)
Returns the norm of a matrix (or difference of two matrices). .. ocv:function:: double gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2)
:param src1: Source matrix. Any matrices except 64F are supported. :param src1: Source matrix. Any matrices except 64F are supported.
...@@ -38,63 +39,61 @@ gpu::norm ...@@ -38,63 +39,61 @@ gpu::norm
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically. :param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
.. seealso:: .. seealso:: :ocv:func:`norm`
:ocv:func:`norm`
.. index:: gpu::sum
gpu::sum gpu::sum
------------ ------------
.. ocv:function:: Scalar gpu::sum(const GpuMat\& src) Returns the sum of matrix elements.
.. ocv:function:: Scalar gpu::sum(const GpuMat\& src, GpuMat\& buf) .. ocv:function:: Scalar gpu::sum(const GpuMat& src)
Returns the sum of matrix elements. .. ocv:function:: Scalar gpu::sum(const GpuMat& src, GpuMat& buf)
:param src: Source image of any depth except for ``CV_64F`` . :param src: Source image of any depth except for ``CV_64F`` .
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically. :param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
.. seealso:: .. seealso:: :ocv:func:`sum`
:ocv:func:`sum`
.. index:: gpu::absSum
gpu::absSum gpu::absSum
--------------- ---------------
.. ocv:function:: Scalar gpu::absSum(const GpuMat\& src) Returns the sum of absolute values for matrix elements.
.. ocv:function:: Scalar gpu::absSum(const GpuMat\& src, GpuMat\& buf) .. ocv:function:: Scalar gpu::absSum(const GpuMat& src)
Returns the sum of absolute values for matrix elements. .. ocv:function:: Scalar gpu::absSum(const GpuMat& src, GpuMat& buf)
:param src: Source image of any depth except for ``CV_64F`` . :param src: Source image of any depth except for ``CV_64F`` .
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically. :param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
.. index:: gpu::sqrSum
gpu::sqrSum gpu::sqrSum
--------------- ---------------
.. ocv:function:: Scalar gpu::sqrSum(const GpuMat\& src) Returns the squared sum of matrix elements.
.. ocv:function:: Scalar gpu::sqrSum(const GpuMat\& src, GpuMat\& buf) .. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src)
Returns the squared sum of matrix elements. .. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src, GpuMat& buf)
:param src: Source image of any depth except for ``CV_64F`` . :param src: Source image of any depth except for ``CV_64F`` .
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically. :param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
.. index:: gpu::minMax
gpu::minMax gpu::minMax
--------------- ---------------
.. ocv:function:: void gpu::minMax(const GpuMat\& src, double* minVal, double* maxVal=0, const GpuMat\& mask=GpuMat()) Finds global minimum and maximum matrix elements and returns their values.
.. ocv:function:: void gpu::minMax(const GpuMat\& src, double* minVal, double* maxVal, const GpuMat\& mask, GpuMat\& buf) .. ocv:function:: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal=0, const GpuMat& mask=GpuMat())
Finds global minimum and maximum matrix elements and returns their values. .. ocv:function:: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const GpuMat& mask, GpuMat& buf)
:param src: Single-channel source image. :param src: Single-channel source image.
...@@ -107,20 +106,19 @@ gpu::minMax ...@@ -107,20 +106,19 @@ gpu::minMax
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically. :param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3. The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3.
.. seealso::
:ocv:func:`minMaxLoc`
.. index:: gpu::minMaxLoc .. seealso:: :ocv:func:`minMaxLoc`
gpu::minMaxLoc gpu::minMaxLoc
------------------ ------------------
Finds global minimum and maximum matrix elements and returns their values with locations.
.. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat()) .. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat())
.. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf) .. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf)
Finds global minimum and maximum matrix elements and returns their values with locations.
:param src: Single-channel source image. :param src: Single-channel source image.
:param minVal: Pointer to the returned minimum value. Use ``NULL`` if not required. :param minVal: Pointer to the returned minimum value. Use ``NULL`` if not required.
...@@ -139,24 +137,22 @@ gpu::minMaxLoc ...@@ -139,24 +137,22 @@ gpu::minMaxLoc
The function does not work with ``CV_64F`` images on GPU with the compute capability < 1.3. The function does not work with ``CV_64F`` images on GPU with the compute capability < 1.3.
.. seealso:: .. seealso:: :ocv:func:`minMaxLoc`
:ocv:func:`minMaxLoc`
.. index:: gpu::countNonZero
gpu::countNonZero gpu::countNonZero
--------------------- ---------------------
.. ocv:function:: int gpu::countNonZero(const GpuMat\& src) Counts non-zero matrix elements.
.. ocv:function:: int gpu::countNonZero(const GpuMat\& src, GpuMat\& buf) .. ocv:function:: int gpu::countNonZero(const GpuMat& src)
Counts non-zero matrix elements. .. ocv:function:: int gpu::countNonZero(const GpuMat& src, GpuMat& buf)
:param src: Single-channel source image. :param src: Single-channel source image.
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically. :param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3. The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3.
.. seealso:: .. seealso:: :ocv:func:`countNonZero`
:ocv:func:`countNonZero`
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment