Categories
Misc

Tensorflow 2 not respecting thread settings

I am running a tensorflow application that sets inter_op,
intra_op and OMP_NUM_THREADS, however, it completely ignores these
settings and seems to run with the defaults. Here’s how I’m setting
them:

 import tensorflow as tf print('Using Thread Parallelism: {} NUM_INTRA_THREADS, {} NUM_INTER_THREADS, {} OMP_NUM_THREADS'.format(os.environ['NUM_INTRA_THREADS'], os.environ['NUM_INTER_THREADS'], os.environ['OMP_NUM_THREADS'])) session_conf = tf.compat.v1.ConfigProto(inter_op_parallelism_threads=int(os.environ['NUM_INTER_THREADS']), intra_op_parallelism_threads=int(os.environ['NUM_INTRA_THREADS'])) sess = tf.compat.v1.Session(graph=tf.compat.v1.get_default_graph(), config=session_conf) tf.compat.v1.keras.backend.set_session(sess) I have validated that it's reading the right values (the print prints the values as expected). I have also tried with other Tensorflow 2 versions with no success. I am at a loss as to what I'm doing wrong. Version Info: tensorflow 2.2.0 py37_2 intel tensorflow-base 2.2.0 0 intel tensorflow-estimator 2.2.0 pyh208ff02_0 keras 2.4.3 0 keras-base 2.4.3 py_0 keras-preprocessing 1.1.0 py_1 

submitted by /u/dunn_ditty

[visit reddit]

[comments]

Leave a Reply

Your email address will not be published. Required fields are marked *