2017-12-06 19 views
0

私はウェブサイトをチェックしましたが、いつものように私にとっては明らかではありませんでした。誰もがGPU上でテンソルフロープログラムを実行するためのすべてのステップを(最初から)記述できますか? Tensorflow公式サイトから複数のGPUでTensorflowを実行しています

答えて

1

https://www.tensorflow.org/tutorials/using_gpu

# Creates a graph. 
c = [] 
for d in ['/device:GPU:2', '/device:GPU:3']: 
    with tf.device(d): 
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3]) 
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2]) 
    c.append(tf.matmul(a, b)) 
with tf.device('/cpu:0'): 
    sum = tf.add_n(c) 
# Creates a session with log_device_placement set to True. 
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) 
# Runs the op. 
print(sess.run(sum)) 
関連する問題