From e396f30f68d4edddc4180e7589645e612fbce27b Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <maltanar@gmail.com> Date: Thu, 20 Aug 2020 12:00:15 +0200 Subject: [PATCH] [Refactor] throughput_test -> throughput_test_remote --- notebooks/end2end_example/tfc_end2end_example.ipynb | 2 +- src/finn/core/throughput_test.py | 2 +- tests/fpgadataflow/test_fpgadataflow_fifo.py | 4 ++-- tests/pynq/test_pynq_performance_end2end.py | 9 ++++++--- tests/pynq/test_pynq_performance_fifo.py | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/notebooks/end2end_example/tfc_end2end_example.ipynb b/notebooks/end2end_example/tfc_end2end_example.ipynb index b3b409760..105ba8c6e 100644 --- a/notebooks/end2end_example/tfc_end2end_example.ipynb +++ b/notebooks/end2end_example/tfc_end2end_example.ipynb @@ -1936,7 +1936,7 @@ } ], "source": [ - "from finn.core.throughput_test import throughput_test\n", + "from finn.core.throughput_test import throughput_test_remote\n", "\n", "child_model = ModelWrapper(getCustomOp(sdp_node).get_nodeattr(\"model\"))\n", "res = throughput_test_remote(child_model)\n", diff --git a/src/finn/core/throughput_test.py b/src/finn/core/throughput_test.py index 4fc81142c..078764a42 100644 --- a/src/finn/core/throughput_test.py +++ b/src/finn/core/throughput_test.py @@ -34,7 +34,7 @@ from finn.util.basic import gen_finn_dt_tensor from finn.core.rtlsim_exec import rtlsim_exec -def throughput_test(model, batchsize=1000): +def throughput_test_remote(model, batchsize=1000): """Runs the throughput test for the given model remotely on the pynq board. The metadata properties related to the pynq board have to be set. Returns a dictionary with results of the throughput test. Returns None diff --git a/tests/fpgadataflow/test_fpgadataflow_fifo.py b/tests/fpgadataflow/test_fpgadataflow_fifo.py index a0881e2c9..8f6f5e2e5 100644 --- a/tests/fpgadataflow/test_fpgadataflow_fifo.py +++ b/tests/fpgadataflow/test_fpgadataflow_fifo.py @@ -26,7 +26,7 @@ from finn.transformation.fpgadataflow.replace_verilog_relpaths import ( ) from finn.transformation.fpgadataflow.synth_pynq_proj import SynthPYNQProject from finn.util.basic import pynq_part_map -from finn.core.throughput_test import throughput_test +from finn.core.throughput_test import throughput_test_remote build_dir = "/tmp/" + os.environ["FINN_INST_NAME"] @@ -113,7 +113,7 @@ def test_fpgadataflow_fifo_rtlsim(Shape, folded_shape, depth, finn_dtype): port = os.getenv("PYNQ_PORT", 22) target_dir = os.getenv("PYNQ_TARGET_DIR", "/home/xilinx/finn") model = model.transform(DeployToPYNQ(ip, port, username, password, target_dir)) - res = throughput_test(model) + res = throughput_test_remote(model) expected_dict = {} expected_dict["runtime[ms]"] = [] expected_dict["throughput[images/s]"] = [] diff --git a/tests/pynq/test_pynq_performance_end2end.py b/tests/pynq/test_pynq_performance_end2end.py index 3b6ea8674..06e10d0db 100644 --- a/tests/pynq/test_pynq_performance_end2end.py +++ b/tests/pynq/test_pynq_performance_end2end.py @@ -5,12 +5,15 @@ import numpy as np from scipy.stats import linregress import warnings from finn.util.test import load_test_checkpoint_or_skip -from finn.core.throughput_test import throughput_test +from finn.core.throughput_test import throughput_test_remote build_dir = "/tmp/" + os.environ["FINN_INST_NAME"] -@pytest.mark.parametrize("end2end_example", ["tfc_w1a1", "cnv_w1a1", "cnv_w2a2"]) +@pytest.mark.parametrize( + "end2end_example", + ["zynqbuild_tfc_w1a1", "zynqbuild_cnv_w1a1", "tfc_w1a1", "cnv_w1a1", "cnv_w2a2"], +) @pytest.mark.slow def test_pynq_performance_end2end(end2end_example): model = load_test_checkpoint_or_skip( @@ -27,7 +30,7 @@ def test_pynq_performance_end2end(end2end_example): bsize_range_in = [2 ** i for i in range(16)] bsize_range = [] for bsize in bsize_range_in: - res = throughput_test(model, bsize) + res = throughput_test_remote(model, bsize) if res is not None: ret[bsize] = res bsize_range.append(bsize) diff --git a/tests/pynq/test_pynq_performance_fifo.py b/tests/pynq/test_pynq_performance_fifo.py index 1a438f79e..b1f69527d 100644 --- a/tests/pynq/test_pynq_performance_fifo.py +++ b/tests/pynq/test_pynq_performance_fifo.py @@ -18,7 +18,7 @@ from finn.transformation.fpgadataflow.synth_pynq_proj import SynthPYNQProject import finn.transformation.fpgadataflow.replace_verilog_relpaths as rvp from finn.transformation.general import GiveUniqueNodeNames from finn.util.basic import pynq_part_map, pynq_native_port_width -from finn.core.throughput_test import throughput_test +from finn.core.throughput_test import throughput_test_remote from scipy.stats import linregress import warnings @@ -90,7 +90,7 @@ def test_pynq_performance_fifo(): bsize_range_in = [2 ** i for i in range(20)] bsize_range = [] for bsize in bsize_range_in: - res = throughput_test(model, bsize) + res = throughput_test_remote(model, bsize) if res is not None: ret[bsize] = res bsize_range.append(bsize) -- GitLab