在这里我检查了我是否使用GPU。我安装了所有的东西,但我不知道这个错误意味着什么。请帮助解决此错误。
import tensorflow as tf
print(tf.test.is_gpu_available())
C:UsersvinotAppDataLocalProgramsPythonPython37python.exe "C:Program FilesJetBrainsPyCharm 2020.2.1pluginspythonhelperspydevpydevconsole.py" --mode=client --port=60324
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['D:\python\python_work\pythonProject', 'D:/python/python_work/pythonProject'])
PyDev console: starting.
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
>>> runfile('D:/python/python_work/pythonProject/hello world.py', wdir='D:/python/python_work/pythonProject')
2021-01-13 23:51:37.257501: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2021-01-13 23:51:38.887931: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-01-13 23:51:38.890213: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-01-13 23:51:38.921531: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce RTX 3070 major: 8 minor: 6 memoryClockRate(GHz): 1.725
pciBusID: 0000:01:00.0
2021-01-13 23:51:38.921695: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2021-01-13 23:51:38.921899: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:Program FilesJetBrainsPyCharm 2020.2.1pluginspythonhelperspydev_pydev_bundlepydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:Program FilesJetBrainsPyCharm 2020.2.1pluginspythonhelperspydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"n", file, 'exec'), glob, loc)
File "D:/python/python_work/pythonProject/hello world.py", line 2, in <module>
print(tf.test.is_gpu_available())
File "C:UsersvinotAppDataLocalProgramsPythonPython37libsite-packagestensorflow_corepythonframeworktest_util.py", line 1432, in is_gpu_available
for local_device in device_lib.list_local_devices():
File "C:UsersvinotAppDataLocalProgramsPythonPython37libsite-packagestensorflow_corepythonclientdevice_lib.py", line 41, in list_local_devices
for s in pywrap_tensorflow.list_devices(session_config=session_config)
File "C:UsersvinotAppDataLocalProgramsPythonPython37libsite-packagestensorflow_corepythonpywrap_tensorflow_internal.py", line 2249, in list_devices
return ListDevices()
tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() failed. Status: cudaGetErrorString symbol not found.
在Tensorflow API文档中,不赞成使用tf.test.is_gpu_available()
方法。要更新,请使用以下内容:
tf.config.list_physical_devices('GPU')