opencv/modules/gpu/doc/initalization_and_information.rst

199 lines
5.3 KiB
ReStructuredText
Raw Normal View History

Initalization and Information
=============================
.. highlight:: cpp
.. index:: gpu::getCudaEnabledDeviceCount
cv::gpu::getCudaEnabledDeviceCount
----------------------------------
.. c:function:: int getCudaEnabledDeviceCount()
2011-02-26 12:05:10 +01:00
Returns number of CUDA-enabled devices installed. It is to be used before any other GPU functions calls. If OpenCV is compiled without GPU support this function returns 0.
.. index:: gpu::setDevice
cv::gpu::setDevice
------------------
.. c:function:: void setDevice(int device)
Sets device and initializes it for the current thread. Call of this function can be omitted, but in this case a default device will be initialized on fist GPU usage.
2011-02-26 12:05:10 +01:00
:param device: index of GPU device in system starting with 0.
.. index:: gpu::getDevice
cv::gpu::getDevice
------------------
.. c:function:: int getDevice()
Returns the current device index, which was set by {gpu::getDevice} or initialized by default.
.. index:: gpu::GpuFeature
.. _gpu::GpuFeature:
gpu::GpuFeature
---------------
.. c:type:: gpu::GpuFeature
2011-02-26 12:05:10 +01:00
GPU compute features. ::
enum GpuFeature
{
COMPUTE_10, COMPUTE_11,
COMPUTE_12, COMPUTE_13,
COMPUTE_20, COMPUTE_21,
ATOMICS, NATIVE_DOUBLE
};
.. index:: gpu::DeviceInfo
.. _gpu::DeviceInfo:
gpu::DeviceInfo
---------------
.. c:type:: gpu::DeviceInfo
2011-02-26 12:05:10 +01:00
This class provides functionality for querying the specified GPU properties. ::
class CV_EXPORTS DeviceInfo
{
public:
DeviceInfo();
DeviceInfo(int device_id);
2011-02-26 12:05:10 +01:00
string name() const;
2011-02-26 12:05:10 +01:00
int majorVersion() const;
int minorVersion() const;
2011-02-26 12:05:10 +01:00
int multiProcessorCount() const;
2011-02-26 12:05:10 +01:00
size_t freeMemory() const;
size_t totalMemory() const;
2011-02-26 12:05:10 +01:00
bool supports(GpuFeature feature) const;
bool isCompatible() const;
};
.. index:: gpu::DeviceInfo::DeviceInfo
cv::gpu::DeviceInfo::DeviceInfo
2011-02-26 12:05:10 +01:00
------------------------------- ``_``
.. c:function:: DeviceInfo::DeviceInfo()
.. c:function:: DeviceInfo::DeviceInfo(int device_id)
Constructs DeviceInfo object for the specified device. If deviceidparameter is missed it constructs object for the current device.
2011-02-26 12:05:10 +01:00
:param device_id: Index of the GPU device in system starting with 0.
.. index:: gpu::DeviceInfo::name
cv::gpu::DeviceInfo::name
-------------------------
.. c:function:: string DeviceInfo::name()
Returns the device name.
.. index:: gpu::DeviceInfo::majorVersion
cv::gpu::DeviceInfo::majorVersion
---------------------------------
.. c:function:: int DeviceInfo::majorVersion()
Returns the major compute capability version.
.. index:: gpu::DeviceInfo::minorVersion
cv::gpu::DeviceInfo::minorVersion
---------------------------------
.. c:function:: int DeviceInfo::minorVersion()
Returns the minor compute capability version.
.. index:: gpu::DeviceInfo::multiProcessorCount
cv::gpu::DeviceInfo::multiProcessorCount
----------------------------------------
.. c:function:: int DeviceInfo::multiProcessorCount()
Returns the number of streaming multiprocessors.
.. index:: gpu::DeviceInfo::freeMemory
cv::gpu::DeviceInfo::freeMemory
-------------------------------
.. c:function:: size_t DeviceInfo::freeMemory()
Returns the amount of free memory in bytes.
.. index:: gpu::DeviceInfo::totalMemory
cv::gpu::DeviceInfo::totalMemory
--------------------------------
.. c:function:: size_t DeviceInfo::totalMemory()
Returns the amount of total memory in bytes.
.. index:: gpu::DeviceInfo::supports
cv::gpu::DeviceInfo::supports
-----------------------------
.. c:function:: bool DeviceInfo::supports(GpuFeature feature)
Returns true if the device has the given GPU feature, otherwise false.
2011-02-26 12:05:10 +01:00
:param feature: Feature to be checked. See .
.. index:: gpu::DeviceInfo::isCompatible
cv::gpu::DeviceInfo::isCompatible
---------------------------------
.. c:function:: bool DeviceInfo::isCompatible()
Returns true if the GPU module can be run on the specified device, otherwise false.
.. index:: gpu::TargetArchs
.. _gpu::TargetArchs:
gpu::TargetArchs
----------------
.. c:type:: gpu::TargetArchs
This class provides functionality (as set of static methods) for checking which NVIDIA card architectures the GPU module was built for.
bigskip
The following method checks whether the module was built with the support of the given feature:
.. c:function:: static bool builtWith(GpuFeature feature)
2011-02-26 12:05:10 +01:00
:param feature: Feature to be checked. See .
There are a set of methods for checking whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
.. c:function:: static bool has(int major, int minor)
.. c:function:: static bool hasPtx(int major, int minor)
.. c:function:: static bool hasBin(int major, int minor)
.. c:function:: static bool hasEqualOrLessPtx(int major, int minor)
.. c:function:: static bool hasEqualOrGreater(int major, int minor)
.. c:function:: static bool hasEqualOrGreaterPtx(int major, int minor)
.. c:function:: static bool hasEqualOrGreaterBin(int major, int minor)
2011-02-26 12:05:10 +01:00
* **major** Major compute capability version.
2011-02-26 12:05:10 +01:00
* **minor** Minor compute capability version.
2011-02-26 12:05:10 +01:00
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".