简体   繁体   English

使用Magick.NET启用OpenCL

[英]Enable OpenCL with Magick.NET

I am using Magick.NET to despeckle an image. 我正在使用Magick.NET对图像进行散斑。 It take ~1-2 second for a relatively small image (1000*1500 pixels). 相对较小的图像(1000 * 1500像素)大约需要1-2秒。 I read that ImageMagick uses OpenCL to speed up some operations and despeckle is one of them. 我读到ImageMagick使用OpenCL来加快某些操作,而去斑点是其中之一。 So, I wonder why it is so slow with a quite recent graphic card (GTX 960). 因此,我想知道为什么最近的显卡(GTX 960)这么慢。

Is there a Magick.NET setting to enable OpenCL? 是否有Magick.NET设置可启用OpenCL?

You can enable or disable OpenCL by setting OpenCL.IsEnabled . 您可以通过设置OpenCL.IsEnabled来启用或禁用OpenCL。 The first time you use an OpenCL operation a benchmark will run to determine if it is better to use the GPU or the CPU. 首次使用OpenCL操作时,将运行基准测试来确定使用GPU还是CPU更好。 The benchmark is written inside the following file: %LOCALAPPDATA%\\ImageMagick\\ImagemagickOpenCLDeviceProfile.xml . 基准写入以下文件内: %LOCALAPPDATA%\\ImageMagick\\ImagemagickOpenCLDeviceProfile.xml An example of this benchmark is: 此基准的一个示例是:

<devices>
  <device name="CPU" score="4.914"/>
  <device platform="AMD Accelerated Parallel Processing" score="0.165" vendor="Advanced Micro Devices, Inc." name="Ellesmere" version="2117.14 (VM)" maxClockFrequency="1266" maxComputeUnits="36" />
  <device platform="AMD Accelerated Parallel Processing" score="1.326" vendor="Advanced Micro Devices, Inc." name="Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz" version="2117.14 (sse2,avx)" maxClockFrequency="3998" maxComputeUnits="8" />
</devices>

The device with the lowest score wins and will be used when it is possible to use OpenCL inside an algorithm. 得分最低的设备将获胜,并在可能在算法内部使用OpenCL的情况下使用。

It is possible that the benchmark already ran on your machine and decided that the CPU is faster. 基准测试可能已经在您的计算机上运行,​​并确定CPU速度更快。 This means that even though OpenCL is enabled the CPU will be used. 这意味着即使启用了OpenCL,也将使用CPU。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM