2011-01-15 01:52:40 +08:00
\section { Initalization and Information}
\cvCppFunc { gpu::getCudaEnabledDeviceCount}
2011-01-25 23:23:02 +08: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.
2011-01-15 01:52:40 +08:00
\cvdefCpp { int getCudaEnabledDeviceCount();}
\cvCppFunc { gpu::setDevice}
2011-01-29 00:11:43 +08:00
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-01-15 01:52:40 +08:00
\cvdefCpp { void setDevice(int device);}
\begin { description}
\cvarg { device} { index of GPU device in system starting with 0.}
\end { description}
\cvCppFunc { gpu::getDevice}
2011-02-02 15:45:50 +08:00
Returns the current device index, which was set by { gpu::getDevice} or initialized by default.
2011-01-15 01:52:40 +08:00
\cvdefCpp { int getDevice();}
2011-02-02 15:45:50 +08:00
\cvclass { gpu::GpuFeature} \label { cpp.gpu.GpuFeature}
GPU compute features.
\begin { lstlisting}
enum GpuFeature
{
2011-02-15 18:54:49 +08:00
FEATURE_ SET_ COMPUTE_ 10, FEATURE_ SET_ COMPUTE_ 11,
FEATURE_ SET_ COMPUTE_ 12, FEATURE_ SET_ COMPUTE_ 13,
FEATURE_ SET_ COMPUTE_ 20, FEATURE_ SET_ COMPUTE_ 21,
2011-02-02 15:45:50 +08:00
ATOMICS, NATIVE_ DOUBLE
} ;
\end { lstlisting}
2011-01-31 15:45:00 +08:00
\cvclass { gpu::DeviceInfo}
This class provides functionality for querying the specified GPU properties.
2011-01-15 01:52:40 +08:00
2011-01-31 15:45:00 +08:00
\begin { lstlisting}
class CV_ EXPORTS DeviceInfo
{
public:
DeviceInfo();
DeviceInfo(int device_ id);
2011-01-15 01:52:40 +08:00
2011-01-31 15:45:00 +08:00
string name() const;
2011-01-15 01:52:40 +08:00
2011-02-03 22:55:54 +08:00
int majorVersion() const;
int minorVersion() const;
2011-01-31 15:45:00 +08:00
int multiProcessorCount() const;
2011-01-15 01:52:40 +08:00
2011-01-31 15:45:00 +08:00
size_ t freeMemory() const;
size_ t totalMemory() const;
2011-01-15 01:52:40 +08:00
2011-02-09 20:31:05 +08:00
bool supports(GpuFeature feature) const;
2011-01-31 15:45:00 +08:00
bool isCompatible() const;
} ;
\end { lstlisting}
2011-01-15 01:52:40 +08:00
2011-01-31 15:45:00 +08:00
\cvCppFunc { gpu::DeviceInfo::DeviceInfo}
Constructs DeviceInfo object for the specified device. If \texttt { device\_ id} parameter is missed it constructs object for the current device.
\cvdefCpp { DeviceInfo::DeviceInfo();\newline
DeviceInfo::DeviceInfo(int device\_ id);}
2011-01-15 01:52:40 +08:00
\begin { description}
2011-01-31 15:45:00 +08:00
\cvarg { device\_ id} { Index of the GPU device in system starting with 0.}
2011-01-15 01:52:40 +08:00
\end { description}
2011-01-31 15:45:00 +08:00
\cvCppFunc { gpu::DeviceInfo::name}
Returns the device name.
\cvdefCpp { string DeviceInfo::name();}
2011-02-03 22:55:54 +08:00
\cvCppFunc { gpu::DeviceInfo::majorVersion}
2011-01-31 15:45:00 +08:00
Returns the major compute capability version.
2011-02-03 22:55:54 +08:00
\cvdefCpp { int DeviceInfo::majorVersion();}
2011-01-31 15:45:00 +08:00
2011-02-03 22:55:54 +08:00
\cvCppFunc { gpu::DeviceInfo::minorVersion}
2011-01-31 15:45:00 +08:00
Returns the minor compute capability version.
2011-02-03 22:55:54 +08:00
\cvdefCpp { int DeviceInfo::minorVersion();}
2011-01-31 15:45:00 +08:00
\cvCppFunc { gpu::DeviceInfo::multiProcessorCount}
Returns the number of streaming multiprocessors.
\cvdefCpp { int DeviceInfo::multiProcessorCount();}
2011-01-15 01:52:40 +08:00
2011-01-31 15:45:00 +08:00
\cvCppFunc { gpu::DeviceInfo::freeMemory}
Returns the amount of free memory in bytes.
\cvdefCpp { size\_ t DeviceInfo::freeMemory();}
\cvCppFunc { gpu::DeviceInfo::totalMemory}
Returns the amount of total memory in bytes.
\cvdefCpp { size\_ t DeviceInfo::totalMemory();}
2011-02-09 20:31:05 +08:00
\cvCppFunc { gpu::DeviceInfo::supports}
2011-01-31 15:45:00 +08:00
Returns true if the device has the given GPU feature, otherwise false.
2011-02-09 20:31:05 +08:00
\cvdefCpp { bool DeviceInfo::supports(GpuFeature feature);}
2011-01-15 01:52:40 +08:00
\begin { description}
2011-02-04 16:16:09 +08:00
\cvarg { feature} { Feature to be checked. See \hyperref [cpp.gpu.GpuFeature] { cv::gpu::GpuFeature} .}
2011-01-15 01:52:40 +08:00
\end { description}
2011-01-31 15:45:00 +08:00
\cvCppFunc { gpu::DeviceInfo::isCompatible}
Returns true if the GPU module can be run on the specified device, otherwise false.
\cvdefCpp { bool DeviceInfo::isCompatible();}
2011-01-15 01:52:40 +08:00
2011-01-18 20:01:28 +08:00
2011-01-27 18:06:38 +08:00
\cvclass { gpu::TargetArchs}
This class provides functionality (as set of static methods) for checking which NVIDIA card architectures the GPU module was built for.
2011-01-18 20:01:28 +08:00
2011-01-27 18:06:38 +08:00
\bigskip
2011-01-18 20:01:28 +08:00
2011-01-27 18:06:38 +08:00
The following method checks whether the module was built with the support of the given feature:
\cvdefCpp { static bool builtWith(GpuFeature feature);}
2011-01-18 20:01:28 +08:00
\begin { description}
2011-02-04 16:16:09 +08:00
\cvarg { feature} { Feature to be checked. See \hyperref [cpp.gpu.GpuFeature] { cv::gpu::GpuFeature} .}
2011-01-20 17:22:05 +08:00
\end { description}
2011-01-31 15:45:00 +08:00
There are a set of methods for checking whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
2011-01-27 18:06:38 +08:00
\cvdefCpp {
static bool has(int major, int minor);\newline
static bool hasPtx(int major, int minor);\newline
static bool hasBin(int major, int minor);\newline
static bool hasEqualOrLessPtx(int major, int minor);\newline
static bool hasEqualOrGreater(int major, int minor);\newline
static bool hasEqualOrGreaterPtx(int major, int minor);\newline
static bool hasEqualOrGreaterBin(int major, int minor);}
2011-01-19 18:54:58 +08:00
\begin { description}
\cvarg { major} { Major compute capability version.}
\cvarg { minor} { Minor compute capability version.}
2011-01-18 20:01:28 +08:00
\end { description}
2011-01-25 23:23:02 +08:00
% By default GPU module is no compiled for devices with compute capability equal to 1.0. So if you run
2011-01-18 20:01:28 +08: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".