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: 241b7651a2cd
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: 1cace1cd91a7
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Aug 28, 2015

  1. Copy the full SHA
    a36a50b View commit details
  2. Copy the full SHA
    031d8d0 View commit details
  3. style

    sbourdeauducq committed Aug 28, 2015
    Copy the full SHA
    1cace1c View commit details
Showing with 9 additions and 3 deletions.
  1. +1 −1 artiq/coredevice/comm_tcp.py
  2. +8 −1 doc/manual/getting_started_core.rst
  3. +0 −1 examples/master/repository/speed_benchmark.py
2 changes: 1 addition & 1 deletion artiq/coredevice/comm_tcp.py
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ def __init__(self, dmgr, host, port=1381):
def open(self):
if hasattr(self, "socket"):
return
self.socket = socket.create_connection((self.host, self.port))
self.socket = socket.create_connection((self.host, self.port), 5.0)
set_keepalive(self.socket, 3, 2, 3)
logger.debug("connected to host %s on port %d", self.host, self.port)
self.write(b"ARTIQ coredev\n")
9 changes: 8 additions & 1 deletion doc/manual/getting_started_core.rst
Original file line number Diff line number Diff line change
@@ -20,11 +20,16 @@ As a very first step, we will turn on a LED on the core device. Create a file ``
def run(self):
self.led.on()


The central part of our code is our ``LED`` class, that derives from :class:`artiq.language.environment.EnvExperiment`. Among other features, ``EnvExperiment`` calls our ``build`` method and provides the ``attr_device`` method that interfaces to the device database to create the appropriate device drivers and make those drivers accessible as ``self.core`` and ``self.led``. The ``@kernel`` decorator tells the system that the ``run`` method must be executed on the core device (instead of the host). The decorator uses ``self.core`` internally, which is why we request the core device using ``attr_device`` like any other.

Copy the files ``ddb.pyon`` and ``pdb.pyon`` (containing the device and parameter databases) from the ``examples/master`` folder of ARTIQ into the same directory as ``led.py`` (alternatively, you can use the ``-d`` and ``-p`` options of ``artiq_run``). You can open the database files using a text editor - their contents are in a human-readable format. You will probably want to set the IP address of the core device in ``ddb.pyon`` so that the computer can connect to it (it is the ``host`` parameter of the ``comm`` entry). See :ref:`ddb` for more information. The example device database is designed for the NIST QC1 hardware on the KC705; see :ref:`board-ports` for RTIO channel assignments if you need to adapt the device database to a different hardware platform.

.. note::
If the ``led`` device is a bidirectional TTL (i.e. ``TTLInOut`` instead of ``TTLOut``), you need to put it in output (driving) mode. Add the following at the beginning of ``run``: ::

self.led.output()
delay(0.1*us)

Run your code using ``artiq_run``, which is part of the ARTIQ front-end tools: ::

$ artiq_run led.py
@@ -90,6 +95,7 @@ Create a new file ``rtio.py`` containing the following: ::

from artiq import *


class Tutorial(EnvExperiment):
def build(self):
self.attr_device("core")
@@ -110,6 +116,7 @@ Try reducing the period of the generated waveform until the CPU cannot keep up w

from artiq.coredevice.runtime_exceptions import RTIOUnderflow


def print_underflow():
print("RTIO underflow occured")

1 change: 0 additions & 1 deletion examples/master/repository/speed_benchmark.py
Original file line number Diff line number Diff line change
@@ -115,7 +115,6 @@ def run_without_scheduler(self, pause):
(end_time-start_time)/self.nruns,
realtime=True)


def run(self):
if self.mode == "Single experiment":
self.run_without_scheduler(False)