Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-8820 [Umbrella] GPU support on YARN - Phase 2
  3. YARN-8821

[YARN-8851] GPU hierarchy/topology scheduling support based on pluggable device framework

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0
    • Component/s: None
    • Labels:
    • Hadoop Flags:



      GPU topology affects performance. There's been a discussion in YARN-7481. But we'd like to move related discussions here.

      And please note that YARN-8851 will provide a pluggable device framework which can support plugin custom scheduler. Based on the framework, GPU plugin could have own topology scheduler.

      Details of the proposed scheduling algorithm

      The proposed patch has a topology algorithm implemented as below:
      Step 1. When allocating devices, parse the output of "nvidia-smi topo -m" to build a hash map whose key is all pairs of GPUs and the value is the communication cost between the two. The map is like {"0 - 1"=> 2, "0 - 2"=>4, ...} which means the minimum cost of GPU 0 to 1 is 2. The cost is set based on the connection type.

      Step 2. And then it constructs a cost table which caches all combinations of GPUs and corresponding cost between them and cache it. The cost table is a map whose structure is like

      { 2=>{[0,1]=>2,..},

      The key of the map is the count of GPUs, the value of it is a map whose key is the combination of GPUs and the value is the calculated communication cost of the numbers of GPUs. The cost calculation algorithm is to sum all non-duplicate pairs of GPU's cost. For instance, the total cost of [0,1,2] GPUs are the sum of cost "0 - 1", "0 - 2" and "1 - 2". And each cost can get from the map built in step 1.

      Step 3. After the cost table is built, when allocating GPUs based on topology, we provide two policy which container can set through an environment variable "NVIDIA_TOPO_POLICY". The value can be either "PACK" or "SPREAD". The "PACK" means it prefers faster GPU-GPU communication. The "SPREAD" means it prefers faster CPU-GPU communication( since GPUs are not using the same bus to CPU). And the key difference of the two policy is the sort order of the inner map in the cost table. For instance, let's assume 2 GPUs is wanted. The costTable.get(2) would return a map containing all combinations of two GPUs and their cost. If the policy is "PACK", we'll sort the map by cost in ascending order. The first entry will be the GPUs has minimum GPU-GPU cost. If the policy is "SPREAD", we sort it in descending order and get the first one which is the highest GPU-GPU cost which means lowest CPU-GPU costs.

      Estimation of the algorithm

      Initial analysis of the topology scheduling algorithm(Using PACK policy) based on the performance tests in an AWS EC2 with 8 GPU cards (P3) is done. Below figure shows the performance gain of the topology scheduling algorithm's allocation (PACK policy).


      Some of the conclusions are:
      1. The topology between GPUs impacts the performance dramatically. The best combination GPUs can get 5% to 185% performance gain among the test cases with various factors including CNN model, batch size, GPU subset, etc. The scheduling algorithm should be close to this fact.
      2. The "inception3" and "resnet50" networks seem not topology sensitive. The topology scheduling can only potentially get about 6.8% to 10% speedup in best cases.
      3. Our current version of topology scheduling algorithm can achieve 6.8*% to 177.1%* performance gain in best cases. In average, it also outperforms the median performance(0.8% to 28.2%).

      4. And the algorithm's allocations match the fastest GPUs needed by "vgg16" best.
      In summary, the GPU topology scheduling algorithm is effective and can potentially get 6.8% to 185% performance gain in the best cases and 1% to 30% on average.
      It means about maximum 3X comparing to a random GPU scheduling algorithm in a specific scenario.
      The spreadsheets are here for your reference.


        1. YARN-8821-trunk.010.patch
          175 kB
          Zhankun Tang
        2. YARN-8821-trunk.009.patch
          173 kB
          Zhankun Tang
        3. YARN-8821-trunk.008.patch
          173 kB
          Zhankun Tang
        4. GPUTopologyPerformance.png
          40 kB
          Zhankun Tang
        5. YARN-8821-trunk.007.patch
          173 kB
          Zhankun Tang
        6. YARN-8821-trunk.006.patch
          170 kB
          Zhankun Tang
        7. YARN-8821-trunk.005.patch
          55 kB
          Zhankun Tang
        8. YARN-8821-trunk.004.patch
          54 kB
          Zhankun Tang
        9. YARN-8821-trunk.003.patch
          39 kB
          Zhankun Tang
        10. YARN-8821-trunk.002.patch
          39 kB
          Zhankun Tang
        11. YARN-8821-trunk.001.patch
          38 kB
          Zhankun Tang

        Issue Links



            • Assignee:
              tangzhankun Zhankun Tang
              tangzhankun Zhankun Tang


              • Created:

                Issue deployment