NVIDIA Optimized Frameworks
NVIDIA Optimized Frameworks (Latest Release) Download PDF

Running Microsoft Cognitive Toolkit


Before you can run an NGC deep learning framework container, your Docker environment must support NVIDIA GPUs. To run a container, issue the appropriate command as explained in the Running A Container chapter in the NVIDIA Containers And Frameworks User Guide and specify the registry, repository, and tags.
On a system with GPU support for NGC containers, the following occurs when running a container:

  • The Docker engine loads the image into a container which runs the software.
  • You define the runtime resources of the container by including additional flags and settings that are used with the command. These flags and settings are described in Running A Container.
  • The GPUs are explicitly defined for the Docker container (defaults to all GPUs, can be specified using NV_GPU environment variable).

The method implemented in your system depends on the DGX OS version installed (for DGX systems), the specific NGC Cloud Image provided by a Cloud Service Provider, or the software that you have installed in preparation for running NGC containers on TITAN PCs, Quadro PCs, or vGPUs.

  1. Issue the command for the applicable release of the container that you want. The following command assumes you want to pull the latest container.
    Copy
    Copied!
                

    docker pull nvcr.io/nvidia/cntk:18.08

  2. Open a command prompt and paste the pull command. The pulling of the container image begins. Ensure the pull completes successfully before proceeding to the next step.
  3. Run the container image. A typical command to launch the container is:
    Copy
    Copied!
                

    docker run --gpus all -it --rm -v local_dir:container_dir nvcr.io/nvidia/cntk:<xx.xx>

    1. When running on a single GPU, the Microsoft Cognitive Toolkit can be invoked using a command similar to the following:
      Copy
      Copied!
                  

      cntk configFile=myscript.cntk ...

    2. When running on multiple GPUs, run the Microsoft Cognitive Toolkit through MPI. The following example uses 4 GPUs, numbered 0..3, for training:
      Copy
      Copied!
                  

      export OMP_NUM_THREADS=10 export CUDA_DEVICE_ORDER=PCI_BUS_ID export CUDA_VISIBLE_DEVICES=0,1,2,3 mpirun --allow-run-as-root --oversubscribe --npernode 4 \ -x OMP_NUM_THREADS -x CUDA_DEVICE_ORDER -x CUDA_VISIBLE_DEVICES \ cntk configFile=myscript.cntk ...

    3. When running with all 8 GPUs together, it is even more simple:
      Copy
      Copied!
                  

      export OMP_NUM_THREADS=10 mpirun --allow-run-as-root --oversubscribe --npernode 8 \ -x OMP_NUM_THREADS cntk configFile=myscript.cntk ...

      Note:

      Note: You can vary the number of GPUs with the option --npernode X where X is the number of GPUs. For the DGX-1™ this is a maximum of 8 GPUs per node. For the DGX Station™ it is a maximum of 4 GPUs. For NVIDIA® GPU Cloud™ (NGC) the number of GPUs depends upon the instance type that you have selected.

    You might want to pull in data and model descriptions from locations outside the container for use by Microsoft Cognitive Toolkit or save results to locations outside the container. To accomplish this, the easiest method is to mount one or more host directories as Docker data volumes.

    Note:

    Note: In order to share data between ranks, NVIDIA® Collective Communications Library ™ (NCCL) may require shared system memory for IPC and pinned (page-locked) system memory resources. The operating system’s limits on these resources may need to be increased accordingly. Refer to your system’s documentation for details. In particular, Docker® containers default to limited shared and pinned memory resources. When using NCCL inside a container, it is recommended that you increase these resources by issuing:

    Copy
    Copied!
                

    --shm-size=1g --ulimit memlock=-1

    in the command line to:

    Copy
    Copied!
                

    docker run --gpus all


© Copyright 2024, NVIDIA. Last updated on Jan 27, 2020.