Returns the number of installed CUDA-enabled devices.
int gpu::
getCudaEnabledDeviceCount
()¶Use this function before any other GPU functions calls. If OpenCV is compiled without GPU support, this function returns 0.
Sets a device and initializes it for the current thread.
void gpu::
setDevice
(int device)¶Parameters: |
|
---|
If the call of this function is omitted, a default device is initialized at the fist GPU usage.
Returns the current device index set by gpu::setDevice()
or initialized by default.
int gpu::
getDevice
()¶Explicitly destroys and cleans up all resources associated with the current device in the current process.
void gpu::
resetDevice
()¶Any subsequent API call to this device will reinitialize the device.
Enumeration providing GPU computing features.
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:
- C++:
static bool
gpu::TargetArchs::
builtWith
(FeatureSet feature_set)¶
Parameters:
- feature_set – Features to be checked. See
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):
- C++:
static bool
gpu::TargetArchs::
has
(int major, int minor)¶
- C++:
static bool
gpu::TargetArchs::
hasPtx
(int major, int minor)¶
- C++:
static bool
gpu::TargetArchs::
hasBin
(int major, int minor)¶
- C++:
static bool
gpu::TargetArchs::
hasEqualOrLessPtx
(int major, int minor)¶
- C++:
static bool
gpu::TargetArchs::
hasEqualOrGreater
(int major, int minor)¶
- C++:
static bool
gpu::TargetArchs::
hasEqualOrGreaterPtx
(int major, int minor)¶
- C++:
static bool
gpu::TargetArchs::
hasEqualOrGreaterBin
(int major, int minor)¶
Parameters:
- major – Major compute capability version.
- 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
¶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(FeatureSet feature) const;
bool isCompatible() const;
int deviceID() const;
};
The constructors.
gpu::DeviceInfo::
DeviceInfo
()¶
gpu::DeviceInfo::
DeviceInfo
(int device_id)¶Parameters: |
|
---|
Constructs the DeviceInfo
object for the specified device. If device_id
parameter is missed, it constructs an object for the current device.
Returns the major compute capability version.
int gpu::DeviceInfo::
majorVersion
()¶Returns the minor compute capability version.
int gpu::DeviceInfo::
minorVersion
()¶Returns the number of streaming multiprocessors.
int gpu::DeviceInfo::
multiProcessorCount
()¶Returns the amount of free memory in bytes.
size_t gpu::DeviceInfo::
freeMemory
()¶Returns the amount of total memory in bytes.
size_t gpu::DeviceInfo::
totalMemory
()¶Provides information on GPU feature support.
bool gpu::DeviceInfo::
supports
(FeatureSet feature_set) const
¶Parameters: |
|
---|
This function returns true
if the device has the specified GPU feature. Otherwise, it returns false
.