-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements for adding SSH instances (#1202)
* Change the GPU's full name to a short one * SSH instances must be filtered with other instances * Fixed the region for the instance * Check the instance in the existing ones before adding them
- Loading branch information
Sergey Mezentsev
authored
May 8, 2024
1 parent
c6315ab
commit b615a12
Showing
6 changed files
with
63 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import re | ||
|
||
|
||
def convert_gpu_name(name: str) -> str: | ||
"""Convert gpu_name from nvidia-smi to short version""" | ||
# https://github.com/NVIDIA/open-gpu-kernel-modules/ | ||
name = name.replace("NVIDIA ", "") | ||
name = name.replace("Tesla ", "") | ||
name = name.replace("Quadro ", "") | ||
name = name.replace("GeForce ", "") | ||
|
||
if "GH200" in name: | ||
return "GH200" | ||
|
||
if "RTX A" in name: | ||
name = name.replace("RTX A", "A") | ||
m = re.search(r"(A\d+)", name) | ||
if m is not None: | ||
return m.group(0) | ||
return name.replace(" ", "") | ||
|
||
name = name.replace(" Ti", "Ti") | ||
name = name.replace("RTX ", "RTX") | ||
m = re.search(r"([A|H|L|P|T|V]\d+[Ti]?)", name) | ||
if m is not None: | ||
return m.group(0) | ||
return name.replace(" ", "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
|
||
from dstack._internal.utils.gpu import convert_gpu_name | ||
|
||
TESTS = [ | ||
("NVIDIA GeForce RTX 4060 Ti", "RTX4060Ti"), | ||
("NVIDIA GeForce RTX 4060", "RTX4060"), | ||
("NVIDIA L4", "L4"), | ||
("NVIDIA GH200 120GB", "GH200"), | ||
("NVIDIA A100-SXM4-80GB", "A100"), | ||
("NVIDIA A10G", "A10"), | ||
("Tesla T4", "T4"), | ||
] | ||
|
||
|
||
class TestConvertGpuName: | ||
@pytest.mark.parametrize("test_input,expected", TESTS) | ||
def test_convert_gpu_name(self, test_input, expected): | ||
assert convert_gpu_name(test_input) == expected |