主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

validateGPU

验证 GPU 设备

自 R2024b 起

    说明

    validateGPU 验证当前选定的 GPU 设备。如果没有选择 GPU 设备,那么该函数将验证默认设备。

    示例

    validateGPU("all") 验证系统中检测到的所有 GPU 设备。

    示例

    validateGPU(ind) 验证索引 ind 指定的 GPU 设备。

    提示

    不需要验证您的 GPU 设备。使用 validateGPU 函数来诊断 GPU 设置的问题。

    示例

    示例

    全部折叠

    验证当前选定的 GPU 设备。如果未选择 GPU 设备,该函数将验证默认设备。validateGPU 函数打印执行的验证步骤以及每个步骤是通过、失败还是被跳过的指示。如果验证步骤失败,该函数将打印一条诊断消息。

    validateGPU
    # Beginning GPU validation
    # Performing system validation
    #    CUDA-supported platform .................................................PASSED
    #    CUDA-enabled graphics driver exists .....................................PASSED
    #        Version: 537.70
    #    CUDA-enabled graphics driver load .......................................PASSED
    #    CUDA environment variables ..............................................PASSED
    #    CUDA device count .......................................................PASSED
    #        Found 2 devices.
    #    GPU libraries load ......................................................PASSED
    # 
    # Performing device validation for device index 1
    #    Device exists ...........................................................PASSED
    #        NVIDIA RTX A5000
    #    Device supported ........................................................PASSED
    #    Device available ........................................................PASSED
    #        Device is in 'Default' compute mode.
    #    Device selectable .......................................................PASSED
    #    Device memory allocation ................................................PASSED
    #    Device kernel launch ....................................................PASSED
    # 
    # Finished GPU validation with no failures.
    

    验证系统中存在的所有 GPU 设备。validateGPU 函数执行一次一系列系统验证检查,然后对每个检测到的设备执行一次一系列设备验证步骤。

    validateGPU("all")
    # Beginning GPU validation
    # Performing system validation
    #    CUDA-supported platform .................................................PASSED
    #    CUDA-enabled graphics driver exists .....................................PASSED
    #        Version: 537.70
    #    CUDA-enabled graphics driver load .......................................PASSED
    #    CUDA environment variables ..............................................PASSED
    #    CUDA device count .......................................................PASSED
    #        Found 2 devices.
    #    GPU libraries load ......................................................PASSED
    # 
    # Performing device validation for device index 1
    #    Device exists ...........................................................PASSED
    #        NVIDIA RTX A5000
    #    Device supported ........................................................PASSED
    #    Device available ........................................................PASSED
    #        Device is in 'Default' compute mode.
    #    Device selectable .......................................................PASSED
    #    Device memory allocation ................................................PASSED
    #    Device kernel launch ....................................................PASSED
    # 
    # Performing device validation for device index 2
    #    Device exists ...........................................................PASSED
    #        Quadro P620
    #    Device supported ........................................................PASSED
    #    Device available ........................................................PASSED
    #        Device is in 'Default' compute mode.
    #    Device selectable .......................................................PASSED
    #    Device memory allocation ................................................PASSED
    #    Device kernel launch ....................................................PASSED
    # 
    # Finished GPU validation with no failures.
    

    验证索引为 2 的 GPU 设备。

    validateGPU(2)
    # Beginning GPU validation
    # Performing system validation
    #    CUDA-supported platform .................................................PASSED
    #    CUDA-enabled graphics driver exists .....................................PASSED
    #        Version: 537.70
    #    CUDA-enabled graphics driver load .......................................PASSED
    #    CUDA environment variables ..............................................PASSED
    #    CUDA device count .......................................................PASSED
    #        Found 2 devices.
    #    GPU libraries load ......................................................PASSED
    # 
    # Performing device validation for device index 2
    #    Device exists ...........................................................PASSED
    #        Quadro P620
    #    Device supported ........................................................PASSED
    #    Device available ........................................................PASSED
    #        Device is in 'Default' compute mode.
    #    Device selectable .......................................................PASSED
    #    Device memory allocation ................................................PASSED
    #    Device kernel launch ....................................................PASSED
    # 
    # Finished GPU validation with no failures.
    

    如果您有多个 GPU 设备,那么您可以通过传递设备索引向量作为输入,使用对 validateGPU 的一次调用来验证多个设备。例如,要验证 GPU 设备 12,请调用 validateGPU([1 2])

    输入参数

    全部折叠

    要验证的 GPU 设备的索引,指定为 1gpuDeviceCount 范围内的整数或整数向量。

    示例: 2

    示例: [1 3]

    数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    提示

    • 要验证远程 GPU,请使用您的集群启动一个并行池,其中的工作单元数量与 GPU 数量相同,然后在 spmd 代码块内调用 validateGPU

      cluster = parcluster("myRemoteGPUCluster"); 
      pool = parpool(cluster,numGPUs);
      
      spmd
        validateGPU
      end
      有关使用远程 GPU 的更多信息,请参阅 使用远程 GPU

    算法

    全部折叠

    版本历史记录

    在 R2024b 中推出