Setup: say which card is not used when a card under 8 GB sits beside a bigger NVIDIA card (a line only, no change to the cards used)
This commit is contained in:
1 parent
987ebd442f
commit
7aa9a584aa
2 files changed
+57
No files matched your search
@@ -1963,6 +1963,10 @@ def choose_gpus(a, found) -> list:
|
||||
fail("none of your GPUs can run Strata", "it needs an NVIDIA RTX 20 series or newer (compute capability 7.5+)")
|
||||
can = together_ok(found)
|
||||
if not can:
|
||||
for g in found: # said, not asked: a card that works alone but cannot share a model beside a bigger one
|
||||
if g["index"] != single[0]["index"] and gpu_problem(g) is None:
|
||||
say(f" GPU {g['index']} ({g['name']}, {g['vram_gb']:.0f} GB) is not used: a card that shares a model needs {SPLIT_MIN_VRAM_GB} GB or more, "
|
||||
f"so the model runs on GPU {single[0]['index']} alone.")
|
||||
return [single[0]["index"]]
|
||||
return choose_roles(a, found)
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
"""A card that works alone but cannot share a model (under 7.5 GB) beside a bigger NVIDIA card: setup says it is not used (a line, no question, no
|
||||
change to which cards run). Fake cards through setup.main (tools/test_setup_golden.py's harness)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
from test_setup_golden import install, argv_for # noqa: E402
|
||||
|
||||
|
||||
def card(i, name, gb, arch="86"):
|
||||
return {"index": i, "name": name, "vram_gb": gb, "arch": arch, "driver": "580.97"}
|
||||
|
||||
|
||||
BIG = card(0, "NVIDIA GeForce RTX 4090", 24.0, "89")
|
||||
SMALL = card(1, "NVIDIA GeForce RTX 2060", 5.9, "75")
|
||||
|
||||
|
||||
class SmallCardSaid(unittest.TestCase):
|
||||
def run_it(self, found, extra=()):
|
||||
code, out, cfg, asked = install(256.0, found, argv_for("qwen", "IQ3_S") + ["--yes", *extra])
|
||||
self.assertEqual(code, 0, out)
|
||||
return out, cfg, asked
|
||||
|
||||
def test_the_small_card_is_named_with_the_reason(self):
|
||||
out, cfg, asked = self.run_it([BIG, SMALL])
|
||||
self.assertIn("GPU 1 (NVIDIA GeForce RTX 2060, 6 GB) is not used", out)
|
||||
self.assertIn("needs 8 GB or more", out)
|
||||
self.assertIn("runs on GPU 0 alone", out)
|
||||
self.assertEqual(asked, []) # printed only
|
||||
self.assertEqual((cfg["gpu"], cfg["gpus_asked"]), (0, True)) # the cards used are what they were
|
||||
|
||||
def test_the_small_card_listed_first(self):
|
||||
out, cfg, _ = self.run_it([card(0, "NVIDIA GeForce RTX 2060", 5.9, "75"), card(1, "NVIDIA GeForce RTX 4090", 24.0, "89")])
|
||||
self.assertIn("GPU 0 (NVIDIA GeForce RTX 2060, 6 GB) is not used", out)
|
||||
self.assertEqual(cfg["gpu"], 1)
|
||||
|
||||
def test_nothing_is_said_where_nothing_is_left_out(self):
|
||||
for found in ([BIG], [BIG, card(1, "NVIDIA GeForce RTX 3060", 12.0)], [BIG, card(1, "NVIDIA GeForce RTX 3070", 8.0)]):
|
||||
out, _cfg, _ = self.run_it(found)
|
||||
self.assertNotIn("is not used", out, found)
|
||||
|
||||
def test_naming_a_card_says_nothing_extra(self):
|
||||
out, cfg, _ = self.run_it([BIG, SMALL], ["--gpu", "0"])
|
||||
self.assertNotIn("is not used", out)
|
||||
self.assertEqual(cfg["gpu"], 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user