Skip to content

Commit 4d1234d

Browse files
committed
vmm-cli: Rm gpus section when no GPUs
1 parent acbf03b commit 4d1234d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

vmm/src/vmm-cli.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from typing import Optional, Dict, List, Tuple, Union, BinaryIO, Any
2020

2121
# Default whitelist file location
22-
DEFAULT_KMS_WHITELIST_PATH = os.path.expanduser("~/.dstack-vmm/kms-whitelist.json")
22+
DEFAULT_KMS_WHITELIST_PATH = os.path.expanduser(
23+
"~/.dstack-vmm/kms-whitelist.json")
2324

2425

2526
def encrypt_env(envs, hex_public_key: str) -> str:
@@ -461,11 +462,16 @@ def create_vm(self, name: str, image: str, compose_file: str,
461462
"disk_size": disk_size,
462463
"app_id": app_id,
463464
"ports": [parse_port_mapping(port) for port in ports or []],
464-
"gpus": [{"product_id": gpu} for gpu in gpus or []],
465465
"hugepages": hugepages,
466466
"pin_numa": pin_numa,
467467
}
468468

469+
if gpus:
470+
params["gpus"] = {
471+
"attach_mode": "listed",
472+
"gpus": [{"slot": gpu} for gpu in gpus or []]
473+
}
474+
469475
app_id = app_id or self.calc_app_id(compose_content)
470476
print(f"App ID: {app_id}")
471477
if envs:

0 commit comments

Comments
 (0)