报错
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设置,升级显卡驱动后解决。文章来源地址https://www.toymoban.com/news/detail-551914.html
文章来源:https://www.toymoban.com/news/detail-551914.html
到了这里,关于UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount()【已解决】的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!