Support for dynamic system topology discovery #624
      
        
          +883
        
        
          −1
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR introduces a new topology discovery feature that enables automatic detection of system topology, including GPU-to-NUMA-to-NIC mappings, using NVML to query GPU information and directly queries
/systo build a comprehensive view of the system's PCIe topology.The core changes include:
TopologyDiscoveryclass with supporting data structures to composesystem/GPU/networktopology informationThis tool will later be integrated in the
rrunlauncher #616 for automatic topology discovery and configuration, it will also allow to read JSON files to override dynamic discovery and instead use the declarative file to set CPU/memory/network affinity.Sample JSON output for a DGX-1
{ "system": { "hostname": "dgx13", "num_gpus": 8, "num_numa_nodes": 2, "num_network_devices": 4 }, "gpus": [ { "id": 0, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:06:00.0", "uuid": "GPU-b41abe4a-8553-43be-9d49-f1c4591959fa", "numa_node": 0, "cpu_affinity": { "cpulist": "0-19,40-59", "cores": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] }, "memory_binding": [0], "network_devices": ["mlx5_0"] }, { "id": 1, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:07:00.0", "uuid": "GPU-d30af75d-3d17-4155-9659-416789520ca5", "numa_node": 0, "cpu_affinity": { "cpulist": "0-19,40-59", "cores": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] }, "memory_binding": [0], "network_devices": ["mlx5_0"] }, { "id": 2, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:0A:00.0", "uuid": "GPU-d417ef25-b26f-4381-84fb-a6725b5b05ad", "numa_node": 0, "cpu_affinity": { "cpulist": "0-19,40-59", "cores": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] }, "memory_binding": [0], "network_devices": ["mlx5_1"] }, { "id": 3, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:0B:00.0", "uuid": "GPU-900a54bc-9e88-432e-b70f-42772a5c7f3e", "numa_node": 0, "cpu_affinity": { "cpulist": "0-19,40-59", "cores": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59] }, "memory_binding": [0], "network_devices": ["mlx5_1"] }, { "id": 4, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:85:00.0", "uuid": "GPU-8cbe65cb-8b1f-4d32-af73-0d6267702fea", "numa_node": 1, "cpu_affinity": { "cpulist": "20-39,60-79", "cores": [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79] }, "memory_binding": [1], "network_devices": ["mlx5_2"] }, { "id": 5, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:86:00.0", "uuid": "GPU-8c39dca7-bd84-46c7-80f5-86ef16e3e163", "numa_node": 1, "cpu_affinity": { "cpulist": "20-39,60-79", "cores": [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79] }, "memory_binding": [1], "network_devices": ["mlx5_2"] }, { "id": 6, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:89:00.0", "uuid": "GPU-ef048cce-30c3-4844-8aec-9863bedbf67c", "numa_node": 1, "cpu_affinity": { "cpulist": "20-39,60-79", "cores": [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79] }, "memory_binding": [1], "network_devices": ["mlx5_3"] }, { "id": 7, "name": "Tesla V100-SXM2-32GB", "pci_bus_id": "00000000:8A:00.0", "uuid": "GPU-ff15fdcb-3bba-4a21-8e2f-f3ab897e21a0", "numa_node": 1, "cpu_affinity": { "cpulist": "20-39,60-79", "cores": [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79] }, "memory_binding": [1], "network_devices": ["mlx5_3"] } ], "network_devices": [ { "name": "mlx5_3", "numa_node": 1, "pci_bus_id": "0000:8b:00.0" }, { "name": "mlx5_1", "numa_node": 0, "pci_bus_id": "0000:0c:00.0" }, { "name": "mlx5_2", "numa_node": 1, "pci_bus_id": "0000:84:00.0" }, { "name": "mlx5_0", "numa_node": 0, "pci_bus_id": "0000:05:00.0" } ] }