Skip to content

[Help] wsl docker 调用 cuda 核心的问题 #230

Closed

Description

@OrdinarySF

Problem Overview

wsl docker gpu version 无法正常转换字幕

Steps Taken

  1. 执行docker命令sudo docker run -itd --gpus 'all,"capabilities=compute,utility,video"' --name bilive_docker_gpu -p 22333:2233 ghcr.io/timerring/bilive-gpu:0.2.10
  2. 按照流程启动服务
  3. 添加录制任务

Expected Outcome

(A clear and concise description of what you expected to happen.)

Screenshots

scan-20250323.log

Environment Information

  • Operating System: Windows 11 WSL Ubuntu 24.10
  • Python Version: same docker
  • Driver & CUDA Version: Driver Version: 572.16 CUDA Version: 12.8
  • Error Messages and Logs: [If applicable, provide any error messages or relevant log outputs]

Additional context

(Add any other context about the problem here.)

Activity

  1. timerring commented on Mar 24, 2025

    @timerring
    Owner

    wsl 跑 nvidia gpu docker,需要 nvidia-container-toolkit 等配置。

    参考官方文档:https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

  2. self-assigned this
    on Mar 24, 2025
  3. OrdinarySF commented on Mar 24, 2025

    @OrdinarySF
    Author

    安装过

    root@ORDINARY:~# nvidia-smi
    Mon Mar 24 23:53:28 2025
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 570.86.16              Driver Version: 572.16         CUDA Version: 12.8     |
    |-----------------------------------------+------------------------+----------------------+
    | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
    |                                         |                        |               MIG M. |
    |=========================================+========================+======================|
    |   0  NVIDIA GeForce RTX 3070 ...    On  |   00000000:01:00.0 Off |                  N/A |
    | N/A   56C    P8             16W /  125W |     934MiB /   8192MiB |     26%      Default |
    |                                         |                        |                  N/A |
    +-----------------------------------------+------------------------+----------------------+
    
    +-----------------------------------------------------------------------------------------+
    | Processes:                                                                              |
    |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
    |        ID   ID                                                               Usage      |
    |=========================================================================================|
    |  No running processes found                                                             |
    +-----------------------------------------------------------------------------------------+
    
  4. timerring commented on Mar 28, 2025

    @timerring
    Owner

    好的,nvcc -V cuda 版本是多少

  5. OrdinarySF commented on Apr 3, 2025

    @OrdinarySF
    Author

    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2025 NVIDIA Corporation
    Built on Fri_Feb_21_20:23:50_PST_2025
    Cuda compilation tools, release 12.8, V12.8.93
    Build cuda_12.8.r12.8/compiler.35583870_0

  6. timerring commented on Apr 4, 2025

    @timerring
    Owner

    单独运行一下识别模块,看一下输出结果,python src/subtitle/generate.py path/to/video

  7. timerring commented on Apr 13, 2025

    @timerring
    Owner

    或者直接拉个镜像验证一下。

    docker run --rm --gpus all nvidia/cuda:12.0.1-runtime-ubuntu22.04 nvidia-smi

  8. OrdinarySF commented on Apr 13, 2025

    @OrdinarySF
    Author

    @timerring sorry最近有点忙

    docker run --rm --gpus all  nvidia/cuda:12.0.1-runtime-ubuntu22.04 nvidia-smi
    Unable to find image 'nvidia/cuda:12.0.1-runtime-ubuntu22.04' locally
    12.0.1-runtime-ubuntu22.04: Pulling from nvidia/cuda
    aece8493d397: Pull complete
    72951eebaee1: Pull complete
    6380df36b797: Pull complete
    dce5449f8cbe: Pull complete
    fea6c9fe8a9b: Pull complete
    4a1fbbf21bd0: Pull complete
    1b99e878d962: Pull complete
    622df319ef96: Pull complete
    7c3b140ed2ea: Pull complete
    Digest: sha256:912e635ceffa8c2895e1cc693fd1dc5b5b920e178583cb34ed84a903b439601b
    Status: Downloaded newer image for nvidia/cuda:12.0.1-runtime-ubuntu22.04
    
    ==========
    == CUDA ==
    ==========
    
    CUDA Version 12.0.1
    
    Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
    
    This container image and its contents are governed by the NVIDIA Deep Learning Container License.
    By pulling and using the container, you accept the terms and conditions of this license:
    https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
    
    A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
    
    Sun Apr 13 15:37:06 2025
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 570.86.16              Driver Version: 572.16         CUDA Version: 12.8     |
    |-----------------------------------------+------------------------+----------------------+
    | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
    |                                         |                        |               MIG M. |
    |=========================================+========================+======================|
    |   0  NVIDIA GeForce RTX 3070 ...    On  |   00000000:01:00.0 Off |                  N/A |
    | N/A   64C    P8             14W /  105W |    1196MiB /   8192MiB |      0%      Default |
    |                                         |                        |                  N/A |
    +-----------------------------------------+------------------------+----------------------+
    
    +-----------------------------------------------------------------------------------------+
    | Processes:                                                                              |
    |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
    |        ID   ID                                                               Usage      |
    |=========================================================================================|
    |  No running processes found                                                             |
    +-----------------------------------------------------------------------------------------+
    
  9. timerring commented on Apr 14, 2025

    @timerring
    Owner

    没事,如果驱动能正常使用的话,可以直接在 docker container 里验证一下 torch 是否能正确调用 cuda 核心:

    import torch
    
    def check_cuda_with_pytorch():
        """Check if the PyTorch CUDA environment is working correctly"""
        try:
            print("Checking PyTorch CUDA environment:")
            if torch.cuda.is_available():
                print(f"CUDA device is available, the current CUDA version is: {torch.version.cuda}")
                print(f"PyTorch version is: {torch.__version__}")
                print(f"Detected {torch.cuda.device_count()} CUDA devices.")
                for i in range(torch.cuda.device_count()):
                    print(f"Device {i}: {torch.cuda.get_device_name(i)}")
                    print(f"Device {i} total memory: {torch.cuda.get_device_properties(i).total_memory / (1024 ** 3):.2f} GB")
                    print(f"Device {i} current memory usage: {torch.cuda.memory_allocated(i) / (1024 ** 3):.2f} GB")
                    print(f"Device {i} max memory usage: {torch.cuda.memory_reserved(i) / (1024 ** 3):.2f} GB")
            else:
                print("CUDA device is not available.")
        except Exception as e:
            print(f"Error when checking PyTorch CUDA environment: {e}")
    
    if __name__ == "__main__":
        check_cuda_with_pytorch()
  10. OrdinarySF commented on Apr 19, 2025

    @OrdinarySF
    Author
    Image

    看起来不可用

  11. timerring commented on Apr 20, 2025

    @timerring
    Owner

    好的,大概率还是 CUDA 的问题,建议检查一下环境,确保 CUDA cores 可以正常被调用。

  12. changed the title [-][Help] wsl docker gpu version 无法正常转换字幕[/-] [+][Help] wsl docker 调用 cuda 核心的问题[/+] on Apr 20, 2025
  13. OrdinarySF commented on Apr 27, 2025

    @OrdinarySF
    Author
    Image

    重新拉取了最新版镜像,问题解决

  14. Repository owner locked and limited conversation to collaborators on May 1, 2025
  15. converted this issue into a discussion #328 on May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions