The problem

The problem is very simple, deploy algorithm service in docker, use CPU+tensorflow for model calculation, tensorflow1.14,docker mirror python3.7

The following two errors will be reported

Allocation of XXXXXXXX exceeds 10% of system memory
Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_globa
Copy the code

The Allocation error can be controlled by reducing the BATch_size, but since my batch_size is already small and a large amount of memory can be manipulated, it is not a cause for the error.

There is a post on StackOverflow for error # 2. stackoverflow

Setting TF_XLA_FLAGS to TF_XLA_ENABLE_xLA_devices can speed up Linux CPU TensorFlow, but this parameter is limited to TensorFlow1.

export TF_XLA_FLAGS=--tf_xla_enable_xla_devices

Test effective!

Tensflow: XLA: Tensflow