From 482f4651ffa32eddbf8725fe2a58142590dbb11f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 13 Oct 2014 17:04:32 +0800 Subject: [PATCH] language/core: add 'portable' decorator --- artiq/language/core.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/artiq/language/core.py b/artiq/language/core.py index 5a8b98df8..02f89899b 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -223,6 +223,20 @@ def kernel(arg): return run_on_core +def portable(f): + """This decorator marks a function for execution on the same device as its + caller. + + In other words, a decorated function called from the interpreter on the + host will be executed on the host (no compilation and execution on the + core device). A decorated function called from a kernel will be executed + on the core device (no RPC). + + """ + f.k_function_info = _KernelFunctionInfo(core_name="", k_function=f) + return f + + class _DummyTimeManager: def _not_implemented(self, *args, **kwargs): raise NotImplementedError(