Skip to content

Commit

Permalink
fix black
Browse files Browse the repository at this point in the history
Signed-off-by: luarss <[email protected]>
  • Loading branch information
luarss committed Aug 6, 2024
1 parent 21fa678 commit cfee77d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
33 changes: 22 additions & 11 deletions tools/AutoTuner/test/smoke_test_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import subprocess
import os
import json

cur_dir = os.path.dirname(os.path.abspath(__file__))
src_dir = os.path.join(cur_dir, "../src/autotuner")
os.chdir(src_dir)


class BaseSweepSmokeTest(unittest.TestCase):
platform = ""
design = ""
Expand All @@ -17,21 +19,27 @@ def setUp(self):
contents = json.load(f)
assert len(contents.keys()) == 1, "Must be size 1"
assert "CTS_CLUSTER_SIZE" in contents, "Must have key CTS_CLUSTER_SIZE"
assert (contents["CTS_CLUSTER_SIZE"]["minmax"][1] - \
contents["CTS_CLUSTER_SIZE"]["minmax"][0]) / \
contents["CTS_CLUSTER_SIZE"]["step"] == 4, "Must have only 4 possible values"
assert (
contents["CTS_CLUSTER_SIZE"]["minmax"][1]
- contents["CTS_CLUSTER_SIZE"]["minmax"][0]
) / contents["CTS_CLUSTER_SIZE"][
"step"
] == 4, "Must have only 4 possible values"

# limit jobs because ray.get() does not terminate if jobs > number of samples
core = os.cpu_count()
self.jobs = 4 if core >= 4 else core
self.experiment = f"smoke-test-sweep-{self.platform}"
self.command = ("python3 distributed.py"
f" --design {self.design}"
f" --platform {self.platform}"
f" --experiment {self.experiment}"
f" --config {self.config}"
f" --jobs {self.jobs}"
f" sweep")
self.command = (
"python3 distributed.py"
f" --design {self.design}"
f" --platform {self.platform}"
f" --experiment {self.experiment}"
f" --config {self.config}"
f" --jobs {self.jobs}"
f" sweep"
)


class ASAP7SweepSmokeTest(BaseSweepSmokeTest):
platform = "asap7"
Expand All @@ -42,6 +50,7 @@ def test_sweep(self):
successful = out.returncode == 0
self.assertTrue(successful)


class SKY130HDSweepSmokeTest(BaseSweepSmokeTest):
platform = "sky130hd"
design = "gcd"
Expand All @@ -51,6 +60,7 @@ def test_sweep(self):
successful = out.returncode == 0
self.assertTrue(successful)


class IHPSG13G2SweepSmokeTest(BaseSweepSmokeTest):
platform = "ihp-sg13g2"
design = "gcd"
Expand All @@ -60,5 +70,6 @@ def test_sweep(self):
successful = out.returncode == 0
self.assertTrue(successful)

if __name__ == '__main__':

if __name__ == "__main__":
unittest.main()
27 changes: 19 additions & 8 deletions tools/AutoTuner/test/smoke_test_tune.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
import unittest
import subprocess
import os

cur_dir = os.path.dirname(os.path.abspath(__file__))
src_dir = os.path.join(cur_dir, "../src/autotuner")
os.chdir(src_dir)


class BaseTuneSmokeTest(unittest.TestCase):
platform = ""
design = ""

def setUp(self):
self.config = os.path.join(cur_dir, f"../../../flow/designs/{self.platform}/{self.design}/autotuner.json")
self.config = os.path.join(
cur_dir,
f"../../../flow/designs/{self.platform}/{self.design}/autotuner.json",
)
self.experiment = f"smoke-test-tune-{self.platform}"
self.command = ("python3 distributed.py"
f" --design {self.design}"
f" --platform {self.platform}"
f" --experiment {self.experiment}"
f" --config {self.config}"
f" tune --samples 1")
self.command = (
"python3 distributed.py"
f" --design {self.design}"
f" --platform {self.platform}"
f" --experiment {self.experiment}"
f" --config {self.config}"
f" tune --samples 1"
)


class ASAP7TuneSmokeTest(BaseTuneSmokeTest):
platform = "asap7"
Expand All @@ -28,6 +36,7 @@ def test_tune(self):
successful = out.returncode == 0
self.assertTrue(successful)


class SKY130HDTuneSmokeTest(BaseTuneSmokeTest):
platform = "sky130hd"
design = "gcd"
Expand All @@ -37,6 +46,7 @@ def test_tune(self):
successful = out.returncode == 0
self.assertTrue(successful)


class IHPSG13G2TuneSmokeTest(BaseTuneSmokeTest):
platform = "ihp-sg13g2"
design = "gcd"
Expand All @@ -46,5 +56,6 @@ def test_tune(self):
successful = out.returncode == 0
self.assertTrue(successful)

if __name__ == '__main__':

if __name__ == "__main__":
unittest.main()

0 comments on commit cfee77d

Please sign in to comment.