Windows10の WSL Ubuntu で docker – TensorFlowを稼働させる

だいぶはまったのでメモ。

tensorflow は前提環境が色々面倒なためdockerを利用したが、これでも準備が結構はまった。

dockerは wsl ubuntu 上で最新は動かない。service docker start で 起動しない。リンク先情報をもとに(ありがとうございます)18.03.1をインストール。ちなみにwsl ubuntu は管理者権限で起動。

sudo apt-get install docker-ce=18.03.1~ce~3-0~ubuntu

tensorflow も最新はwsl ubuntuで動かない。リンク先情報(ありがとうございます)を参考に、こちらは dockerの1.5.0 を直接ダウンロード。 こちらもwsl ubuntu は管理者権限で起動。 警告は出るが動くようになった。

#docker pull tensorflow/tensorflow:1.5.0

~$ sudo docker run -it tensorflow/tensorflow:1.5.0 bash
root@5f6184b8df5c:/notebooks# python2
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import tensorflow as tf
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
>>> hello=tf.constant('hello,shioshio!')
>>> sess=tf.Session()
2019-06-25 14:07:28.640357: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2
>>> print(sess.run(hello))
hello,shioshio!
>>> 

ちなみにtensorflow 1.5.x以降は 下記のようにcore dumpして落ちる。 前世代Intel core-ix CPUが未対応なためらしい。 試した限りでは1.5.0はOK,1.5.1はNG

>>import tensorflow as tf
Illegal instruction (core dumped) 

これからだが、CPU命令も活用していないし、GPUも現環境は未対応だし、遅そうだ。。

コメントを残す

メールアドレスが公開されることはありません。

CAPTCHA