Tensorflow 2.9.1 shows only one CPU available

Viewed 21

I found this little code on SO and ran on my Ubuntu 22.04 VM:

import tensorflow as tf
from tensorflow.python.client import device_lib

print(tf.version.VERSION)

local_device_protos = device_lib.list_local_devices()
print([x.name for x in local_device_protos if x.device_type == 'CPU'])

output:

2.9.1
['/device:CPU:0']

I was suspicious abt how little CPU my TF code uses. Now I see why. Question why just one? I have 20 CPU allocated for this VM and htop shows all of them. But when I run Jupyter notebook with TF code max usage is 160%

Any ideas how to investigate it?

0 Answers
Related