13 #include "opencv2/cvconfig.h" 27 arr.
set(0, static_cast<uint64_t>(i));
40 for (
size_t i = 0; i <
v.size(); ++i)
41 arr.
set(i, static_cast<uint64_t>(
v[i]));
86 const char *fields[8] = {
"Denorm",
"InfNaN",
"RoundToNearest",
87 "RoundToZero",
"RoundToInf",
"FMA",
"SoftFloat",
88 "CorrectlyRoundedDivideSqrt"};
107 const char *fields[2] = {
"Kernel",
"NativeKernel"};
120 const char *fieldsP[4] = {
"name",
"vendor",
"version",
"device"};
121 const char *fieldsD[68] = {
"name",
"extensions",
"version",
"vendorName",
122 "OpenCL_C_Version",
"OpenCLVersion",
"deviceVersionMajor",
123 "deviceVersionMinor",
"driverVersion",
"type",
"addressBits",
124 "available",
"compilerAvailable",
"linkerAvailable",
"doubleFPConfig",
125 "singleFPConfig",
"halfFPConfig",
"endianLittle",
126 "errorCorrectionSupport",
"executionCapabilities",
127 "globalMemCacheSize",
"globalMemCacheType",
"globalMemCacheLineSize",
128 "globalMemSize",
"localMemSize",
"localMemType",
"hostUnifiedMemory",
129 "imageSupport",
"imageFromBufferSupport",
"imagePitchAlignment",
130 "imageBaseAddressAlignment",
"image2DMaxWidth",
"image2DMaxHeight",
131 "image3DMaxWidth",
"image3DMaxHeight",
"image3DMaxDepth",
132 "imageMaxBufferSize",
"imageMaxArraySize",
"vendorID",
133 "maxClockFrequency",
"maxComputeUnits",
"maxConstantArgs",
134 "maxConstantBufferSize",
"maxMemAllocSize",
"maxParameterSize",
135 "maxReadImageArgs",
"maxWriteImageArgs",
"maxSamplers",
136 "maxWorkGroupSize",
"maxWorkItemDims",
"maxWorkItemSizes",
137 "memBaseAddrAlign",
"nativeVectorWidthChar",
"nativeVectorWidthShort",
138 "nativeVectorWidthInt",
"nativeVectorWidthLong",
139 "nativeVectorWidthFloat",
"nativeVectorWidthDouble",
140 "nativeVectorWidthHalf",
"preferredVectorWidthChar",
141 "preferredVectorWidthShort",
"preferredVectorWidthInt",
142 "preferredVectorWidthLong",
"preferredVectorWidthFloat",
143 "preferredVectorWidthDouble",
"preferredVectorWidthHalf",
144 "printfBufferSize",
"profilingTimerResolution"};
146 for (
size_t i = 0; i < vpi.
size(); ++i) {
149 for (
int j = 0; j <
pi.deviceNumber(); ++j) {
152 sd.
set(fieldsD[0], di.
name(), j);
226 sp.
set(fieldsP[0],
pi.name(), i);
227 sp.
set(fieldsP[1],
pi.vendor(), i);
228 sp.
set(fieldsP[2],
pi.version(), i);
229 sp.
set(fieldsP[3], sd, i);
240 const char *fields[57] = {
"deviceID",
"name",
"totalGlobalMem",
241 "sharedMemPerBlock",
"regsPerBlock",
"warpSize",
"memPitch",
242 "maxThreadsPerBlock",
"maxThreadsDim",
"maxGridSize",
"clockRate",
243 "totalConstMem",
"majorVersion",
"minorVersion",
"textureAlignment",
244 "texturePitchAlignment",
"multiProcessorCount",
245 "kernelExecTimeoutEnabled",
"integrated",
"canMapHostMemory",
246 "computeMode",
"maxTexture1D",
"maxTexture1DMipmap",
247 "maxTexture1DLinear",
"maxTexture2D",
"maxTexture2DMipmap",
248 "maxTexture2DLinear",
"maxTexture2DGather",
"maxTexture3D",
249 "maxTextureCubemap",
"maxTexture1DLayered",
"maxTexture2DLayered",
250 "maxTextureCubemapLayered",
"maxSurface1D",
"maxSurface2D",
251 "maxSurface3D",
"maxSurface1DLayered",
"maxSurface2DLayered",
252 "maxSurfaceCubemap",
"maxSurfaceCubemapLayered",
"surfaceAlignment",
253 "concurrentKernels",
"ECCEnabled",
"pciBusID",
"pciDeviceID",
254 "pciDomainID",
"tccDriver",
"asyncEngineCount",
"unifiedAddressing",
255 "memoryClockRate",
"memoryBusWidth",
"l2CacheSize",
256 "maxThreadsPerMultiProcessor",
"freeMemory",
"totalMemory",
257 "supports",
"isCompatible"};
315 const char *fieldsFS[15] = {
"Compute10",
"Compute11",
"Compute12",
316 "Compute13",
"Compute20",
"Compute21",
"Compute30",
"Compute32",
317 "Compute35",
"Compute50",
"GlobalAtomics",
"SharedAtomics",
318 "NativeDouble",
"WarpShuffleFunctions",
"DynamicParallelism"};
335 s.
set(fields[55], sf);
352 nargchk((nrhs==1 || nrhs==2) && nlhs<=1);
356 string method(rhs[0].toString());
359 if (method ==
"checkHardwareSupport") {
361 const char *fields[24] = {
"MMX",
"SSE",
"SSE2",
"SSE3",
"SSSE3",
362 "SSE4_1",
"SSE4_2",
"POPCNT",
"FP16",
"AVX",
"AVX2",
"FMA3",
363 "AVX_512F",
"AVX_512BW",
"AVX_512CD",
"AVX_512DQ",
"AVX_512ER",
364 "AVX_512IFMA",
"AVX_512PF",
"AVX_512VBMI",
"AVX_512VL",
"NEON",
365 "VSX",
"AVX512_SKX"};
393 else if (method ==
"getHardwareFeatureName") {
395 int feature = rhs[1].toInt();
399 else if (method ==
"getBuildInformation") {
403 else if (method ==
"version") {
407 else if (method ==
"getNumberOfCPUs") {
411 else if (method ==
"getNumThreads") {
415 else if (method ==
"setNumThreads") {
419 else if (method ==
"useOptimized") {
423 else if (method ==
"setUseOptimized") {
427 else if (method ==
"getIppVersion") {
429 plhs[0] =
MxArray(ipp::getIppVersion());
431 else if (method ==
"useIPP") {
433 plhs[0] =
MxArray(ipp::useIPP());
435 else if (method ==
"setUseIPP") {
437 ipp::setUseIPP(rhs[1].toBool());
439 else if (method ==
"useIPP_NE") {
441 plhs[0] =
MxArray(ipp::useIPP_NE());
443 else if (method ==
"setUseIPP_NE") {
445 ipp::setUseIPP_NE(rhs[1].toBool());
447 else if (method ==
"haveOpenVX") {
451 else if (method ==
"useOpenVX") {
455 else if (method ==
"setUseOpenVX") {
459 else if (method ==
"haveOpenCL") {
463 else if (method ==
"haveAmdBlas") {
467 else if (method ==
"haveAmdFft") {
471 else if (method ==
"haveSVM") {
475 else if (method ==
"useOpenCL") {
479 else if (method ==
"setUseOpenCL") {
483 else if (method ==
"getPlatfomsInfo") {
490 else if (method ==
"dumpOpenCLInformation") {
492 dumpOpenCLInformation();
495 else if (method ==
"getCudaEnabledDeviceCount") {
499 else if (method ==
"getDevice") {
503 else if (method ==
"setDevice") {
507 else if (method ==
"resetDevice") {
511 else if (method ==
"deviceSupports") {
513 const char *fields[10] = {
"Compute10",
"Compute11",
"Compute12",
514 "Compute13",
"Compute20",
"Compute21",
"Compute30",
"Compute32",
515 "Compute35",
"Compute50"};
529 else if (method ==
"printCudaDeviceInfo") {
533 else if (method ==
"printShortCudaDeviceInfo") {
537 else if (method ==
"deviceInfo") {
542 else if (method ==
"useTegra") {
544 #ifdef HAVE_TEGRA_OPTIMIZATION 545 plhs[0] =
MxArray(tegra::useTegra());
550 else if (method ==
"setUseTegra") {
552 #ifdef HAVE_TEGRA_OPTIMIZATION 553 tegra::setUseTegra(rhs[1].toBool());
558 "Unrecognized operation %s", method.
c_str());
String extensions() const
MxArray toStruct(const cv::cuda::DeviceInfo &di)
Convert CUDA device info to struct array.
void setDevice(int device)
bool canMapHostMemory() const
size_t maxWorkGroupSize() const
void getPlatfomsInfo(std::vector< PlatformInfo > &platform_info)
Vec3i maxGridSize() const
int preferredVectorWidthHalf() const
int deviceVersionMajor() const
size_t surfaceAlignment() const
String OpenCL_C_Version() const
uint imageBaseAddressAlignment() const
bool unifiedAddressing() const
int preferredVectorWidthFloat() const
int memBaseAddrAlign() const
int nativeVectorWidthFloat() const
Vec3i maxTexture3D() const
MxArray toExecCapStruct(int flags)
Convert OpenCL execution capabilities bit-field to MxArray.
size_t imageMaxArraySize() const
#define CV_CPU_AVX_512IFMA
Vec3i maxTexture2DLayered() const
MxArray toFPConfigStruct(int flags)
Convert OpenCL FP config bit-field to MxArray.
int maxSurfaceCubemap() const
size_t imageMaxBufferSize() const
const ConstMap< int, string > OCLTypeMap
OpenCL device type.
Vec3i maxTexture2DLinear() const
int deviceVersionMinor() const
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
int maxClockFrequency() const
const String & getBuildInformation()
size_t localMemSize() const
size_t image3DMaxDepth() const
FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
bool hostUnifiedMemory() const
Vec2i maxSurface1DLayered() const
size_t freeMemory() const
int maxTexture1DMipmap() const
Vec2i maxTexture2DGather() const
Vec3i maxThreadsDim() const
int maxWorkItemDims() const
int maxThreadsPerBlock() const
bool linkerAvailable() const
size_t maxMemAllocSize() const
void setNumThreads(int nthreads)
size_t maxConstantBufferSize() const
Vec2i maxSurfaceCubemapLayered() const
bool isCompatible() const
String OpenCLVersion() const
int maxTexture1DLinear() const
int maxConstantArgs() const
int asyncEngineCount() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
bool supports(FeatureSet feature_set) const
int getCudaEnabledDeviceCount()
bool endianLittle() const
size_t image2DMaxWidth() const
int preferredVectorWidthInt() const
const char * name() const
#define CV_CPU_AVX_512VBMI
Vec2i maxTexture2DMipmap() const
void setUseOpenVX(bool flag)
size_t globalMemSize() const
int singleFPConfig() const
int nativeVectorWidthHalf() const
const ConstMap< int, string > OCLVendorMap
OpenCL vendor name.
size_t texturePitchAlignment() const
void printCudaDeviceInfo(int device)
void setUseOpenCL(bool flag)
size_t image3DMaxHeight() const
size_t globalMemCacheSize() const
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
int nativeVectorWidthInt() const
MxArray toMxArray(const std::vector< size_t > &v)
Convert vector of size type to MxArray.
size_t totalMemory() const
int maxWriteImageArgs() const
int preferredVectorWidthChar() const
int preferredVectorWidthLong() const
void printShortCudaDeviceInfo(int device)
String vendorName() const
size_t textureAlignment() const
int memoryBusWidth() const
ComputeModeExclusiveProcess
Vec2i maxSurface2D() const
size_t sharedMemPerBlock() const
size_t totalGlobalMem() const
bool compilerAvailable() const
int multiProcessorCount() const
bool imageFromBufferSupport() const
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
int nativeVectorWidthShort() const
#define mxCreateNumericMatrix
size_t maxParameterSize() const
void setUseOptimized(bool onoff)
#define CV_CPU_AVX512_SKX
const ConstMap< int, string > CUDAComputeModeMap
CUDA device compute modes.
int globalMemCacheLineSize() const
bool kernelExecTimeoutEnabled() const
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
int executionCapabilities() const
size_t image2DMaxHeight() const
String driverVersion() const
bool errorCorrectionSupport() const
Vec2i maxTexture2D() const
int maxTextureCubemap() const
int doubleFPConfig() const
void maxWorkItemSizes(size_t *) const
ComputeMode computeMode() const
bool checkHardwareSupport(int feature)
int nativeVectorWidthChar() const
Global constant definitions.
size_t printfBufferSize() const
const ConstMap< int, string > OCLCacheMap
OpenCL type of global memory cache.
int globalMemCacheType() const
size_t totalConstMem() const
Vec2i maxTexture1DLayered() const
int maxReadImageArgs() const
int maxThreadsPerMultiProcessor() const
uint imagePitchAlignment() const
int preferredVectorWidthDouble() const
int maxComputeUnits() const
bool deviceSupports(FeatureSet feature_set)
int preferredVectorWidthShort() const
Vec2i maxTextureCubemapLayered() const
bool imageSupport() const
bool concurrentKernels() const
size_t profilingTimerResolution() const
int nativeVectorWidthDouble() const
bool isNull() const
Determine whether the array is initialized or not.
Vec3i maxSurface2DLayered() const
Vec3i maxSurface3D() const
int memoryClockRate() const
std::map wrapper with one-line initialization and lookup method.
size_t image3DMaxWidth() const
int nativeVectorWidthLong() const
String getHardwareFeatureName(int feature)
const ConstMap< int, string > OCLMemMap
OpenCL type of local memory.
Identifies an mxArray with no imaginary components.