2015-11-12 7 views
7

だからセッション設定プロトはコメントで、device_filtersオプションがあります。TensorFlowのデバイスフィルタのフォーマットは何ですか?

// When any filters are present sessions will ignore all devices which do not 
    // match the filters. Each filter can be partially specified, e.g. "/job:ps" 
    // "/job:worker/replica:3", etc. 

誰もがフォーマットの具体的な説明を持っていますか?たとえば、他のモデルを実行するために使用するため、/ gpu:0をオプションとして除外したいとします。

私は

config = tf.ConfigProto() 
config.device_filters.append('/gpu:1') 
config.device_filters.append('/cpu:0') 
with tf.Session(config=config): 
    # Do stuff 

を試みた。しかし、私はまだ私があたり-OP基づいてデバイスを無効にしたくない、GPU 0に割り当てられたOPSを取得しています。

答えて

3

フィールドは現在、TensorFlowによって無視されていますが、今後このユースケースをサポートすることを意図しています。このメカニズムの実装のための任意のタイムラインを

with tf.device("/gpu:1"): 
    # Build your model in this with context. All nodes will get the 
    # device "/gpu:1". 

with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)): 
    # Execute your mode in this with context. 
    # Soft placement will use /gpu:1 for GPU-compatible ops, and /cpu:0 
    # for CPU-only ops. 
+0

:あなたは/gpu:1/cpu:0上でOPSを実行しているのと同じ目的を達成したい場合は、「ソフトな配置」を使用して、次のようにそれを行うことができますか?一般的な使用事例は、マルチGPU設定(つまり 'train 'と' eval 'ジョブ)のGPUの一つにすべてを割り当てることです – MZHm

+1

これはDistributed TensorFlow用に実装されているので、' tf.train .Server'を実行してから 'tf.Session'をそのサーバに接続すると、このオプションを使うことができます。代わりに、['tf.ConfigProto.gpu_options.visible_device_list'](https://github.com/tensorflow/tensorflow/blob/4b136d9fc4de0a53c17e336965f8884fd36168a8/tensorflow/core/protobuf/config.proto#L42)オプションを使用して'tf.Session'は(ローカル)GPUのサブセットのみを使用します。 – mrry

関連する問題