前提・実現したいこと
最近Deeplearningを始めた初心者です。teratailで初めて質問させていただきます。
kerasのバックエンドでtensorflowを使用しており、GPUの使用に関して
以下のようなエラーが出てしまいます。
発生している問題・エラーメッセージ
Cannot assign a device for operation 'Const': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. [[Node: Const = Const[dtype=DT_INT32, value=Tensor<type: int32 shape: [] values: 0>, _device="/device:GPU:0"]()]]
該当のソースコード
python
1import tensorflow as tf 2config = tf.ConfigProto( 3 device_count={"GPU":0}, 4 log_device_placement=True 5) 6 7sess = tf.Session(config=config) 8 9 10with tf.device("/gpu:0"): 11 x = tf.constant(0) 12 13sess.run(x)
試したこと
以下のコードの結果を見るとGPUを認識できているように見えるのですが、、、
python
1from tensorflow.python.client import device_lib 2device_lib.list_local_devices()
[name: "/device:CPU:0" device_type: "CPU" memory_limit: 268435456 locality { } incarnation: 234465888146844552, name: "/device:GPU:0" device_type: "GPU" memory_limit: 9220039639 locality { bus_id: 1 links { } } incarnation: 17233090269377160055 physical_device_desc: "device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0, compute capability: 6.1"]
認識はできていても、使用できないのはなぜでしょうか。
初歩的な質問かもしれませんが、よろしくお願いいたします。
補足情報(FW/ツールのバージョンなど)
OS : windows10
pythonのバージョン:3.5
追記
pip listを実行した結果は以下の通りです。
ちなみにAnacondaの仮想環境を使用しています。
Package Version ----------------------------- ----------- absl-py 0.2.2 asn1crypto 0.22.0 astor 0.6.2 backports.functools-lru-cache 1.4 backports.weakref 1.0rc1 bleach 1.5.0 CacheControl 0.12.3 certifi 2018.4.16 cffi 1.10.0 chardet 3.0.4 cloudpickle 0.5.3 colorama 0.3.9 cryptography 2.0.3 cycler 0.10.0 dask 0.17.5 decorator 4.1.2 distlib 0.2.5 easydict 1.7 entrypoints 0.2.3 enum34 1.1.6 gast 0.2.0 GDAL 2.2.0 graphviz 0.8.2 grpcio 1.12.0 h5py 2.7.1 html5lib 0.9999999 idna 2.6 ipykernel 4.6.1 ipython 6.1.0 ipython-genutils 0.2.0 ipywidgets 7.0.0 jedi 0.10.2 Jinja2 2.9.6 joblib 0.11 jsonschema 2.6.0 jupyter 1.0.0 jupyter-client 5.1.0 jupyter-console 5.2.0 jupyter-core 4.3.0 Keras 2.1.1 lockfile 0.12.2 mako 1.0.7 Markdown 2.6.11 MarkupSafe 1.0 matplotlib 2.1.0 mistune 0.7.4 msgpack-python 0.4.8 nbconvert 5.3.1 nbformat 4.4.0 networkx 2.1 notebook 5.0.0 numpy 1.14.3 olefile 0.44 packaging 16.8 pandas 0.22.0 pandocfilters 1.4.2 pickleshare 0.7.4 piexif 1.0.13 Pillow 4.3.0 pip 10.0.1 progress 1.3 prompt-toolkit 1.0.15 protobuf 3.5.2.post1 pycparser 2.18 pydot-ng 1.0.0 Pygments 2.2.0 pygpu 0.7.5 pyOpenSSL 17.2.0 pyparsing 2.2.0 PySocks 1.6.7 python-dateutil 2.6.1 pytz 2017.2 PyWavelets 0.5.2 PyYAML 3.12 pyzmq 16.0.2 qtconsole 4.3.1 requests 2.18.4 scikit-image 0.14.0 scikit-learn 0.19.1 scipy 1.0.0 setuptools 39.2.0 simplegeneric 0.8.1 six 1.11.0 tensorboard 1.8.0 tensorflow 1.8.0 tensorflow-gpu 1.8.0 tensorflow-tensorboard 0.4.0rc3 termcolor 1.1.0 testpath 0.3.1 Theano 0.9.0 toolz 0.9.0 tornado 4.5.2 tqdm 4.23.4 traitlets 4.3.2 urllib3 1.22 wcwidth 0.1.7 webencodings 0.5.1 Werkzeug 0.14.1 wheel 0.31.1 widgetsnbextension 3.0.2 win-inet-pton 1.0.1 win-unicode-console 0.5 wincertstore 0.2
回答1件
あなたの回答
tips
プレビュー