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
Copy file name to clipboardExpand all lines: docs/docs/concepts/backends.md
+12-33Lines changed: 12 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1061,23 +1061,21 @@ projects:
1061
1061
Ensure you've created a ClusterRoleBinding to grant the role to the user or the service account you're using.
1062
1062
1063
1063
??? info "Resources and offers"
1064
-
[Resources](../concepts/tasks.md#resources) specified in the run configuration are translated to Kubernetes
1065
-
[requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits) as follows:
1064
+
If you use ranges with [`resources`](../concepts/tasks.md#resources) (e.g. `gpu: 1..8` or `memory: 64GB..`) in fleet or run configurations, other backends collect and try all offers that satisfy the range.
1066
1065
1067
-
- As with other backends, an exact value is translated to a range with the same lower and upper limits,
1068
-
e.g., `cpu: 4` is the same as `cpu: 4..4`.
1069
-
- The lower limit, if set, is used as a resource request, meaning that it is guaranteed that the container has at least the specified
1070
-
amount of the resource.
1071
-
- For resources other than `gpu`, the upper limit, if set, is used as a resource limit, meaning that the container is not allowed
1072
-
to consume more resources than specified. If the upper limit is not set, the resource limit is also not set.
1073
-
- For `gpu` resources, the upper limit is always ignored, and the resource limit is always set to the same value as the resource request,
1074
-
that is, to the lower limit of the range.
1066
+
The `kubernetes` backend handles it differently.
1067
+
1068
+
* For `gpu`, if you specify a range (e.g. `gpu: 4..8`), the `kubernetes` backend only provisions pods with the GPU count equal to the lower limit (`4`). The upper limit of the GPU range is always ignored.
1069
+
* For other resources such as `cpu`, `memory`, and `disk`, the `kubernetes` backend passes the lower and upper limits of the range as Kubernetes [requests and limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits) respectively. If the upper limit is not set, the Kubernetes limit is also not set.
1075
1070
1076
-
For example, the following resources specification:
1071
+
Example:
1077
1072
1078
1073
<div editor-title=".dstack.yml">
1079
1074
1080
1075
```yaml
1076
+
type: dev-environment
1077
+
ide: vscode
1078
+
1081
1079
resources:
1082
1080
cpu: 32..64
1083
1081
memory: 1024GB
@@ -1087,35 +1085,16 @@ projects:
1087
1085
1088
1086
</div>
1089
1087
1090
-
is translated to:
1088
+
This translates to the following Kubernetes resource spec:
1091
1089
1092
-
| resource | request | limit |
1090
+
| Resource | Request | Limit |
1093
1091
|---------------------|----------|-----------|
1094
1092
| `cpu` | `32` | `64` |
1095
1093
| `memory` | `1024Gi` | `1024Gi` |
1096
1094
| `ephemeral-storage` | `100Gi` | _not set_ |
1097
1095
| `nvidia.com/gpu` | `4` | `4` |
1098
1096
1099
-
In offers, `dstack` uses resource requests as offer's resources.
1100
-
With the resources spec as in the example above, offers would look like the following,
As a consequence, if you specify `gpu: 0` or don't specify `gpu` at all (the default value is `0`),
1109
-
you won't see GPU resources in offers, even with GPU nodes. The same is true for the `dstack offer` command,
1110
-
to see available GPU models, you should specify a miminum amount of GPUs > 0:
1111
-
1112
-
<div class="termy">
1113
-
1114
-
```shell
1115
-
$ dstack offer --gpu 1
1116
-
```
1117
-
1118
-
</div>
1097
+
This applies to offers shown in `dstack apply` (run plans), during provisioning, and in `dstack offer`. Unlike other backends, offers for the `kubernetes` backend always reflect the lower limit of the range.
1119
1098
1120
1099
> To learn more, see the [Lambda](../../examples/clusters/lambda/#kubernetes) and [Crusoe](../../examples/clusters/crusoe/#kubernetes) examples.
0 commit comments