如何使用一个GPU
To call `multi_gpu_model` with `gpus=2`, we expect the following devices to be available: ['/cpu:0', '/gpu:0', '/gpu:1']. However this machine only has: ['/cpu:0']. Try reducing `gpus
ValueError: To call `multi_gpu_model` with `gpus=2`, we expect the following devices to be available: ['/cpu:0', '/gpu:0', '/gpu:1']. However this machine only has: ['/cpu:0']. Try reducing `gpus`.
4
It looks like Keras only sees one of the GPUs.
Make sure that all 4 GPUs are accessible, you can use device_lib
with TensorFlow.
from tensorflow.python.client import device_lib
def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU']
You might need to manually install or update GPU drivers on your instance. Consult here.
https://stackoverflow.com/questions/52950449/valueerror-when-using-multi-gpu-model-in-keras