Fra*_*urt 27
要在一个CPU线程上运行Tensorflow,我使用:
session_conf = tf.ConfigProto(
intra_op_parallelism_threads=1,
inter_op_parallelism_threads=1)
sess = tf.Session(config=session_conf)
Run Code Online (Sandbox Code Playgroud)
device_count
限制使用的CPU数量,而不是核心或线程数量.
tensorflow/tensorflow/core/protobuf/config.proto
说:
message ConfigProto {
// Map from device type name (e.g., "CPU" or "GPU" ) to maximum
// number of devices of that type to use. If a particular device
// type is not found in the map, the system picks an appropriate
// number.
map<string, int32> device_count = 1;
Run Code Online (Sandbox Code Playgroud)
在Linux上,您可以运行sudo dmidecode -t 4 | egrep -i "Designation|Intel|core|thread"
以查看您拥有多少CPU /核心/线程,例如,以下有2个CPU,每个CPU有8个核心,每个核心有2个线程,总共2*8*2 = 32主题:
fra@s:~$ sudo dmidecode -t 4 | egrep -i "Designation|Intel|core|thread"
Socket Designation: CPU1
Manufacturer: Intel
HTT (Multi-threading)
Version: Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz
Core Count: 8
Core Enabled: 8
Thread Count: 16
Multi-Core
Hardware Thread
Socket Designation: CPU2
Manufacturer: Intel
HTT (Multi-threading)
Version: Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz
Core Count: 8
Core Enabled: 8
Thread Count: 16
Multi-Core
Hardware Thread
Run Code Online (Sandbox Code Playgroud)
使用Tensorflow 0.12.1和1.0.0使用Ubuntu 14.04.5 LTS x64和Ubuntu 16.04 LTS x64进行测试.
归档时间: |
|
查看次数: |
15654 次 |
最近记录: |