From 90c9fa446f79a942cec961dcca6e711f7f6eadc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Mon, 28 Jan 2019 14:29:53 +0000 Subject: [PATCH] test: add array transfer test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 200 kB/s, more than a factor of 10 slower than the bare string transfer Signed-off-by: Robert Jördens --- artiq/test/coredevice/test_performance.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/artiq/test/coredevice/test_performance.py b/artiq/test/coredevice/test_performance.py index 35723f79d..4be415bec 100644 --- a/artiq/test/coredevice/test_performance.py +++ b/artiq/test/coredevice/test_performance.py @@ -22,6 +22,10 @@ class _Transfer(EnvExperiment): def sink(self, data): assert data == self.data + @rpc(flags={"async"}) + def sink_array(self, data): + assert data == [0]*(1 << 15) + @kernel def host_to_device(self): t0 = self.core.get_rtio_counter_mu() @@ -36,6 +40,16 @@ class _Transfer(EnvExperiment): t1 = self.core.get_rtio_counter_mu() return len(self.data)/self.core.mu_to_seconds(t1-t0) + @kernel + def device_to_host_array(self): + #data = [[0]*8 for _ in range(1 << 12)] + data = [0]*(1 << 15) + t0 = self.core.get_rtio_counter_mu() + self.sink_array(data) + t1 = self.core.get_rtio_counter_mu() + return ((len(data)*4)/ + self.core.mu_to_seconds(t1-t0)) + class TransferTest(ExperimentCase): @unittest.skipUnless(artiq_low_latency, @@ -54,6 +68,14 @@ class TransferTest(ExperimentCase): print(device_to_host_rate, "B/s") self.assertGreater(device_to_host_rate, 2.3e6) + @unittest.skipUnless(artiq_low_latency, + "timings are dependent on CPU load and network conditions") + def test_device_to_host_array(self): + exp = self.create(_Transfer) + rate = exp.device_to_host_array() + print(rate, "B/s") + self.assertGreater(rate, .15e6) + class _KernelOverhead(EnvExperiment): def build(self):