Main Content

validateGPU

Validate GPU devices

Since R2024b

    Description

    validateGPU validates the currently selected GPU device. If no GPU device is selected, then the function validates the default device.

    example

    validateGPU("all") validates all GPU devices detected in your system.

    example

    validateGPU(ind) validates the GPU devices specified by indices ind.

    Tip

    Validating your GPU device is not required. Use the validateGPU function to diagnose problems with your GPU setup.

    example

    Examples

    collapse all

    Validate the currently selected GPU device. If no GPU device is selected, the function validates the default device. The validateGPU function prints the validation steps performed and an indication of whether each step passed, failed, or was skipped. If a validation step fails, the function prints a diagnostic message.

    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.
    

    Validate all GPU devices present in your system. The validateGPU function performs a series of system validation checks once, and then a series of device validation steps once for each device detected.

    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.
    

    Validate the GPU device with index 2.

    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.
    

    If you have multiple GPU devices, then you can validate several using a single call to validateGPU by passing a vector of device indices as input. For example, to validate GPU devices 1 and 2, call validateGPU([1 2]).

    Input Arguments

    collapse all

    Indices of GPU devices to validate, specified as an integer or vector of integers in the range 1 to gpuDeviceCount.

    Example: 2

    Example: [1 3]

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Tips

    • To validate remote GPUs, start a parallel pool using your cluster with as many workers as there are GPUs, then call validateGPU inside an spmd block.

      cluster = parcluster("myRemoteGPUCluster"); 
      pool = parpool(cluster,numGPUs);
      
      spmd
        validateGPU
      end
      For more information about using remote GPUs, see Work with Remote GPUs.

    Algorithms

    collapse all

    Version History

    Introduced in R2024b