apple / tensorflow_macos

TensorFlow for macOS 11.0+ accelerated using Apple's ML Compute framework.
Other
3.67k stars 308 forks source link

Warning on MacBook Pro (16-inch, 2019) #60

Open emyr666 opened 3 years ago

emyr666 commented 3 years ago

Hi, I have a MacBook Pro (16-inch, 2019). I installed python 3.8.6 using homebrew and created a venv for it. I installed this following the instructions on the readme :

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download_and_install.sh)"

I then followed the instructions here to test it :

https://www.tensorflow.org/tutorials/quickstart/beginner

I see the following :

$ python Python 3.8.6 (default, Nov 20 2020, 23:57:10) [Clang 12.0.0 (clang-1200.0.32.27)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf mnist = tf.keras.datasets.mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz 11493376/11490434 [==============================] - 0s 0us/step x_train, x_test = x_train / 255.0, x_test / 255.0 model = tf.keras.models.Sequential([ ... tf.keras.layers.Flatten(input_shape=(28, 28)), ... tf.keras.layers.Dense(128, activation='relu'), ... tf.keras.layers.Dropout(0.2), ... tf.keras.layers.Dense(10) ... ]) 2020-12-09 22:02:50.908459: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE4.2 AVX AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

Is it possible to fix the issue picked up by this warning i.e. building TensorFlow with the appropriate flags so that all operations, not just performance critical ones use the extended CPU instructions ?

emyr666 commented 3 years ago

I installed this again into a completely fresh mac. Tensorflow does not report that the GPU is available:

Python 3.8.6 (default, Nov 20 2020, 23:57:10) [Clang 12.0.0 (clang-1200.0.32.27)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf

print(tf.config.list_physical_devices('GPU')) []

anna-tikhonova commented 3 years ago

Is it possible to fix the issue picked up by this warning i.e. building TensorFlow with the appropriate flags so that all operations, not just performance critical ones use the extended CPU instructions ?

Thank you for reporting this. These warning messages come from TensorFlow and we have no control over them.

anna-tikhonova commented 3 years ago

I installed this again into a completely fresh mac. Tensorflow does not report that the GPU is available:

Python 3.8.6 (default, Nov 20 2020, 23:57:10) [Clang 12.0.0 (clang-1200.0.32.27)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf print(tf.config.list_physical_devices('GPU')) []

There is an optional mlcompute.set_mlc_device(device_name=’any') API for ML Compute device selection. The default value for device_name is 'any’, which means ML Compute will select the best available device on your system, including multiple GPUs on multi-GPU configurations. Other available options are ‘cpu’ and ‘gpu’. Please see the Device Selection and the Logging and Debugging sections of the README for more information and let us know if you have any additional questions.