Open JunMa11 opened 2 years ago
Face the same issue here. Adding the following code solves the problem for me.
gpus = tf.config.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.list_logical_devices('GPU')
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
except RuntimeError as e:
# Memory growth must be set before GPUs have been initialized
print(e)
Face the same issue here. Adding the following code solves the problem for me.
gpus = tf.config.list_physical_devices('GPU') if gpus: try: # Currently, memory growth needs to be the same across GPUs for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) logical_gpus = tf.config.list_logical_devices('GPU') print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs") except RuntimeError as e: # Memory growth must be set before GPUs have been initialized print(e)
Thanks, it worked for me. FYI, I'm using 4 RTX 3090 (24 G) with batch size 28 (7 samples per GPU), and 128 x 128 images.
Dear @yang-song ,
Thanks for the great work.
I'm always running into OOM error even if reducing the batch size to 2. This is the command that I run:
and the error information
How should I train the model on single GPU (NVIDIA V100 32G)?
Best regards, Jun