You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The resource_naming_strategy is a new flag which can be passed to the
device plugin daemonset. The supported values for the flag are
"single" and "mixed"
Terms to understand before viewing the changes in this commit:
Homogeneous Node:
If all GPUs in a node are following the same compute and memory
partition style, the node is considered homogeneous
Heterogeneous Node:
If the GPUs on a node have different different compute and memory
partition styles, the node is considered heterogeneous (Put simply,
if node is not homogeneous)
Behaviour of Resource Naming Strategy in different node types:
Homogeneous Node:
-> If node is homogeneous and resource naming strategy is "single",
one plugin is started using the DevicePluginManager with the last
name as “gpu”.
If node is homogeneous and resource naming strategy is "mixed",
one plugin is started using the DevicePluginManager with the last
name as the partition style present on the node.
-> The ListAndWatch function remains almost the same as it was before.
It reports resources under a single resource name(the name will
either be "gpu" or the partition style present on the node(cpx_nps1)
depending on strategy)
Heterogeneous:
-> If node is heterogeneous and resource naming strategy is "mixed", we
invoke the DevicePluginManager to start multiple plugins for
different partitionTypes under the names “spx-nps1, “cpx-nps1”, etc.
We use the devicesCount map to start plugins for the partitionTypes
that are present in the map
-> ListAndWatch sends the devices to the plugin for their respective
resource type depending on its partitionType. Each device has
computePartition and memoryPartition fields in its object as shown
before, which is used to identify which plugin to report the
resource under. (amd.com/spx-nps1,amd.com/cpx-nps1, etc..)
Note:
-> If node is heterogeneous, "single" strategy is not supported as
multiple resource types getting reported under a single resource
name wouldn't be mathematically accurate as to how many true gpus of
each type there are
-> For nodes where partitioning is not supported(MI200), irrespective
of strategy, the resources will get reported under "amd.com/gpu"
-> If the flag is not set by user, default value is "single". This is
to maintain backwards compatibility with older resource name before
strategy was introduced (amd.com/gpu)
// Homogeneous node will report only "gpu" resource
42
-
resources= []string{"gpu"}
63
+
// Homogeneous node will report only "gpu" resource if strategy is single. If strategy is mixed, it will report resources under the partition type name
64
+
ifresourceNamingStrategy==StrategySingle {
65
+
resources= []string{"gpu"}
66
+
} elseifresourceNamingStrategy==StrategyMixed {
67
+
iflen(deviceCountMap) ==0 {
68
+
// If partitioning is not supported on the node, we should report resources under "gpu" regardless of the strategy
69
+
resources= []string{"gpu"}
70
+
} else {
71
+
forpartitionType, count:=rangedeviceCountMap {
72
+
ifcount>0 {
73
+
resources=append(resources, partitionType)
74
+
}
75
+
}
76
+
}
77
+
}
43
78
} else {
44
79
// Heterogeneous node reports resources based on partition types
45
80
gpus:=amdgpu.GetAMDGPUs()
46
81
deviceCountMap:=amdgpu.GetAMDDeviceCountMap(gpus)
47
82
forpartitionType, count:=rangedeviceCountMap {
48
83
ifcount>0 {
49
84
resources=append(resources, partitionType)
85
+
// Heterogeneous node reports resources based on partition types if strategy is mixed. Heterogeneous is not allowed if Strategy is single
86
+
ifresourceNamingStrategy==StrategySingle {
87
+
returnresources, fmt.Errorf("Partitions of different styles across GPUs in a node is not supported with single strategy. Please start device plugin with mixed strategy")
88
+
} elseifresourceNamingStrategy==StrategyMixed {
89
+
forpartitionType, count:=rangedeviceCountMap {
90
+
ifcount>0 {
91
+
resources=append(resources, partitionType)
92
+
}
50
93
}
51
94
}
52
95
}
53
-
returnresources
96
+
returnresources, nil
54
97
}
55
98
56
99
funcmain() {
@@ -68,9 +111,16 @@ func main() {
68
111
flag.PrintDefaults()
69
112
}
70
113
varpulseint
114
+
varresourceNamingStrategystring
71
115
flag.IntVar(&pulse, "pulse", 0, "time between health check polling in seconds. Set to 0 to disable.")
116
+
flag.StringVar(&resourceNamingStrategy, "resource_naming_strategy", "single", "Resource strategy to be used: single or mixed")
72
117
// this is also needed to enable glog usage in dpm
The device plugin advertises AMD GPUs as the `amd.com/gpu` resource type. Pods can request this resource in their specifications to access AMD GPUs:
145
+
To customize the way device plugin reports gpu resources to kubernetes as allocatable k8s resources, use the `single` or `mixed` resource naming strategy flag mentioned above (--resource_naming_strategy)
146
+
147
+
Before understanding each strategy, please note the definition of homogeneous and heterogeneous nodes
148
+
149
+
Homogeneous node: A node whose gpu's follow the same compute-memory partition style
150
+
-> Example: A node of 8 GPU's where all 8 GPU's are following CPX-NPS4 partition style
151
+
152
+
Heterogeneous node: A node whose gpu's follow different compute-memory partition styles
153
+
-> Example: A node of 8 GPU's where 5 GPU's are following SPX-NPS1 and 3 GPU's are following CPX-NPS1
154
+
155
+
### Single
156
+
157
+
In `single` mode, the device plugin reports all gpu's (regardless of whether they are whole gpu's or partitions of a gpu) under the resource name `amd.com/gpu`
158
+
This mode is supported for homogeneous nodes but not supported for heterogeneous nodes
159
+
160
+
A node which has 8 GPUs where all GPUs are not partitioned will report its resources as:
161
+
162
+
```bash
163
+
amd.com/gpu: 8
164
+
```
165
+
166
+
A node which has 8 GPUs where all GPUs are partitioned using CPX-NPS4 style will report its resources as:
167
+
168
+
```bash
169
+
amd.com/gpu: 64
170
+
```
171
+
172
+
### Mixed
173
+
174
+
In `mixed` mode, the device plugin reports all gpu's under a name which matches its partition style.
175
+
This mode is supported for both homogeneous nodes and heterogeneous nodes
176
+
177
+
A node which has 8 GPUs which are all partitioned using CPX-NPS4 style will report its resources as:
178
+
179
+
```bash
180
+
amd.com/cpx_nps4: 64
181
+
```
182
+
183
+
A node which has 8 GPUs where 5 GPU's are following SPX-NPS1 and 3 GPU's are following CPX-NPS1 will report its resources as:
184
+
185
+
```bash
186
+
amd.com/spx_nps1: 5
187
+
amd.com/cpx_nps1: 24
188
+
```
189
+
190
+
- If `resource_naming_strategy` is not passed using the flag, then device plugin will internally default to `single` resource naming strategy. This maintains backwards compatibility with earlier release of device plugin with reported resource name of `amd.com/gpu`
191
+
192
+
- If a node has GPUs which do not support partitioning, such as MI210, then the GPUs are reported under resource name `amd.com/gpu` regardless of the resource naming strategy
193
+
194
+
Pods can request the resource as per the naming style in their specifications to access AMD GPUs:
0 commit comments