forked from M-Labs/artiq
1
0
Fork 0

language/core: add 'portable' decorator

This commit is contained in:
Sebastien Bourdeauducq 2014-10-13 17:04:32 +08:00
parent 4361c7cb49
commit 482f4651ff
1 changed files with 14 additions and 0 deletions

View File

@ -223,6 +223,20 @@ def kernel(arg):
return run_on_core 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: class _DummyTimeManager:
def _not_implemented(self, *args, **kwargs): def _not_implemented(self, *args, **kwargs):
raise NotImplementedError( raise NotImplementedError(