关于使用系统的问题.
最好使用ubuntu安装TensorFlow而不是Win10?
性能:性能对比到底有多大的问题!
GTX1070在win10 64与ubuntu 18.04.2
运行矩阵运算速度测试-同一台电脑,CUDA10.0,驱动430.26,cuDNN为对应版本最近!
时间上误差极小:8.14 V S8.57
,结果是ubuntu下,居然不如win10.
TensorFlow版本为:1.14。
config=tf.ConfigProto(allow_soft_placement=True,log_device_placement=True)
是否建议使用Docker来进行运行对应的代码.
Docker很火,很多人都喜欢拿来跑深度,性能到底怎么样?
window下的docker的性能远远的低于ubuntu下docker的性能,那么到底差距多少?
直接结论:
- window10 64下,基于系统的问题性能不容乐观,大概也就80%不到!
- ubuntu18.04.2LTS下 几乎没有 太大区别,大概是同一代码时间花费为:
host VS docker = 54:56
。
tensorflow版本的问题.
我很负责任的说:tensorflow1.14的运算上不如tensorflow1.8版本!
时间为:8.57 VS 6.19
- 测试所用代码.
import sys import numpy as np import tensorflow as tf from datetime import datetime config = tf.ConfigProto(allow_soft_placement=False) device_name = sys.argv[1] # Choose device from cmd line. Options: gpu or cpu shape = (int(sys.argv[2]), int(sys.argv[2])) if device_name == "gpu": device_name = "/gpu:0" else: device_name = "/cpu:0" with tf.device(device_name): random_matrix = tf.random_uniform(shape=shape, minval=0, maxval=1) dot_operation = tf.matmul(random_matrix, tf.transpose(random_matrix)) sum_operation = tf.reduce_sum(dot_operation) startTime = datetime.now() with tf.Session(config=config) as session: result = 0.0 for i in range(1000): result += session.run(sum_operation) print(result) # It can be hard to see the results on the terminal with lots of output -- add some newlines to improve readability. print("\n" * 3) print("Shape:", shape, "Device:", device_name) print("Time taken:", str(datetime.now() - startTime)) """ # use: python this.py gpu 10000 """