我的C++代码运行在Win 10上,自构建OpenCV 4.5.3.,检查WITH_OPENCL标志。
通过OpenCL的“透明API”,使用UMat代替Mat不会带来任何性能改进。
从我所读到的https://jeanvitor.com/opencv-opencl-umat-performance/,我期望至少有一个轻微的性能改善时,使用UMat
,而不是Mat
,即使在我的笔记本电脑英特尔高清图形520。
对UMat
和Mat
执行resize
、cvtColor
和bilateralFilter
不会显示任何差异。ocl::haveOpenCL
和ocl::useOpenCL
都返回真。
唯一Device::TYPE_GPU
设备的查询值为:name: Intel(R) HD Graphics 520
extensions: cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_depth_images cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_icd cl_khr_image2d_from_buffer cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_intel_subgroups cl_intel_required_subgroup_size cl_intel_subgroups_short cl_khr_spir cl_intel_accelerator cl_intel_media_block_io cl_intel_driver_diagnostics cl_intel_device_side_avc_motion_estimation cl_khr_priority_hints cl_khr_throttle_hints cl_khr_create_command_queue cl_khr_fp64 cl_khr_subgroups cl_khr_il_program cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_intel_planar_yuv cl_intel_packed_yuv cl_intel_motion_estimation cl_intel_advanced_motion_estimation cl_khr_gl_sharing cl_khr_gl_depth_images cl_khr_gl_event cl_khr_gl_msaa_sharing cl_intel_dx9_media_sharing cl_khr_dx9_media_sharing cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_intel_d3d11_nv12_media_sharing cl_intel_simultaneous_sharing
个version: OpenCL 2.1 NEO
OpenCLVersion: OpenCL 2.1 NEO
OpenCL_C_Version: OpenCL C 2.0
我也在其他机器上试过,性能没有差异。
我错过了什么,有什么想法或提示吗?
1条答案
按热度按时间jtw3ybtb1#
我发现这个问题是由Microsoft Unit Testing Framework for C++引起的。在我的生产代码中使用
UMat
比Mat
快得多。已回答的问题