3

Environment:

  • Windows 10 x64,
  • Node.js v10,
  • @tensorflow/tfjs-node v0.1.15

I'm trying to use tensorflow.js on Node.js.

I installed tfjs-node, and it auto-built successfully (node-gyp), but I receive the following error when running:

tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

The similar question in Python version can be found here:

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

Currently, I don't care about performance, so I just want to disables the warning, don't enable AVX/FMA. In JavaScript, what should I do?

Fuu
  • 165
  • 2
  • 11

2 Answers2

7

Set environment variables before running.

Windows:

$ set TF_CPP_MIN_LOG_LEVEL=2

Linux/MacOS:

$ export TF_CPP_MIN_LOG_LEVEL=2

Fuu
  • 165
  • 2
  • 11
  • 6
    Hmmmm. How does this resolve the issue? Looks like it just prevents logging? – LJD Jul 23 '19 at 04:06
  • @Jude Desir Yes, it just prevents logging. This log seems to be at warning level or lower, just prompting users their program can run faster. So we can avoid its output by adjusting loglevel. – Fuu Jul 24 '19 at 12:35
  • since, i got confused with your statement . i am adding this comment for more clarity on the suggestion made by you to avoid any future confusions. Create a system variable named "TF_CPP_MIN_LOG_LEVEL" and set the variable value as "2" – Shariq Azim May 02 '20 at 14:17
1

First list out the packages (Tensorflow and related) that you have using conda list command.

>> conda list
This command output with below tensorflow version
tblib                     1.3.2            py36h30f5020_0
tensorboard               1.13.1                    <pip>
tensorflow                1.13.1                    <pip>
tensorflow-estimator      1.13.0                    <pip>

Note: I have omitted some of the unwanted listing of packages

Installing collected packages: tensorflow Successfully installed tensorflow-1.13.1
You are using pip version 18.0, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(base) C:\Users\shashi>python
Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:27:44) [MSC v.1900 
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello Tensorflow')
>>> sess = tf.Session()
I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions 
that this TensorFlow binary was not compiled to use: AVX2
>>> import os
>>> import os
>>> os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
>>> hello = tf.constant('Hello Tensorflow')
>>> sess = tf.Session()
>>> print(sess.run(hello))
b'Hello Tensorflow'

After the value of os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' has been set, the code works fine.

If Jupyter also throws error, then close the opened Jupyter notebooks and again re-open them. It will all work fine.

Christos Lytras
  • 36,310
  • 4
  • 80
  • 113
shashi-sop
  • 21
  • 5