From e74e24368ecf514ca32af89e362d8bc69fbda1bc Mon Sep 17 00:00:00 2001 From: asyms Date: Mon, 25 Sep 2023 11:54:05 +0200 Subject: [PATCH] add different hw tests --- tests/main/test_ascend_like.py | 26 +++++++++++++++++++ tests/main/test_edge_tpu_like.py | 26 +++++++++++++++++++ tests/main/test_meta_prototype_like.py | 26 +++++++++++++++++++ tests/main/test_tesla_npu_like.py | 26 +++++++++++++++++++ tests/main/{test_api.py => test_tpu_like.py} | 14 +++++----- .../{assend_like.py => ascend_like.py} | 0 6 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 tests/main/test_ascend_like.py create mode 100644 tests/main/test_edge_tpu_like.py create mode 100644 tests/main/test_meta_prototype_like.py create mode 100644 tests/main/test_tesla_npu_like.py rename tests/main/{test_api.py => test_tpu_like.py} (51%) rename zigzag/inputs/examples/mapping/{assend_like.py => ascend_like.py} (100%) diff --git a/tests/main/test_ascend_like.py b/tests/main/test_ascend_like.py new file mode 100644 index 00000000..818e2f5e --- /dev/null +++ b/tests/main/test_ascend_like.py @@ -0,0 +1,26 @@ +import pytest + +from zigzag.api import get_hardware_performance_zigzag + +workloads = ( + "zigzag/inputs/examples/workload/alexnet.onnx", + "zigzag/inputs/examples/workload/mobilenetv2.onnx", + "zigzag/inputs/examples/workload/resnet18.onnx", + "zigzag.inputs.examples.workload.resnet18", +) + + +@pytest.fixture +def mapping(): + return "zigzag.inputs.examples.mapping.ascend_like" + + +@pytest.fixture +def accelerator(): + return "zigzag.inputs.examples.hardware.Ascend_like" + + +@pytest.mark.parametrize("workload", workloads) +def test_api(workload, accelerator, mapping): + answer = get_hardware_performance_zigzag(workload, accelerator, mapping) + assert answer diff --git a/tests/main/test_edge_tpu_like.py b/tests/main/test_edge_tpu_like.py new file mode 100644 index 00000000..d7ef7c86 --- /dev/null +++ b/tests/main/test_edge_tpu_like.py @@ -0,0 +1,26 @@ +import pytest + +from zigzag.api import get_hardware_performance_zigzag + +workloads = ( + "zigzag/inputs/examples/workload/alexnet.onnx", + "zigzag/inputs/examples/workload/mobilenetv2.onnx", + "zigzag/inputs/examples/workload/resnet18.onnx", + "zigzag.inputs.examples.workload.resnet18", +) + + +@pytest.fixture +def mapping(): + return "zigzag.inputs.examples.mapping.edge_tpu_like" + + +@pytest.fixture +def accelerator(): + return "zigzag.inputs.examples.hardware.Edge_TPU_like" + + +@pytest.mark.parametrize("workload", workloads) +def test_api(workload, accelerator, mapping): + answer = get_hardware_performance_zigzag(workload, accelerator, mapping) + assert answer diff --git a/tests/main/test_meta_prototype_like.py b/tests/main/test_meta_prototype_like.py new file mode 100644 index 00000000..3060509d --- /dev/null +++ b/tests/main/test_meta_prototype_like.py @@ -0,0 +1,26 @@ +import pytest + +from zigzag.api import get_hardware_performance_zigzag + +workloads = ( + "zigzag/inputs/examples/workload/alexnet.onnx", + "zigzag/inputs/examples/workload/mobilenetv2.onnx", + "zigzag/inputs/examples/workload/resnet18.onnx", + "zigzag.inputs.examples.workload.resnet18", +) + + +@pytest.fixture +def mapping(): + return "zigzag.inputs.examples.mapping.meta_prototype_like" + + +@pytest.fixture +def accelerator(): + return "zigzag.inputs.examples.hardware.Meta_prototype" + + +@pytest.mark.parametrize("workload", workloads) +def test_api(workload, accelerator, mapping): + answer = get_hardware_performance_zigzag(workload, accelerator, mapping) + assert answer diff --git a/tests/main/test_tesla_npu_like.py b/tests/main/test_tesla_npu_like.py new file mode 100644 index 00000000..de9f9dbb --- /dev/null +++ b/tests/main/test_tesla_npu_like.py @@ -0,0 +1,26 @@ +import pytest + +from zigzag.api import get_hardware_performance_zigzag + +workloads = ( + "zigzag/inputs/examples/workload/alexnet.onnx", + "zigzag/inputs/examples/workload/mobilenetv2.onnx", + "zigzag/inputs/examples/workload/resnet18.onnx", + "zigzag.inputs.examples.workload.resnet18", +) + + +@pytest.fixture +def mapping(): + return "zigzag.inputs.examples.mapping.tesla_npu_like" + + +@pytest.fixture +def accelerator(): + return "zigzag.inputs.examples.hardware.Tesla_NPU_like" + + +@pytest.mark.parametrize("workload", workloads) +def test_api(workload, accelerator, mapping): + answer = get_hardware_performance_zigzag(workload, accelerator, mapping) + assert answer diff --git a/tests/main/test_api.py b/tests/main/test_tpu_like.py similarity index 51% rename from tests/main/test_api.py rename to tests/main/test_tpu_like.py index 24859776..d8cfbe2a 100644 --- a/tests/main/test_api.py +++ b/tests/main/test_tpu_like.py @@ -1,12 +1,13 @@ -# Test the zigzag api call import pytest from zigzag.api import get_hardware_performance_zigzag - -@pytest.fixture -def workload(): - return "zigzag/inputs/examples/workload/mobilenetv2.onnx" +workloads = ( + "zigzag/inputs/examples/workload/alexnet.onnx", + "zigzag/inputs/examples/workload/mobilenetv2.onnx", + "zigzag/inputs/examples/workload/resnet18.onnx", + "zigzag.inputs.examples.workload.resnet18", +) @pytest.fixture @@ -19,6 +20,7 @@ def accelerator(): return "zigzag.inputs.examples.hardware.TPU_like" -def test_api(workload, mapping, accelerator): +@pytest.mark.parametrize("workload", workloads) +def test_api(workload, accelerator, mapping): answer = get_hardware_performance_zigzag(workload, accelerator, mapping) assert answer diff --git a/zigzag/inputs/examples/mapping/assend_like.py b/zigzag/inputs/examples/mapping/ascend_like.py similarity index 100% rename from zigzag/inputs/examples/mapping/assend_like.py rename to zigzag/inputs/examples/mapping/ascend_like.py