8000 [Help] wsl docker 调用 cuda 核心的问题 · timerring bilive · Discussion #328 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Answered by timerring
OrdinarySF asked this question in Q&A
Discussion options

You must be logged in to vote

没事,如果驱动能正常使用的话,可以直接在 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.

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

10000
You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by timerring
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #230 on May 01, 2025 05:53.

0