0

I am trying to run tensorflow 1.13.1 with Python 2.7 on SLF 6 without GPU support. When I start my model, tensorflow appears to be spawning multiple subprocesses and running my model in parallel, trying to load every core in the system. While in most cases this is what one would probably want, this is not my case. I would like to run my model on single core only.

I have tried setting these variables:

export OMP_NUM_THREADS=1
export KMP_BLOCKTIME=0
export KMP_AFFINITY=granularity=fine,verbose,compact,1,0

in different combinations, but was not able to achieve single-core running.

Is there a way to run Tensorflow in "dumb" single-process mode ?

igorvm
  • 46
  • 6

1 Answers1

0

There are two configurable options regarding parallelism inter_op_parallelism_threads and intra_op_parallelism_threads in the tf.ConfigProto protocol buffer. To use a single process, I think you can try:

import tensorflow as tf
config = tf.ConfigProto(intra_op_parallelism_threads=1, 
                        inter_op_parallelism_threads=1, 
                        allow_soft_placement=True)

There are other possible forms of parallelism, see mrry@ 's answer is this thread.

greeness
  • 15,956
  • 5
  • 50
  • 80