简体   繁体   English

Java / OpenCL:检查启用了哪个图形卡

[英]Java/OpenCL: Checking which graphics card is enabled

Using OpenCL I am able to obtain a list of graphics cards available in my system (code snippet below), but I haven't found a way to determine which one is being used at runtime. 使用OpenCL,我可以获得系统中可用的图形卡列表(下面的代码段),但是我还没有找到一种确定运行时使用哪个图形卡的方法。 Is this possible? 这可能吗?

for (CLPlatform platform : CLPlatform.listCLPlatforms())
{
    for (CLDevice gpuDevice : platform.listCLDevices())
    {
        // The CPU shows up as a device, so filter it out.
         if (gpuDevice.getType() == CLDevice.Type.GPU && gpuDevice.isAvailable())
        {
            availableGPUDevices.add(gpuDevice);
            numGPUDevices++;
        }
    }
}

In theory I'd like to be able to add something along the lines of: 从理论上讲,我希望能够添加以下内容:

if (platform.getActiveGpu().getType() != AMD or NVIDIA) (pseudo-code)
{
    // show warning that a more powerful GPU is available
}

The only piece I'm missing is the ability to determine which GPU is active at the time. 我唯一缺少的就是能够确定当时哪个GPU处于活动状态。 Any help is greatly appreciated - thank you!! 非常感谢您的任何帮助-谢谢!

Clarification: by "which GPU is active" I mean I'm looking to determine, at the moment my code to check this is executing, which GPU is responsible for rendering the content on screen. 澄清:通过“哪个GPU处于活动状态”,我的意思是我想确定在检查该代码是否正在执行的那一刻,哪个GPU负责在屏幕上呈现内容。 My understanding is that both GPUs won't be rendering parts of the screen at the same time, so while I know it can switch quite a bit, I'd like to capture a snapshot of which GPU is running at that moment. 我的理解是两个GPU不会同时渲染屏幕的各个部分,因此尽管我知道它可以切换很多,但我想捕获当时正在运行的GPU的快照。

不幸的是,OpenCL不支持此功能。

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

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