[~]$ git clone --recurse-submodules https://github.com/tensorflow/tensorflow [~]$ cd tensorflow [~]$ git checkout -b v1.8.0 Switched to a new branch 'v1.8.0'
[~]$ brew install bazel coreutils
[~]$ conda create -n jupyter-env python=3.6 [~]$ conda activate jupyter-env (jupyter-env) [~]$ conda install six numpy wheel mock mkl cython jupyter
(jupyter-env) [~]$ cd Downloads/tensorflow/ (jupyter-env) [~/Downloads/tensorflow]$ bazel clean Starting local Bazel server and connecting to it... ............ INFO: Starting clean. (jupyter-env) [~/Downloads/tensorflow]$ ./configure You have bazel 0.13.0-homebrew installed. Please specify the location of python. [Default is /Users/atsushi/.pyenv/versions/anaconda3-5.1.0/envs/jupyter-env/bin/python]: Please input the desired Python library path to use. Default is [/Users/atsushi/.pyenv/versions/anaconda3-5.1.0/envs/jupyter-env/lib/python3.6/site-packages] Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: Google Cloud Platform support will be enabled for TensorFlow. Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: Hadoop File System support will be enabled for TensorFlow. Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: Amazon S3 File System support will be enabled for TensorFlow. Do you wish to build TensorFlow with Apache Kafka Platform support? [Y/n]: Apache Kafka Platform support will be enabled for TensorFlow. Do you wish to build TensorFlow with XLA JIT support? [y/N]: No XLA JIT support will be enabled for TensorFlow. Do you wish to build TensorFlow with GDR support? [y/N]: No GDR support will be enabled for TensorFlow. Do you wish to build TensorFlow with VERBS support? [y/N]: No VERBS support will be enabled for TensorFlow. Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: No OpenCL SYCL support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: No CUDA support will be enabled for TensorFlow. Do you wish to download a fresh release of clang? (Experimental) [y/N]: Clang will not be downloaded. Do you wish to build TensorFlow with MPI support? [y/N]: No MPI support will be enabled for TensorFlow. Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: Not configuring the WORKSPACE for Android builds. Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See tools/bazel.rc for more details. --config=mkl # Build with MKL support. --config=monolithic # Config for mostly static monolithic build. Configuration finished (jupyter-env) [~/Downloads/tensorflow]$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package ... INFO: Elapsed time: 3206.736s, Critical Path: 139.14s INFO: 8015 processes, local. INFO: Build completed successfully, 8421 total actions (jupyter-env) [~/Downloads/tensorflow]$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
(jupyter-env) [~/Downloads/tensorflow]$ pip install /tmp/tensorflow_pkg/tensorflow-1.8.0-cp36-cp36m-macosx_10_7_x86_64.whl
(jupyter-env) [~/Downloads/tensorflow]$ cd ~ (jupyter-env) [~]$ python Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> hello = tf.constant('Hello Tensorflow!') >>> sess = tf.Session() >>> print(sess.run(hello)) b'Hello Tensorflow!' >>> (jupyter-env) [~]$
/Downloads/tensorflow 下で実行すると
ImportError: Could not import tensorflow. Do not import tensorflow from its source directory; change directory to outside the TensorFlow source tree, and relaunch your Python interpreter from there.と言うエラーがでる
(jupyter-env) [~]$ rm -rf ~/Downloads/tensorflow/しても、ちゃんと import tensorflow as tf は動く
(jupyter-env) [~]$ pip install kerasanaconda の keras をインストールすると、tensorflow 1.1.0 もインストールされてしまうので、pip でインストールする
(jupyter-env) [~]$ cd Downloads/ (jupyter-env) [~/Downloads]$ git clone https://github.com/keras-team/keras.git (jupyter-env) [~/Downloads]$ cd keras/examples/ (jupyter-env) [~/Downloads/keras/examples]$ python ./mnist_cnn.py Using TensorFlow backend. x_train shape: (60000, 28, 28, 1) 60000 train samples 10000 test samples Train on 60000 samples, validate on 10000 samples Epoch 1/12 60000/60000 [==============================] - 74s 1ms/step - loss: 0.2666 - acc: 0.9179 - val_loss: 0.0611 - val_acc: 0.9806 Epoch 2/12 60000/60000 [==============================] - 73s 1ms/step - loss: 0.0928 - acc: 0.9723 - val_loss: 0.0445 - val_acc: 0.9857 Epoch 3/12 60000/60000 [==============================] - 73s 1ms/step - loss: 0.0689 - acc: 0.9793 - val_loss: 0.0344 - val_acc: 0.9888 Epoch 4/12 60000/60000 [==============================] - 73s 1ms/step - loss: 0.0578 - acc: 0.9830 - val_loss: 0.0342 - val_acc: 0.9891 Epoch 5/12 60000/60000 [==============================] - 73s 1ms/step - loss: 0.0497 - acc: 0.9850 - val_loss: 0.0306 - val_acc: 0.9904 Epoch 6/12 60000/60000 [==============================] - 73s 1ms/step - loss: 0.0446 - acc: 0.9869 - val_loss: 0.0285 - val_acc: 0.9910 Epoch 7/12 60000/60000 [==============================] - 72s 1ms/step - loss: 0.0389 - acc: 0.9886 - val_loss: 0.0290 - val_acc: 0.9911 Epoch 8/12 60000/60000 [==============================] - 71s 1ms/step - loss: 0.0373 - acc: 0.9891 - val_loss: 0.0270 - val_acc: 0.9915 Epoch 9/12 60000/60000 [==============================] - 71s 1ms/step - loss: 0.0324 - acc: 0.9901 - val_loss: 0.0271 - val_acc: 0.9921 Epoch 10/12 60000/60000 [==============================] - 71s 1ms/step - loss: 0.0316 - acc: 0.9910 - val_loss: 0.0293 - val_acc: 0.9905 Epoch 11/12 60000/60000 [==============================] - 71s 1ms/step - loss: 0.0289 - acc: 0.9910 - val_loss: 0.0288 - val_acc: 0.9908 Epoch 12/12 60000/60000 [==============================] - 71s 1ms/step - loss: 0.0281 - acc: 0.9911 - val_loss: 0.0289 - val_acc: 0.9924 Test loss: 0.02892806054859666 Test accuracy: 0.9924 (jupyter-env) [~/Downloads/keras/examples]$ keras --version -bash: keras: command not found (jupyter-env) [~/Downloads/keras/examples]$
initial cost | running cost | EN1070K ÷ running cost | ||
Nvidia Jetson TX2 | JPY 100,000 | JPY 100/month | 7days/month利用 | |
ZOTAC ZBOX-EN1070K | JPY 154,285 | JPY 2,000/month | 7days/month利用 | |
ZOTAC ZBOX-EK71080-U | JPY 227,830 | JPY 3,000/month | 7days/month利用 | |
Google Cloud | JPY 30,800/month | 5.4 months | TESLA K80, 7days/month利用 | |
Fujitsu K5 Zinrai | JPY 42,000/month | 3.9 months | TESLA P100, 専有 | |
Amazon AWS | JPY 49,280/month | 3.3 months | TESLA K80, 7days/month利用 | |
Microsoft Azure | JPY 10,752/month | 17.6 months | TESLA K80, 7days/month利用 |
2007 | Tesla |
2009 | Fermi |
2012 | Kepler |
2014 | Maxwell |
2016 | Pascal |
2017 | Volta (未出荷) |