Menu Close

How to run TensorFlow on CPU stack overflow?

How to run TensorFlow on CPU stack overflow?

Suppose you are on a system with 4 GPUs and you want to use only two GPUs, the one with id = 0 and the one with id = 2, then the first command of your code, immediately after importing the libraries, would be:

Why does TensorFlow error go away after downgrading?

After downgrading to an older version of tensorflow the error goes away. I’ve been advised that my CPU (see information above) might not work with some improvements in the new API.

Why does matmul run once per core in TensorFlow?

The program calls matmul once per core (i.e. weak scaling). I would expect that as the number of cores increases, the running time would stay roughly constant. Instead the running time seems to increase linearly with the core count, indicating that the matmul ops are running sequentially, not in parallel.

Is there a way to run AVX instructions on TensorFlow?

The solution would be for a build of tensorflow (-gpu) that is not compiled with AVX instructions to be published (or to build a copy locally). The provided installation instructions do not mention any specific CPU requirements nor how to determine compatibility with the provided binaries.

Is it possible to use multiple CPU cores in TensorFlow?

OS Platform and Distribution: Ubuntu 16.04.5 TensorFlow installed from: binary, from tensorflow PyPI package via pip (also tried from conda with same result) TensorFlow version: v1.11.0-0-gc19e29306c 1.11.0 I am unable to configure TensorFlow to use multiple CPU cores for inter-op parallelism on my machine.

How does runtime affect the performance of TensorFlow?

Runtime settings can greatly affect the performance of TensorFlow* workloads running on CPUs, particularly regarding threading. OpenMP* and TensorFlow both have settings that should be considered for their effect on performance.

The program calls matmul once per core (i.e. weak scaling). I would expect that as the number of cores increases, the running time would stay roughly constant. Instead the running time seems to increase linearly with the core count, indicating that the matmul ops are running sequentially, not in parallel.

What is the configproto class in TensorFlow?

TensorFlow has a class (ConfigProto or config depeding on version) with settings that affect performance. This guide will describe the settings, usage and how to apply the them.

What should CUDA visible devices be in TensorFlow?

For me, only setting CUDA_VISIBLE_DEVICES to precisely -1 works: The environment variable solution doesn’t work for me running tensorflow 2.3.1. I assume by the comments in the github thread that the below solution works for versions >=2.1.0.

Why does my matmul program run in parallel?

Instead the running time seems to increase linearly with the core count, indicating that the matmul ops are running sequentially, not in parallel. I have also confirmed via htop that there is only one core on my CPU that is in use when the program is running.

Can you run TensorFlow on both CPU and GPU?

If a TensorFlow operation has both CPU and GPU implementations, TensorFlow will automatically place the operation to run on a GPU device first.

How is TensorFlow runtime optimizations for CPUs?

The Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) within the Intel® Optimization for TensorFlow* uses OpenMP settings as environment variables to affect performance on Intel CPUs. TensorFlow has a class (ConfigProto or config depeding on version) with settings that affect performance.

How does TensorFlow run multiple copies of a model?

We run multiple copies of the model (called towers). Each tower is assigned to a GPU. Each GPU is responsible for a batch of data. By default, TensorFlow requests nearly all of the GPU memory of all GPUs to avoid memory fragmentation (since GPU has much less memory, it is more vulnerable to fragmentation).

How does OpenMP affect the performance of TensorFlow?

OpenMP* and TensorFlow both have settings that should be considered for their effect on performance. The Intel® Math Kernel Library for Deep Neural Networks (Intel® MKL-DNN) within the Intel® Optimization for TensorFlow* uses OpenMP settings as environment variables to affect performance on Intel CPUs.