NCP-AII Question 119
Select 3You are tasked with deploying a containerized AI workload that requires GPU acceleration on a system equipped with NVIDIA GPUs. Which of the following steps are necessary to ensure the Docker container can access the GPUs?
- A
Install the NVIDIA Container Toolkit on the host system.
- B
Use the
--gpusflag when running the Docker container. - C
Ensure the Docker image includes the NVIDIA GPU driver.
- D
Verify that the NVIDIA drivers are installed on the host system.
- E
Launch the container with the
--device /dev/nvidia0flag.
Show answer and explanation
Correct answers: A, B, D
Explanation
To use NVIDIA GPUs with Docker, it is essential to install the NVIDIA Container Toolkit, which enables GPU support. The --gpus flag is used to allocate GPUs to a container. Additionally, the system hosting the containers must have the correct NVIDIA drivers installed to ensure proper communication between the hardware and software. Including drivers inside the container or manually passing devices via --device is not recommended as the NVIDIA runtime simplifies GPU access.
- A. Correct.
Correct: The NVIDIA Container Toolkit is required to enable Docker to communicate with the NVIDIA GPUs on the host system.
- B. Correct.
Correct: The
--gpusflag specifies how many GPUs the container should use and ensures proper GPU resource allocation. - C. Incorrect.
Incorrect: The NVIDIA GPU driver should be installed on the host system, not inside the Docker image. Instead, the container should use the host's drivers via the NVIDIA runtime.
- D. Correct.
Correct: The NVIDIA drivers must be installed on the host system to enable GPU support for Docker containers.
- E. Incorrect.
Incorrect: While
--device /dev/nvidia0could manually pass GPU devices to the container, it is not the recommended approach for modern NVIDIA GPU-accelerated Docker workflows. The NVIDIA runtime handles this automatically.