mirror of https://github.com/m-labs/artiq.git
benchmarks/*: remove
Benchmarks should be shaped as unittests and run as part of CI.
This commit is contained in:
parent
f7427dda39
commit
5442ae312f
|
@ -1,18 +0,0 @@
|
|||
from artiq import *
|
||||
|
||||
import pulse_rate, rtio_skew, rpc_timing
|
||||
|
||||
|
||||
_exps = [pulse_rate.PulseRate, rtio_skew.RTIOSkew, rpc_timing.RPCTiming]
|
||||
|
||||
class AllBenchmarks(Experiment, AutoDB):
|
||||
"""All benchmarks"""
|
||||
|
||||
def build(self):
|
||||
self.se = []
|
||||
for exp in _exps:
|
||||
self.se.append(exp(self.dbh))
|
||||
|
||||
def run(self):
|
||||
for se in self.se:
|
||||
se.run()
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"comm": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.comm_tcp",
|
||||
"class": "Comm",
|
||||
"arguments": {"host": "192.168.0.42"}
|
||||
},
|
||||
"core": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.core",
|
||||
"class": "Core",
|
||||
"arguments": {}
|
||||
},
|
||||
|
||||
"pmt0": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.ttl",
|
||||
"class": "TTLInOut",
|
||||
"arguments": {"channel": 0}
|
||||
},
|
||||
|
||||
"ttl0": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.ttl",
|
||||
"class": "TTLOut",
|
||||
"arguments": {"channel": 2}
|
||||
},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
{}
|
|
@ -1,26 +0,0 @@
|
|||
from artiq import *
|
||||
from artiq.coredevice.runtime_exceptions import RTIOUnderflow
|
||||
|
||||
|
||||
class PulseRate(Experiment, AutoDB):
|
||||
"""Sustained pulse rate"""
|
||||
|
||||
class DBKeys:
|
||||
core = Device()
|
||||
ttl0 = Device()
|
||||
pulse_rate = Result()
|
||||
|
||||
@kernel
|
||||
def run(self):
|
||||
T = time_to_cycles(100*ns)
|
||||
while True:
|
||||
try:
|
||||
for i in range(1000):
|
||||
self.ttl0.pulse(cycles_to_time(T))
|
||||
delay(cycles_to_time(T))
|
||||
except RTIOUnderflow:
|
||||
T += 1
|
||||
self.core.break_realtime()
|
||||
else:
|
||||
self.pulse_rate = cycles_to_time(2*T)
|
||||
break
|
|
@ -1,32 +0,0 @@
|
|||
from math import sqrt
|
||||
|
||||
from artiq import *
|
||||
|
||||
|
||||
class RPCTiming(Experiment, AutoDB):
|
||||
"""RPC timing"""
|
||||
|
||||
class DBKeys:
|
||||
core = Device()
|
||||
repeats = Argument(100)
|
||||
rpc_time_mean = Result()
|
||||
rpc_time_stddev = Result()
|
||||
|
||||
def nop(self, x):
|
||||
pass
|
||||
|
||||
@kernel
|
||||
def bench(self):
|
||||
self.ts = [0.0 for _ in range(self.repeats)]
|
||||
for i in range(self.repeats):
|
||||
t1 = self.core.get_rtio_time()
|
||||
self.nop(10)
|
||||
t2 = self.core.get_rtio_time()
|
||||
self.ts[i] = t2 - t1
|
||||
|
||||
def run(self):
|
||||
self.bench()
|
||||
mean = sum(self.ts)/self.repeats
|
||||
self.rpc_time_stddev = sqrt(
|
||||
sum([(t - mean)**2 for t in self.ts])/self.repeats)*s
|
||||
self.rpc_time_mean = mean*s
|
|
@ -1,29 +0,0 @@
|
|||
from artiq import *
|
||||
|
||||
|
||||
class PulseNotReceived(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class RTIOSkew(Experiment, AutoDB):
|
||||
"""RTIO skew"""
|
||||
|
||||
class DBKeys:
|
||||
core = Device()
|
||||
pmt0 = Device()
|
||||
rtio_skew = Result()
|
||||
|
||||
@kernel
|
||||
def run(self):
|
||||
self.pmt0.output()
|
||||
delay(1*us)
|
||||
with parallel:
|
||||
self.pmt0.gate_rising(10*us)
|
||||
with sequential:
|
||||
delay(5*us)
|
||||
out_t = now()
|
||||
self.pmt0.pulse(5*us)
|
||||
in_t = self.pmt0.timestamp()
|
||||
if in_t < 0*s:
|
||||
raise PulseNotReceived
|
||||
self.rtio_skew = out_t - in_t
|
Loading…
Reference in New Issue