初期化と情報 ================== .. highlight:: cpp .. index:: gpu::getCudaEnabledDeviceCount cv::gpu::getCudaEnabledDeviceCount ---------------------------------- `id=0.758521648447 Comments from the Wiki `__ .. cfunction:: int getCudaEnabledDeviceCount() CUDAを利用可能なデバイスの個数を返します.最初のGPU関数呼び出しよりも前に利用しなければいけません.OpenCVがGPUサポートなしでコンパイルされていれば,この関数は0を返します. .. index:: gpu::setDevice cv::gpu::setDevice ------------------ `id=0.0534351520417 Comments from the Wiki `__ .. cfunction:: void setDevice(int device) 現在のスレッドでデバイスを設定し,それを初期化します.この関数呼び出しを省略することもできますが,その場合,最初に GPU が利用される際にデフォルトデバイスが初期化されます. :param device: 0からはじまる,GPUデバイスのインデックス. .. index:: gpu::getDevice cv::gpu::getDevice ------------------ `id=0.410588214762 Comments from the Wiki `__ .. cfunction:: int getDevice() 現在のデバイスインデックスを返します.これは,{gpu::getDevice} によって設定された,またはデフォルトで初期化されたデバイスです. .. index:: gpu::GpuFeature .. _gpu::GpuFeature: gpu::GpuFeature --------------- `id=0.659340362898 Comments from the Wiki `__ .. ctype:: gpu::GpuFeature GPU の計算機能. .. code-block:: c enum GpuFeature { COMPUTE_10, COMPUTE_11, COMPUTE_12, COMPUTE_13, COMPUTE_20, COMPUTE_21, ATOMICS, NATIVE_DOUBLE }; .. .. index:: gpu::DeviceInfo .. _gpu::DeviceInfo: gpu::DeviceInfo --------------- `id=0.405155921984 Comments from the Wiki `__ .. ctype:: gpu::DeviceInfo このクラスは,指定の GPU プロパティを問い合わせる機能を提供します. .. code-block:: c 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 cv::gpu::DeviceInfo::DeviceInfo ------------------------------- `id=0.542342231379 Comments from the Wiki `__ ``_`` .. cfunction:: DeviceInfo::DeviceInfo() .. cfunction:: DeviceInfo::DeviceInfo(int device_id) 指定されたデバイスに対する DeviceInfo オブジェクトを作成します. deviceidパラメータが指定されない場合は,現在のデバイスに対するオブジェクトが作成されます. :param device_id: 0から始まる,システムGPUデバイスのインデックス. .. index:: gpu::DeviceInfo::name cv::gpu::DeviceInfo::name ------------------------- `id=0.688403903479 Comments from the Wiki `__ .. cfunction:: string DeviceInfo::name() デバイス名を返します. .. index:: gpu::DeviceInfo::majorVersion cv::gpu::DeviceInfo::majorVersion --------------------------------- `id=0.936684076096 Comments from the Wiki `__ .. cfunction:: int DeviceInfo::majorVersion() メジャー compute cpapability バージョンを返します. .. index:: gpu::DeviceInfo::minorVersion cv::gpu::DeviceInfo::minorVersion --------------------------------- `id=0.0684989532847 Comments from the Wiki `__ .. cfunction:: int DeviceInfo::minorVersion() マイナー compute cpapability バージョンを返します. .. index:: gpu::DeviceInfo::multiProcessorCount cv::gpu::DeviceInfo::multiProcessorCount ---------------------------------------- `id=0.245570741616 Comments from the Wiki `__ .. cfunction:: int DeviceInfo::multiProcessorCount() ストリーミングマルチプロセッサの数を返します. .. index:: gpu::DeviceInfo::freeMemory cv::gpu::DeviceInfo::freeMemory ------------------------------- `id=0.74186722925 Comments from the Wiki `__ .. cfunction:: size_t DeviceInfo::freeMemory() 空きメモリ量をバイト単位で返します. .. index:: gpu::DeviceInfo::totalMemory cv::gpu::DeviceInfo::totalMemory -------------------------------- `id=0.662652868472 Comments from the Wiki `__ .. cfunction:: size_t DeviceInfo::totalMemory() 総メモリ量をバイト単位で返します. .. index:: gpu::DeviceInfo::supports cv::gpu::DeviceInfo::supports ----------------------------- `id=0.934148679043 Comments from the Wiki `__ .. cfunction:: bool DeviceInfo::supports(GpuFeature feature) 指定されたGPU機能がデバイスに備わっていれば true を,そうでなければ false を返します. :param feature: チェックされる機能. gpu::GpuFeature を参照してください. .. index:: gpu::DeviceInfo::isCompatible cv::gpu::DeviceInfo::isCompatible --------------------------------- `id=0.759148432744 Comments from the Wiki `__ .. cfunction:: bool DeviceInfo::isCompatible() 指定されたデバイス上でこのGPUモジュールを実行できる場合は true ,そうでなければ false を返します. .. index:: gpu::TargetArchs .. _gpu::TargetArchs: gpu::TargetArchs ---------------- `id=0.190914211785 Comments from the Wiki `__ .. ctype:: gpu::TargetArchs このクラスは,GPU モジュールが,どの NVIDIA カードアーキテクチャ用にビルドされているかを調べる機能を提供します. bigskip 以下は,GPUモジュールが,指定された機能をサポートする様にビルドされているかを調べるメソッドです: .. cfunction:: static bool builtWith(GpuFeature feature) :param feature: チェックされる機能. gpu::GpuFeature を参照してください. 以下のメソッド群は,指定されたアーキテクチャ用の中間コード(PTX)またはバイナリGPUコードが,GPUモジュールに含まれているかを調べるためのものです: .. cfunction:: static bool has(int major, int minor) .. cfunction:: static bool hasPtx(int major, int minor) .. cfunction:: static bool hasBin(int major, int minor) .. cfunction:: static bool hasEqualOrLessPtx(int major, int minor) .. cfunction:: static bool hasEqualOrGreater(int major, int minor) .. cfunction:: static bool hasEqualOrGreaterPtx(int major, int minor) .. cfunction:: static bool hasEqualOrGreaterBin(int major, int minor) * **major** メジャー compute capability バージョン. * **minor** マイナー compute capability バージョン. CUDA C プログラミングガイド Version 3.2 からの引用:「ある compute capability に対して作られたPTX コードは常に,同じか,それ以降の compute capability のバイナリにコンパイルすることができます」