File: initalization_and_information.rst

package info (click to toggle)
opencv 2.3.1-11%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 82,284 kB
  • sloc: xml: 493,314; cpp: 334,117; ansic: 108,641; java: 15,407; python: 14,061; sh: 107; makefile: 61
file content (194 lines) | stat: -rw-r--r-- 5,821 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
Initalization and Information
=============================
.. highlight:: cpp

.. index:: gpu::getCudaEnabledDeviceCount

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.

.. index:: gpu::setDevice

gpu::setDevice
------------------
.. ocv:function:: void gpu::setDevice(int device)

    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.

    :param device: System index of a GPU device starting with 0.

.. index:: gpu::getDevice

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
---------------
.. ocv:class:: gpu::GpuFeature
    
Class providing GPU computing features. 
::

    enum GpuFeature
    {
        COMPUTE_10, COMPUTE_11,
        COMPUTE_12, COMPUTE_13,
        COMPUTE_20, COMPUTE_21,
        ATOMICS, NATIVE_DOUBLE
    };


.. index:: gpu::DeviceInfo

gpu::DeviceInfo
---------------
.. ocv:class:: gpu::DeviceInfo

Class providing functionality for querying the specified GPU properties. 
::

    class CV_EXPORTS DeviceInfo
    {
    public:
        DeviceInfo();
        DeviceInfo(int device_id);

        string name() const;

        int majorVersion() const;
        int minorVersion() const;

        int multiProcessorCount() const;

        size_t freeMemory() const;
        size_t totalMemory() const;

        bool supports(GpuFeature feature) const;
        bool isCompatible() const;
    };


.. index:: gpu::DeviceInfo::DeviceInfo
.. Comment: two lines below look like a bug

gpu::DeviceInfo::DeviceInfo
------------------------------- 
.. ocv:function:: gpu::DeviceInfo::DeviceInfo()

.. 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.

.. index:: gpu::DeviceInfo::name

gpu::DeviceInfo::name
-------------------------
.. ocv:function:: string gpu::DeviceInfo::name()

    Returns the device name.

.. index:: gpu::DeviceInfo::majorVersion

gpu::DeviceInfo::majorVersion
---------------------------------
.. ocv:function:: int gpu::DeviceInfo::majorVersion()

    Returns the major compute capability version.

.. index:: gpu::DeviceInfo::minorVersion

gpu::DeviceInfo::minorVersion
---------------------------------
.. ocv:function:: int gpu::DeviceInfo::minorVersion()

    Returns the minor compute capability version.

.. index:: gpu::DeviceInfo::multiProcessorCount

gpu::DeviceInfo::multiProcessorCount
----------------------------------------
.. ocv:function:: int gpu::DeviceInfo::multiProcessorCount()

    Returns the number of streaming multiprocessors.

.. index:: gpu::DeviceInfo::freeMemory

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
--------------------------------
.. ocv:function:: size_t gpu::DeviceInfo::totalMemory()

    Returns the amount of total memory in bytes.

.. index:: gpu::DeviceInfo::supports

gpu::DeviceInfo::supports
-----------------------------
.. ocv:function:: bool gpu::DeviceInfo::supports(GpuFeature feature)

    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

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.

.. index:: gpu::TargetArchs

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(GpuFeature feature)

        :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:: 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".