2
2
Core ARTIQ extensions to the Python language.
3
3
"""
4
4
5
- from collections import namedtuple as _namedtuple
6
- from functools import wraps as _wraps
5
+ from collections import namedtuple
6
+ from functools import wraps
7
+
8
+
9
+ __all__ = ["int64" , "round64" , "kernel" , "portable" ,
10
+ "set_time_manager" , "set_syscall_manager" , "set_watchdog_factory" ,
11
+ "RuntimeException" ]
12
+
13
+ # global namespace for kernels
14
+ kernel_globals = ("sequential" , "parallel" ,
15
+ "delay_mu" , "now_mu" , "at_mu" , "delay" ,
16
+ "seconds_to_mu" , "mu_to_seconds" ,
17
+ "syscall" , "watchdog" )
18
+ __all__ .extend (kernel_globals )
7
19
8
20
9
21
class int64 (int ):
@@ -65,7 +77,7 @@ def round64(x):
65
77
return int64 (round (x ))
66
78
67
79
68
- _KernelFunctionInfo = _namedtuple ("_KernelFunctionInfo" , "core_name k_function" )
80
+ _KernelFunctionInfo = namedtuple ("_KernelFunctionInfo" , "core_name k_function" )
69
81
70
82
71
83
def kernel (arg ):
@@ -89,16 +101,16 @@ def kernel(arg):
89
101
"""
90
102
if isinstance (arg , str ):
91
103
def real_decorator (k_function ):
92
- @_wraps (k_function )
104
+ @wraps (k_function )
93
105
def run_on_core (exp , * k_args , ** k_kwargs ):
94
- return getattr (exp , arg ).run (k_function ,
106
+ return getattr (exp , arg ).run (k_function ,
95
107
((exp ,) + k_args ), k_kwargs )
96
108
run_on_core .k_function_info = _KernelFunctionInfo (
97
109
core_name = arg , k_function = k_function )
98
110
return run_on_core
99
111
return real_decorator
100
112
else :
101
- @_wraps (arg )
113
+ @wraps (arg )
102
114
def run_on_core (exp , * k_args , ** k_kwargs ):
103
115
return exp .core .run (arg , ((exp ,) + k_args ), k_kwargs )
104
116
run_on_core .k_function_info = _KernelFunctionInfo (
@@ -160,13 +172,6 @@ def set_syscall_manager(syscall_manager):
160
172
global _syscall_manager
161
173
_syscall_manager = syscall_manager
162
174
163
- # global namespace for kernels
164
-
165
- kernel_globals = ("sequential" , "parallel" ,
166
- "delay_mu" , "now_mu" , "at_mu" , "delay" ,
167
- "seconds_to_mu" , "mu_to_seconds" ,
168
- "syscall" , "watchdog" )
169
-
170
175
171
176
class _Sequential :
172
177
"""In a sequential block, statements are executed one after another, with
0 commit comments