diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index cc540f779..e6fc5e4e1 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -36,6 +36,8 @@ Release notes identifiers (``true``, ``null``, ...) with their Python equivalents (``True``, ``None` ...). * Controllers are now named ``aqctl_XXX`` instead of ``XXX_controller``. +* In the device database, the "comm" device has been folded into the "core" device. + Move the "host" argument into the "core" device, and remove the "comm" device. 2.3 diff --git a/artiq/coredevice/comm_kernel.py b/artiq/coredevice/comm_kernel.py index eba2a9dbd..ff92b72ce 100644 --- a/artiq/coredevice/comm_kernel.py +++ b/artiq/coredevice/comm_kernel.py @@ -109,8 +109,34 @@ def initialize_connection(host, port): return sock +class CommKernelDummy: + def __init__(self): + pass + + def switch_clock(self, external): + pass + + def load(self, kernel_library): + pass + + def run(self): + pass + + def serve(self, embedding_map, symbolizer, demangler): + pass + + def check_system_info(self): + pass + + def get_log(self): + return "" + + def clear_log(self): + pass + + class CommKernel: - def __init__(self, dmgr, host, port=1381): + def __init__(self, host, port=1381): self._read_type = None self.host = host self.port = port diff --git a/artiq/coredevice/comm_kernel_dummy.py b/artiq/coredevice/comm_kernel_dummy.py deleted file mode 100644 index c9dae5200..000000000 --- a/artiq/coredevice/comm_kernel_dummy.py +++ /dev/null @@ -1,27 +0,0 @@ -from operator import itemgetter - - -class CommKernel: - def __init__(self, dmgr): - super().__init__() - - def switch_clock(self, external): - pass - - def load(self, kernel_library): - pass - - def run(self): - pass - - def serve(self, embedding_map, symbolizer, demangler): - pass - - def check_system_info(self): - pass - - def get_log(self): - return "" - - def clear_log(self): - pass diff --git a/artiq/coredevice/comm_mgmt.py b/artiq/coredevice/comm_mgmt.py index d4a787622..e50a3167e 100644 --- a/artiq/coredevice/comm_mgmt.py +++ b/artiq/coredevice/comm_mgmt.py @@ -42,7 +42,7 @@ def initialize_connection(host, port): class CommMgmt: - def __init__(self, dmgr, host, port=1380): + def __init__(self, host, port=1380): self.host = host self.port = port diff --git a/artiq/coredevice/core.py b/artiq/coredevice/core.py index 78858d849..1cce9ad7d 100644 --- a/artiq/coredevice/core.py +++ b/artiq/coredevice/core.py @@ -13,6 +13,7 @@ from artiq.compiler.module import Module from artiq.compiler.embedding import Stitcher from artiq.compiler.targets import OR1KTarget +from artiq.coredevice.comm_kernel import CommKernel, CommKernelDummy # Import for side effects (creating the exception classes). from artiq.coredevice import exceptions @@ -50,6 +51,7 @@ def rtio_get_counter() -> TInt64: class Core: """Core device driver. + :param host: hostname or IP address of the core device. :param ref_period: period of the reference clock for the RTIO subsystem. On platforms that use clock multiplication and SERDES-based PHYs, this is the period after multiplication. For example, with a RTIO core @@ -61,7 +63,6 @@ class Core: :param ref_multiplier: ratio between the RTIO fine timestamp frequency and the RTIO coarse timestamp frequency (e.g. SERDES multiplication factor). - :param comm_device: name of the device used for communications. """ kernel_invariants = { @@ -69,13 +70,16 @@ class Core: "external_clock", } - def __init__(self, dmgr, ref_period, external_clock=False, - ref_multiplier=8, comm_device="comm"): + def __init__(self, dmgr, host, ref_period, external_clock=False, + ref_multiplier=8): self.ref_period = ref_period self.external_clock = external_clock self.ref_multiplier = ref_multiplier self.coarse_ref_period = ref_period*ref_multiplier - self.comm = dmgr.get(comm_device) + if host is None: + self.comm = CommKernelDummy() + else: + self.comm = CommKernel(host) self.first_run = True self.dmgr = dmgr diff --git a/artiq/dashboard/moninj.py b/artiq/dashboard/moninj.py index 42150e5e0..716c3ac1b 100644 --- a/artiq/dashboard/moninj.py +++ b/artiq/dashboard/moninj.py @@ -197,7 +197,7 @@ class _DeviceManager: try: if v["type"] == "local": widget = None - if k == "comm": + if k == "core": self.core_addr = v["arguments"]["host"] self.new_core_addr.set() elif v["module"] == "artiq.coredevice.ttl": diff --git a/artiq/examples/drtio/device_db.py b/artiq/examples/drtio/device_db.py index 8171fda1b..2de6862c8 100644 --- a/artiq/examples/drtio/device_db.py +++ b/artiq/examples/drtio/device_db.py @@ -3,17 +3,11 @@ # The list of devices here is not exhaustive. device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel", - "class": "CommKernel", - "arguments": {"host": "kc705.lab.m-labs.hk"} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"ref_period": 2e-9} + "arguments": {"host": "kc705.lab.m-labs.hk", "ref_period": 2e-9} }, "core_cache": { "type": "local", diff --git a/artiq/examples/master/device_db.py b/artiq/examples/master/device_db.py index 513984d6d..b53f53734 100644 --- a/artiq/examples/master/device_db.py +++ b/artiq/examples/master/device_db.py @@ -3,17 +3,11 @@ # The list of devices here is not exhaustive. device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel", - "class": "CommKernel", - "arguments": {"host": "kc705.lab.m-labs.hk"} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"ref_period": 1e-9} + "arguments": {"host": "kc705.lab.m-labs.hk", "ref_period": 1e-9} }, "core_cache": { "type": "local", diff --git a/artiq/examples/phaser/device_db.py b/artiq/examples/phaser/device_db.py index 0f740fae9..d1397efb9 100644 --- a/artiq/examples/phaser/device_db.py +++ b/artiq/examples/phaser/device_db.py @@ -1,17 +1,12 @@ # The RTIO channel numbers here are for Phaser on KC705. device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel", - "class": "CommKernel", - "arguments": {"host": "kc705aux.lab.m-labs.hk"} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", "arguments": { + "host": "kc705aux.lab.m-labs.hk", "ref_period": 5e-9/6 } }, diff --git a/artiq/frontend/artiq_coreanalyzer.py b/artiq/frontend/artiq_coreanalyzer.py index 22cafc5b7..0a5fad21b 100755 --- a/artiq/frontend/artiq_coreanalyzer.py +++ b/artiq/frontend/artiq_coreanalyzer.py @@ -43,7 +43,7 @@ def main(): with open(args.read_dump, "rb") as f: dump = f.read() else: - core_addr = device_mgr.get_desc("comm")["arguments"]["host"] + core_addr = device_mgr.get_desc("core")["arguments"]["host"] dump = get_analyzer_dump(core_addr) decoded_dump = decode_dump(dump) if args.print_decoded: diff --git a/artiq/frontend/artiq_coreboot.py b/artiq/frontend/artiq_coreboot.py index e619bc69a..c39c267e8 100755 --- a/artiq/frontend/artiq_coreboot.py +++ b/artiq/frontend/artiq_coreboot.py @@ -36,7 +36,7 @@ def main(): init_logger(args) device_mgr = DeviceManager(DeviceDB(args.device_db)) try: - core_addr = device_mgr.get_desc("comm")["arguments"]["host"] + core_addr = device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(device_mgr, core_addr) if args.action == "reboot": mgmt.reboot() diff --git a/artiq/frontend/artiq_coreconfig.py b/artiq/frontend/artiq_coreconfig.py index 43aa02739..6f1ff2e42 100755 --- a/artiq/frontend/artiq_coreconfig.py +++ b/artiq/frontend/artiq_coreconfig.py @@ -52,7 +52,7 @@ def main(): init_logger(args) device_mgr = DeviceManager(DeviceDB(args.device_db)) try: - comm = device_mgr.get("comm") + comm = device_mgr.get("core").comm comm.check_system_info() if args.action == "read": diff --git a/artiq/frontend/artiq_corelog.py b/artiq/frontend/artiq_corelog.py index 5ba31ac32..475386fa7 100755 --- a/artiq/frontend/artiq_corelog.py +++ b/artiq/frontend/artiq_corelog.py @@ -37,7 +37,7 @@ def main(): args = get_argparser().parse_args() init_logger(args) - core_addr = DeviceDB(args.device_db).get("comm")["arguments"]["host"] + core_addr = DeviceDB(args.device_db).get("core")["arguments"]["host"] mgmt = CommMgmt(None, core_addr) try: if args.action == "set_level": diff --git a/artiq/test/coredevice/test_analyzer.py b/artiq/test/coredevice/test_analyzer.py index fb7b35ec8..0f3b57495 100644 --- a/artiq/test/coredevice/test_analyzer.py +++ b/artiq/test/coredevice/test_analyzer.py @@ -40,7 +40,7 @@ class WriteLog(EnvExperiment): class AnalyzerTest(ExperimentCase): def test_ttl_pulse(self): - core_host = self.device_mgr.get_desc("comm")["arguments"]["host"] + core_host = self.device_mgr.get_desc("core")["arguments"]["host"] exp = self.create(CreateTTLPulse) exp.initialize_io() @@ -64,7 +64,7 @@ class AnalyzerTest(ExperimentCase): 1000, delta=1) def test_rtio_log(self): - core_host = self.device_mgr.get_desc("comm")["arguments"]["host"] + core_host = self.device_mgr.get_desc("core")["arguments"]["host"] exp = self.create(WriteLog) get_analyzer_dump(core_host) # clear analyzer buffer diff --git a/artiq/test/coredevice/test_moninj.py b/artiq/test/coredevice/test_moninj.py index b69ccd302..2d95e4f8e 100644 --- a/artiq/test/coredevice/test_moninj.py +++ b/artiq/test/coredevice/test_moninj.py @@ -6,7 +6,7 @@ from artiq.test.hardware_testbench import ExperimentCase class MonInjTest(ExperimentCase): def test_moninj(self): - core_host = self.device_mgr.get_desc("comm")["arguments"]["host"] + core_host = self.device_mgr.get_desc("core")["arguments"]["host"] loop_out_channel = self.device_mgr.get_desc("loop_out")["arguments"]["channel"] loop_in_channel = self.device_mgr.get_desc("loop_in")["arguments"]["channel"] diff --git a/artiq/test/coredevice/test_rtio.py b/artiq/test/coredevice/test_rtio.py index 3c8fb0131..1c75ab7ee 100644 --- a/artiq/test/coredevice/test_rtio.py +++ b/artiq/test/coredevice/test_rtio.py @@ -402,7 +402,7 @@ class CoredeviceTest(ExperimentCase): self.execute(SequenceError) def test_collision(self): - core_addr = self.device_mgr.get_desc("comm")["arguments"]["host"] + core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(self.device_mgr, core_addr) mgmt.clear_log() self.execute(Collision) @@ -411,7 +411,7 @@ class CoredeviceTest(ExperimentCase): mgmt.close() def test_address_collision(self): - core_addr = self.device_mgr.get_desc("comm")["arguments"]["host"] + core_addr = self.device_mgr.get_desc("core")["arguments"]["host"] mgmt = CommMgmt(self.device_mgr, core_addr) mgmt.clear_log() self.execute(AddressCollision) @@ -576,7 +576,7 @@ class DMATest(ExperimentCase): exp.nested() def test_dma_trace(self): - core_host = self.device_mgr.get_desc("comm")["arguments"]["host"] + core_host = self.device_mgr.get_desc("core")["arguments"]["host"] exp = self.create(_DMA) exp.record() diff --git a/artiq/test/lit/devirtualization/device_db.py b/artiq/test/lit/devirtualization/device_db.py index 99fa148fd..e39c83c09 100644 --- a/artiq/test/lit/devirtualization/device_db.py +++ b/artiq/test/lit/devirtualization/device_db.py @@ -1,14 +1,8 @@ device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel_dummy", - "class": "CommKernel", - "arguments": {} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"ref_period": 1e-9} + "arguments": {"host": None, "ref_period": 1e-9} } } diff --git a/artiq/test/lit/embedding/device_db.py b/artiq/test/lit/embedding/device_db.py index 99fa148fd..e39c83c09 100644 --- a/artiq/test/lit/embedding/device_db.py +++ b/artiq/test/lit/embedding/device_db.py @@ -1,14 +1,8 @@ device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel_dummy", - "class": "CommKernel", - "arguments": {} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"ref_period": 1e-9} + "arguments": {"host": None, "ref_period": 1e-9} } } diff --git a/artiq/test/lit/escape/device_db.py b/artiq/test/lit/escape/device_db.py index 99fa148fd..e39c83c09 100644 --- a/artiq/test/lit/escape/device_db.py +++ b/artiq/test/lit/escape/device_db.py @@ -1,14 +1,8 @@ device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel_dummy", - "class": "CommKernel", - "arguments": {} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"ref_period": 1e-9} + "arguments": {"host": None, "ref_period": 1e-9} } } diff --git a/artiq/test/lit/regression/device_db.py b/artiq/test/lit/regression/device_db.py index 99fa148fd..e39c83c09 100644 --- a/artiq/test/lit/regression/device_db.py +++ b/artiq/test/lit/regression/device_db.py @@ -1,14 +1,8 @@ device_db = { - "comm": { - "type": "local", - "module": "artiq.coredevice.comm_kernel_dummy", - "class": "CommKernel", - "arguments": {} - }, "core": { "type": "local", "module": "artiq.coredevice.core", "class": "Core", - "arguments": {"ref_period": 1e-9} + "arguments": {"host": None, "ref_period": 1e-9} } }