報錯
PS C:\Users\example> python
Python 3.8.0 (default, Nov 6 2019, 16:00:02) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
D:\software\Anaconda3\envs\work38\lib\site-packages\torch\cuda\__init__.py:83: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 103: integrity checks failed (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\c10\cuda\CUDAFunctions.cpp:109.)
return torch._C._cuda_getDeviceCount() > 0
>>> torch.cuda.is_available()
False
查看原因
- nvcc -V正常
PS C:\Users\example> nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:28:54_Pacific_Standard_Time_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0
- nvidia-smi正常
解決方案
打開NVIDIA設(shè)置,升級顯卡驅(qū)動后解決。文章來源地址http://www.zghlxwxcb.cn/news/detail-551914.html
文章來源:http://www.zghlxwxcb.cn/news/detail-551914.html
到了這里,關(guān)于UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount()【已解決】的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!