由网友(贩卖热情)分享简介:我有一台安装了conda的ubuntu服务器。我创建了一个名为TF-GPU的虚拟环境,并在其中安装了TensorFlow 2。Ubuntu服务器安装了一块安装了GPU的GeForce GTX显卡。当我在使用TF-GPU环境的jupyter笔记本电脑中运行下面的代码时,它显示0个可用的GPU。安装在我的TF-GPU环境中...
我有一台安装了conda的ubuntu服务器。我创建了一个名为TF-GPU的虚拟环境,并在其中安装了TensorFlow 2。Ubuntu服务器安装了一块安装了GPU的GeForce GTX显卡。当我在使用TF-GPU环境的jupyter笔记本电脑中运行下面的代码时,它显示0个可用的GPU。安装在我的TF-GPU环境中的模块也如下所示。为什么我的tensorflow 2环境看不到我的GPU?我需要做什么才能让TF-GPU环境看到并使用我的ubuntu服务器上的GPU?
编码:
import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
输出:
Num GPUs Available: 0
# installed modules
$ conda list
# packages in environment at /home/scotsditch/anaconda3/envs/tf-gpu:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
_tflow_select 2.1.0 gpu
absl-py 0.9.0 py38_0
argon2-cffi 20.1.0 py38h7b6447c_1
astunparse 1.6.3 py_0
attrs 19.3.0 py_0
backcall 0.2.0 py_0 anaconda
blas 1.0 mkl
bleach 3.1.5 py_0
blinker 1.4 py38_0
brotlipy 0.7.0 py38h7b6447c_1000
c-ares 1.15.0 h7b6447c_1001
ca-certificates 2020.12.5 ha878542_0 conda-forge
cachetools 4.1.1 py_0
certifi 2020.12.5 py38h578d9bd_1 conda-forge
cffi 1.14.1 py38he30daa8_0
chardet 3.0.4 py38_1003
click 7.1.2 py_0
cryptography 2.9.2 py38h1ba5d50_0
cudatoolkit 10.1.243 h6bb024c_0 anaconda
cudnn 7.6.5 cuda10.1_0
cupti 10.1.168 0
cycler 0.10.0 py_2 conda-forge
dbus 1.13.16 hb2f20db_0
decorator 4.4.2 py_0 anaconda
defusedxml 0.6.0 py_0
entrypoints 0.3 py38_0
expat 2.2.9 he1b5a44_2 conda-forge
fontconfig 2.13.1 he4413a7_1000 conda-forge
freetype 2.10.2 h5ab3b9f_0 anaconda
gast 0.3.3 py_0
glib 2.66.1 h92f7085_0
google-auth 1.20.1 py_0
google-auth-oauthlib 0.4.1 py_2
google-pasta 0.2.0 py_0
grpcio 1.31.0 py38hf8bcb03_0
gst-plugins-base 1.14.0 hbbd80ab_1
gstreamer 1.14.0 h28cd5cc_2
h5py 2.10.0 py38hd6299e0_1
hdf5 1.10.6 hb1b8bf9_0
icu 58.2 hf484d3e_1000 conda-forge
idna 2.10 py_0
importlib-metadata 1.7.0 py38_0
importlib_metadata 1.7.0 0
intel-openmp 2020.1 217
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.16.1 py38h5ca1d4c_0 anaconda
ipython_genutils 0.2.0 py38_0 anaconda
jedi 0.17.0 py38_0 anaconda
jinja2 2.11.2 py_0
jpeg 9b habf39ab_1 anaconda
jsonschema 3.2.0 py38_0
jupyter_client 6.1.6 py_0 anaconda
jupyter_core 4.6.3 py38_0 anaconda
keras-preprocessing 1.1.0 py_1
kiwisolver 1.3.1 py38h82cb98a_0 conda-forge
lcms2 2.11 h396b838_0 anaconda
ld_impl_linux-64 2.33.1 h53a641e_7
libedit 3.1.20191231 h14c3975_1
libffi 3.3 he6710b0_2
libgcc-ng 9.1.0 hdf63c60_0
libgfortran-ng 7.3.0 hdf63c60_0
libiconv 1.16 h516909a_0 conda-forge
libpng 1.6.37 hbc83047_0 anaconda
libprotobuf 3.12.4 hd408876_0
libsodium 1.0.18 h7b6447c_0 anaconda
libstdcxx-ng 9.1.0 hdf63c60_0
libtiff 4.1.0 h2733197_1 anaconda
libuuid 2.32.1 h14c3975_1000 conda-forge
libxcb 1.13 h14c3975_1002 conda-forge
libxml2 2.9.9 h13577e0_2 conda-forge
lz4-c 1.9.2 he6710b0_1 anaconda
markdown 3.2.2 py38_0
markupsafe 1.1.1 py38h7b6447c_0
matplotlib 3.3.2 py38h578d9bd_1 conda-forge
matplotlib-base 3.3.2 py38h4d1ce4f_1 conda-forge
mistune 0.8.4 py38h7b6447c_1000
mkl 2020.1 217
mkl-service 2.3.0 py38he904b0f_0
mkl_fft 1.1.0 py38h23d657b_0
mkl_random 1.1.1 py38h0573a6f_0
nb_conda_kernels 2.2.3 py38_0
nbconvert 5.6.1 py38_0
nbformat 5.0.7 py_0
ncurses 6.2 he6710b0_1
notebook 6.1.1 py38_0
numpy 1.19.1 py38hbc911f0_0
numpy-base 1.19.1 py38hfa32c7d_0
oauthlib 3.1.0 py_0
olefile 0.46 py_0 anaconda
openssl 1.1.1h h516909a_0 conda-forge
opt_einsum 3.1.0 py_0
packaging 20.4 py_0
pandas 1.1.3 py38he6710b0_0 anaconda
pandoc 2.10.1 0
pandocfilters 1.4.2 py38_1
parso 0.8.0 py_0 anaconda
pcre 8.44 he1b5a44_0 conda-forge
pexpect 4.8.0 py38_0 anaconda
pickleshare 0.7.5 py38_1000 anaconda
pillow 7.2.0 py38hb39fc2d_0 anaconda
pip 20.2.2 py38_0
prometheus_client 0.8.0 py_0
prompt-toolkit 3.0.5 py_0 anaconda
protobuf 3.12.4 py38he6710b0_0
pthread-stubs 0.4 h36c2ea0_1001 conda-forge
ptyprocess 0.6.0 py38_0 anaconda
pyasn1 0.4.8 py_0
pyasn1-modules 0.2.7 py_0
pycparser 2.20 py_2
pygments 2.6.1 py_0 anaconda
pyjwt 1.7.1 py38_0
pyopenssl 19.1.0 py_1
pyparsing 2.4.7 py_0
pyqt 5.9.2 py38h05f1152_4
pyrsistent 0.16.0 py38h7b6447c_0
pysocks 1.7.1 py38_0
python 3.8.5 hcff3b4d_0
python-dateutil 2.8.1 py_0 anaconda
python_abi 3.8 1_cp38 conda-forge
pytz 2020.1 py_0 anaconda
pyzmq 19.0.1 py38he6710b0_1 anaconda
qt 5.9.7 h5867ecd_1
readline 8.0 h7b6447c_0
requests 2.24.0 py_0
requests-oauthlib 1.3.0 py_0
rsa 4.6 py_0
scipy 1.5.0 py38h0b6359f_0
send2trash 1.5.0 py38_0
setuptools 49.6.0 py38_0
sip 4.19.13 py38he6710b0_0
six 1.15.0 py_0
sqlite 3.32.3 h62c20be_0
tensorboard 2.2.1 pyh532a8cf_0
tensorboard-plugin-wit 1.6.0 py_0
tensorflow 2.2.0 gpu_py38hb782248_0
tensorflow-base 2.2.0 gpu_py38h83e3d50_0
tensorflow-estimator 2.2.0 pyh208ff02_0
tensorflow-gpu 2.2.0 h0d30ee6_0
termcolor 1.1.0 py38_1
terminado 0.8.3 py38_0
testpath 0.4.4 py_0
tk 8.6.10 hbc83047_0
tornado 6.0.4 py38h7b6447c_1 anaconda
traitlets 4.3.3 py38_0 anaconda
urllib3 1.25.10 py_0
wcwidth 0.2.5 py_0 anaconda
webencodings 0.5.1 py38_1
werkzeug 1.0.1 py_0
wheel 0.34.2 py38_0
wrapt 1.12.1 py38h7b6447c_1
xorg-libxau 1.0.9 h14c3975_0 conda-forge
xorg-libxdmcp 1.1.3 h516909a_0 conda-forge
xz 5.2.5 h7b6447c_0
zeromq 4.3.2 he6710b0_2 anaconda
zipp 3.1.0 py_0
zlib 1.2.11 h7b6447c_3
zstd 1.4.4 h0b5b093_3 anaconda
当我在我的服务器上运行以下命令时,我得到以下输出:
lspci -vnnn | perl -lne 'print if /^d+:.+([S+:S+])/' | grep VGA
输出:
42:00.0 VGA compatible controller [0300]: NVIDIA Corporation GV104 [GeForce GTX 1180] [10de:1e87] (rev a1) (prog-if 00 [VGA controller])
推荐答案
我能够通过运行
sudo apt install nvidia-cuda-toolkit
然后重新启动我的服务器
相关推荐
最新文章