为 Zivid 软件选择特定 GPU

This article demonstrates how to specify a computational device for Zivid Software. This is relevant if you have multiple GPUs and want to use a specific one. This can be one integrated GPU and one or more dedicated GPUs.

备注

确保满足 Zivid 的 GPU 要求 。如果您尝试使用 CPU 或 AMD GPU 运行 Zivid SDK,请查看如何 选择使用不受支持的计算设备 运行 SDK。

Specifying GPU is done by updating the Zivid Config file. If the file already exists and it's located in %LOCALAPPDATA%ZividAPI for Windows or "${XDG_CONFIG_HOME-$HOME/.config}"/Zivid/API for Ubuntu, skip ahead to editing the ComputeDevice parameters below.

如果文件不存在:

  1. 下 载 Config.yml 文件。

    配置文件包含以下信息:

    __version__: 4
    Configuration:
        ComputeDevice:
            SelectionFilter: ""
            Type: GPU
            Vendor: Nvidia
    
  2. 将配置文件放在以下目录中:

    Windows
    mkdir %LOCALAPPDATA%\Zivid\API
    move %HOMEPATH%\Downloads\Config.yml %LOCALAPPDATA%\Zivid\API\
    
    Ubuntu
    mkdir --parents "${XDG_CONFIG_HOME-$HOME/.config}"/Zivid/API
    mv ~/Downloads/Config.yml "${XDG_CONFIG_HOME-$HOME/.config}"/Zivid/API/
    

    小心

    任何现有的配置文件都将被覆盖。

小心

Zivid配置文件必须使用.yml文件扩展名(而不是.yaml)。

  1. 通过更改配置文件的 ComputeDevice 参数来分配所需的GPU(如果已知):

  2. 如果每个供应商只有一个 GPU(例如集成 Intel GPU 和专用 NVIDIA GPU),请将 Type 更改为 GPUVendor 更改为 NVIDIAIntel ,例如

    ComputeDevice:
        SelectionFilter: ""
        Type: GPU
        Vendor: Nvidia
    
  3. If you have multiple GPUs of the same vendor (e.g. two Nvidia GPUs), SelectionFilter must specify which GPU to use. Find the exact device name first: with the OpenCL version of the SDK, run clinfo -l to list all compute devices; with the CUDA version, run nvidia-smi -L instead. Leave Type and Vendor as Any, and set SelectionFilter to any unique part of the device name, e.g. for an NVIDIA GeForce RTX 3060:

    ComputeDevice:
        SelectionFilter: "RTX 3060"
        Type: Any
        Vendor: Any
    
  4. 要验证设置是否成功,需要重新启动Zivid Studio,然后点击 HelpAbout Zivid StudioSystem InfoCompute Device Info。可以 在 Device info 下看到指定的GPU设备。

    ../../../../_images/studio-system-info-device-info-highlighted.png

Version History

SDK

变更

2.11.0

不再推荐使用AMD。 SDK 中已移除官方支持,请参阅 为 Zivid 软件启用不支持的计算设备

移除了仅在 CPU 上运行 SDK 的说明。