Skip To Content

Configure ArcGIS Notebook Server to use GPUs

The use of graphical processing units (GPUs) rapidly improves the processing time for machine learning models. ArcGIS Notebook Server can take advantage of NVIDIA GPUs on its host machine once some additional steps are performed.

Once ArcGIS Notebook Server has been installed and configured, follow these steps using the same machine.

  1. Install the appropriate NVIDIA drivers on the machine. See the NVIDIA website for complete information.
  2. Install the nvidia-docker 2.0 runtime on the machine so that notebook containers can take advantage of GPUs. Refer to the NVIDIA-Docker repository on GitHub for the downloads and documentation pertaining to your specific OS.
  3. Run the following command to ensure your NVIDIA elements are properly installed:

    docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi

  4. Extend the Advanced notebook runtime in a Dockerfile to set the following environment variables, enabling NVIDIA Container Runtime for GPU-accelerated containers.

    # Specify the existing notebook runtime imageId as FROM
    FROM aa7a1a346e5b
    
    # Use RUN to issue a command to install
    # Declare environment variables with ENV
    #RUN conda install <your_preferred_gpu_package>
    ENV NVIDIA_VISIBLE_DEVICES all
    ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
    ENV NVIDIA_REQUIRE_CUDA "cuda>=9.2"

    You may also decide to install other Python modules that can take advantage of GPU support. Follow the steps in Extend a notebook runtime to build a Dockerfile.
  5. Build your custom container image using the following command syntax:

    docker build -t myGpuRuntime:v1.0 -f <path_to_Dockerfile> .
    Ensure you include the period at the end of the command.

  6. When the image build is complete, an output message will deliver the abridged imageId of the new image. Get the full imageId of your new container.

    docker inspect <imageId>

  7. Log in to the ArcGIS Notebook Server Administrator Directory at https://notebookserver.domain.com:11443/arcgis/admin. Navigate to notebooks > runtimes, and select the Advanced runtime, then click edit.
  8. Update the Advanced runtime to use your new custom image. Replace the existing imageId value with the value for your image, which you obtained in step 6.
  9. Set the dockerRuntime value to be nvidia. Save your edits.
  10. Verify you have successfully configured ArcGIS Notebook Server to use NVIDIA GPUs. As a portal member with the Advanced Notebooks privilege, open a new notebook. Copy the following into a cell and run the cell.

    import torch
    torch.cuda.is_available()
    The output should return as True, because the torch.cuda package requires GPUs to run.

  11. Run the following command in a new cell to view your machine's GPU configuration:

    !nvidia-smi

If you ever want to remove the capacity for your ArcGIS Notebook Server site to use GPUs, run the Restore Factory Runtimes operation in the Administrator Directory. This is available at the URL https://notebookserver.domain.com:11443/arcgis/admin/notebooks/runtimes/restore.