以编程方式使用openCL选择最佳可用GPU的问题

问题描述 投票:1回答:1

我正在使用此处给出的建议为我的算法选择最佳GPU。https://stackoverflow.com/a/33488953/5371117

我使用boost::compute::system::devices();查询MacBook Pro上的设备,这将向我返回以下设备列表。>

Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Intel(R) UHD Graphics 630
AMD Radeon Pro 560X Compute Engine

我想使用AMD Radeon Pro 560X Compute Engine来实现我的目的,但是当我迭代查找最大rating

= CL_DEVICE_MAX_CLOCK_FREQUENCY * CL_DEVICE_MAX_COMPUTE_UNITS的设备时。我得到以下结果:
Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz, 
freq: 2600, compute units: 12, rating:31200

Intel(R) UHD Graphics 630, 
freq: 1150, units: 24, rating:27600

AMD Radeon Pro 560X Compute Engine, 
freq: 300, units: 16, rating:4800

AMD GPU的评分最低。我也查看了规格,在我看来CL_DEVICE_MAX_CLOCK_FREQUENCY没有返回正确的值。

根据AMD芯片规格https://www.amd.com/en/products/graphics/radeon-rx-560x,我的AMD GPU的基本频率为1175 MHz,不是300MHz

根据英特尔芯片规格https://en.wikichip.org/wiki/intel/uhd_graphics/630,我的英特尔GPU的基本频率为300 MHz,不是1150MHz

,但确实具有1150MHz的提升频率] >>
std::vector<boost::compute::device> devices = boost::compute::system::devices();

std::pair<boost::compute::device, ai::int64> suitableDevice{};

for(auto& device: devices)
{
    auto rating = device.clock_frequency() * device.compute_units();
    std::cout << device.name() << ", freq: " << device.clock_frequency() << ", units: " << device.compute_units() << ", rating:" << rating << std::endl;
    if(suitableDevice.second < benchmark)
    {
        suitableDevice.first = device;
        suitableDevice.second = benchmark; 
     }
}      

我做错什么了吗?

我正在使用此处给出的建议为我的算法选择最佳GPU。 https://stackoverflow.com/a/33488953/5371117我在Macbook Pro上使用boost :: compute :: system :: devices()...

c++11 gpu opencl gpgpu boost-compute
1个回答
0
投票

不幸的是,这些属性实际上只能在实现中直接比较(相同的硬件制造商,相同的操作系统)。

我的建议是:

© www.soinside.com 2019 - 2024. All rights reserved.