Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4c015d383d28
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dda5c167b893
Choose a head ref
  • 6 commits
  • 7 files changed
  • 1 contributor

Commits on Feb 18, 2015

  1. Copy the full SHA
    e6d0fc2 View commit details
  2. Revert "tools/file_import: use python 3.4 importlib API"

    This reverts commit 614a96a.
    
    Conflicts:
    	artiq/tools.py
    sbourdeauducq committed Feb 18, 2015
    Copy the full SHA
    3543dc3 View commit details
  3. Copy the full SHA
    d484b3a View commit details
  4. Copy the full SHA
    ec84726 View commit details
  5. Copy the full SHA
    e10390d View commit details
  6. Copy the full SHA
    dda5c16 View commit details
Showing with 93 additions and 5 deletions.
  1. +4 −0 artiq/coredevice/core.py
  2. +9 −0 artiq/py2llvm/fractions.py
  3. +2 −3 artiq/tools.py
  4. +2 −2 benchmarks/all.py
  5. +46 −0 benchmarks/ddb.pyon
  6. +1 −0 benchmarks/pdb.pyon
  7. +29 −0 benchmarks/rpc_timing.py
4 changes: 4 additions & 0 deletions artiq/coredevice/core.py
Original file line number Diff line number Diff line change
@@ -119,6 +119,10 @@ def run(self, k_function, k_args, k_kwargs):
self.comm.run(func_def.name)
self.comm.serve(rpc_map, exception_map)

@kernel
def get_rtio_time(self):
return cycles_to_time(syscall("rtio_get_counter"))

@kernel
def recover_underflow(self):
t = syscall("rtio_get_counter") + self.initial_time
9 changes: 9 additions & 0 deletions artiq/py2llvm/fractions.py
Original file line number Diff line number Diff line change
@@ -153,6 +153,15 @@ def o_roundx(self, target_bits, builder):
r.auto_store(builder, builder.sdiv(a, b))
return r.o_intx(target_bits, builder)

def o_float(self, builder):
r = VFloat()
if builder is not None:
a, b = self._nd(builder)
af = builder.sitofp(a, r.get_llvm_type())
bf = builder.sitofp(b, r.get_llvm_type())
r.auto_store(builder, builder.fdiv(af, bf))
return r

def _o_eq_inv(self, other, builder, ne):
if not isinstance(other, (VInt, VFraction)):
return NotImplemented
5 changes: 2 additions & 3 deletions artiq/tools.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from operator import itemgetter
import sys
import importlib.machinery
import linecache
import logging
import sys
import os.path


@@ -32,8 +32,7 @@ def file_import(filename):
sys.path.insert(0, path)

loader = importlib.machinery.SourceFileLoader(modname, filename)
module = type(sys)(modname)
loader.exec_module(module)
module = loader.load_module()

sys.path.remove(path)

4 changes: 2 additions & 2 deletions benchmarks/all.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from artiq import *

import pulse_rate, rtio_skew
import pulse_rate, rtio_skew, rpc_timing


_units = [pulse_rate.PulseRate, rtio_skew.RTIOSkew]
_units = [pulse_rate.PulseRate, rtio_skew.RTIOSkew, rpc_timing.RPCTiming]

class AllBenchmarks(AutoDB):
def build(self):
46 changes: 46 additions & 0 deletions benchmarks/ddb.pyon
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"comm": {
"type": "local",
"module": "artiq.coredevice.comm_serial",
"class": "Comm",
"arguments": {}
},
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {}
},

"pmt0": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOIn",
"arguments": {"channel": 0}
},
"pmt1": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOIn",
"arguments": {"channel": 1}
},

"ttl0": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOOut",
"arguments": {"channel": 2}
},
"ttl1": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOOut",
"arguments": {"channel": 3}
},
"ttl2": {
"type": "local",
"module": "artiq.coredevice.rtio",
"class": "RTIOOut",
"arguments": {"channel": 4}
},
}
1 change: 1 addition & 0 deletions benchmarks/pdb.pyon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
29 changes: 29 additions & 0 deletions benchmarks/rpc_timing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from math import sqrt

from artiq import *


class RPCTiming(AutoDB):
class DBKeys:
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] = float(t2.amount - t1.amount)

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