Skip to content

Commit

Permalink
add different hw tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asyms committed Sep 25, 2023
1 parent 6484207 commit e74e243
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 6 deletions.
26 changes: 26 additions & 0 deletions tests/main/test_ascend_like.py
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions tests/main/test_edge_tpu_like.py
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions tests/main/test_meta_prototype_like.py
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions tests/main/test_tesla_npu_like.py
Original file line number Diff line number Diff line change
@@ -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
14 changes: 8 additions & 6 deletions tests/main/test_api.py → tests/main/test_tpu_like.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit e74e243

Please sign in to comment.