installation
This uses the Pip to install the TensorFlow CPU version
$ sudo pip install HTTPS://STORAGE.GOOGLEAPIS.COM/TENSORFLOW/LINUX/CPU/TENSORFLOW-0.5.0-CP27-NONE-LINUX_X86_64.WHL
Check the success of the installation with handwriting recognition examples from the runtime when the installation is complete
$ cd/usr/lib/python2.7/site-packages/tensorflow/models/image/mnist
$ python convolutional.py
...
or run
$ python-m tensorflow.models.image.mnist.convolutional ...
Limit number of CPUs
For the handwriting recognition examples used above, you need to modify the file/usr/lib/python2.7/site-packages/tensorflow/models/image/mnist/convolutional.py to create Session section
Modify the front with
TF. Session (Config=config) as S:
modified
cpu_num = Int (os.environ.get (' Cpu_num ', 1))
config = tf. Configproto (device_count={"CPU": Cpu_num},
inter_op_parallelism_threads = cpu_num,
intra_op_parallelism_ Threads = Cpu_num,
log_device_placement=true) with
TF. Session (Config=config) as S:
After the modification is complete, use the environment variable cpu_num to specify the number of CPUs you want to use, and then run the handwriting recognition example again
$ export cpu_num=2
$ python-m tensorflow.models.image.mnist.convolutional
After running, use the top command to view the program's CPU usage.