NOTE: This is a cross-post from an issue filed here: https://github.com/tensorflow/tensorflow/issues/56837
I'm developing on a system with a single GPU (Apple M1 Pro) and trying to simulate multiple GPUs with virtual devices.
Using the examples found here: https://www.tensorflow.org/guide/gpu#using_multiple_gpus I get the following output:
systemMemory: 32.00 GB
maxCacheSize: 10.67 GB
1 Physical GPU, 1 Logical GPUs
where I was expecting the Logical GPUs to be greater than the Physical GPU count.
I have tested tf.config.set_logical_device_configuration for increasing Logical device count for CPUs, and this indeed does work for CPU virtualisation.
Standalone code to reproduce the issue
Taken from the code snippet found at: https://www.tensorflow.org/guide/gpu#using_multiple_gpus
gpus = tf.config.list_physical_devices("GPU")
if gpus:
# Create 2 virtual GPUs with 1GB memory each
try:
tf.config.set_logical_device_configuration(
gpus[0],
[
tf.config.LogicalDeviceConfiguration(memory_limit=1024),
tf.config.LogicalDeviceConfiguration(memory_limit=1024),
],
)
logical_gpus = tf.config.list_logical_devices("GPU")
print(len(gpus), "Physical GPU,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Virtual devices must be set before GPUs have been initialized
print(e)
Relevant log output
1 Physical GPU, 1 Logical GPUs
Tensorflow Version
tensorflow-macos v2.8.0 tensorflow-metal v0.5.0
OS Platform and Distribution
macOS-12.2.1
Python version
3.8
Followup
Unfortunately I do not have access to a Windows machine for testing, but I wonder if it's a problem
with tensorflow-macos / tensorflow-metal specifically. Is this repo still the best place to log
such an issue?
I tried again locally on macOS and bumped versions of tensorflow-macos to be:
tensorflow-macos 2.9.2
tensorflow-metal 0.5.0
and used Python 3.9, but still same problem as reported before, i.e.
1 Physical GPU, 1 Logical GPUs