Tensorflow:使用CPU的特定内核执行操作 [英] Tensorflow: executing an ops with a specific core of a CPU
本文介绍了Tensorflow:使用CPU的特定内核执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前可以指定哪个CPU或GPU与特定操作的tf.device(...)函数一起使用,但无论如何,您可以指定CPU的核心 ?
解决方案
目前没有针对特定内核锁定操作的API,虽然这会使功能请求。您可以通过创建多个CPU设备来接近此功能,每个设备都有一个单线程线程池,但这并不保证能够维持核心固定解决方案的位置:
<$ (/ cpu:4):
#...
with tf.device(/ cpu:7 ):
#...
with tf.device(/ cpu:0):
#...
config = tf .ConfigProto(device_count = {CPU:8},
inter_op_parallelism_threads = 1,
intra_op_parallelism_threads = 1)
sess = tf.Session(config = config)
It is currently possible to specify which CPU or GPU to use with the tf.device(...) function for specific ops, but is there anyway where you can specify a core of a CPU?
解决方案
There's no API for pinning ops to a particular core at present, though this would make a good feature request. You could approximate this functionality by creating multiple CPU devices, each with a single-threaded threadpool, but this isn't guaranteed to maintain the locality of a core-pinning solution:
with tf.device("/cpu:4"):
# ...
with tf.device("/cpu:7"):
# ...
with tf.device("/cpu:0"):
# ...
config = tf.ConfigProto(device_count={"CPU": 8},
inter_op_parallelism_threads=1,
intra_op_parallelism_threads=1)
sess = tf.Session(config=config)
这篇关于Tensorflow:使用CPU的特定内核执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文