Challenge - 5 Problems
GPU Setup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding GPU availability in TensorFlow
Which TensorFlow command correctly checks if a GPU is available for use?
Attempts:
2 left
💡 Hint
Look for the TensorFlow function that lists physical devices.
✗ Incorrect
The function tf.config.list_physical_devices('GPU') returns a list of available GPU devices. If the list is empty, no GPU is available.
❓ Predict Output
intermediate2:00remaining
Output of TensorFlow GPU memory growth setting
What is the output of this code snippet when run on a system with one GPU?
TensorFlow
import tensorflow as tf gpus = tf.config.list_physical_devices('GPU') if gpus: try: for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) print('Memory growth set') except RuntimeError as e: print(e) else: print('No GPU found')
Attempts:
2 left
💡 Hint
If a GPU is present and memory growth is set before initialization, it prints confirmation.
✗ Incorrect
The code sets memory growth on all GPUs before TensorFlow initializes them, so it prints 'Memory growth set'.
❓ Model Choice
advanced2:00remaining
Choosing the correct TensorFlow version for GPU support
Which TensorFlow version is required to support GPU acceleration on CUDA 11.2?
Attempts:
2 left
💡 Hint
Check TensorFlow release notes for CUDA compatibility.
✗ Incorrect
TensorFlow 2.5 added support for CUDA 11.2, earlier versions do not support it.
❓ Hyperparameter
advanced2:00remaining
Setting GPU device in TensorFlow
Which code snippet correctly sets TensorFlow to use only the first GPU device?
Attempts:
2 left
💡 Hint
The function expects a list of devices, not a single device.
✗ Incorrect
tf.config.set_visible_devices expects a list of physical devices to set visibility. Passing a single device without list causes error.
🔧 Debug
expert2:00remaining
Diagnosing TensorFlow GPU memory allocation error
Given this error message when running TensorFlow code on GPU: "ResourceExhaustedError: OOM when allocating tensor", what is the most likely cause?
Attempts:
2 left
💡 Hint
OOM means out of memory on the GPU device.
✗ Incorrect
ResourceExhaustedError with OOM indicates the GPU memory is insufficient for the requested tensor allocation, often due to large batch size or model.