qubic.job_rpc_server
Module for running a multi-board job server. Clients can submit batches of compiled executables to this server using the normal CircuitRunnerClient. These executables can span multiple boards, as resolved by the ChannelConfig file. For details on configuring and running the job server, see (wiki page coming soon!). Individual boards will receive partial executables and synchronized triggers via the normal soc_rpc_server.
JobServer
Class for managing a multi-board job server with synchronization. General flow is:
1. User submits job (list of compiled executables) to this server via RPC using
`run_circuit_batch`
2. Server initiates PTP offset correction to synchronize boards
3. For each circuit:
a. upload partial executable to each board
b. for each batch of 1024 shots:
1) initiate timed trigger on each board
2) wait for results
c. concatenate all results
4. Return batched results to user, in same format as the normal CircuitRunner
In principle, can support a single master board with arbitrary number of slaves; although only 2-board configurations have been tested.
Source code in qubic/job_rpc_server.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
__init__(board_configs, sync_graph)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
board_configs
|
Dict[str, Dict]
|
dictionary of boards, keyed by board name values are Dicts, with fields: mode (master or slave), ip, port |
required |
Source code in qubic/job_rpc_server.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
run_circuit_batch(executables, n_total_shots, reads_per_shot=None, timeout_per_shot=8, reload_cmd=True, reload_freq=True, reload_env=True, zero_between_reload=True, ddr=False)
Runs a batch of circuits given by a list of compiled executables. Each circuit is run n_total_shots
times. reads_per_shot and n_total_shots are passed directly into run_circuit, and must
be the same for all circuits in the batch. The parameters reload_cmd, reload_freq, reload_env, and
zero_between_reload control which of these fields is rewritten circuit-to-circuit (everything is
rewritten initially). Leave these all at True (default) for maximum safety, to ensure that QubiC
is in a clean state before each run. Depending on the circuits, some of these can be turned off
to save time.
TODO: consider throwing some version of all the args here into a BatchedCircuitRun or somesuch object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executables
|
List[Executable]
|
list of executables to run |
required |
n_total_shots
|
int
|
number of shots per circuit |
required |
reads_per_shot
|
int | Dict[str, int]
|
number of values per shot per channel to read back from accbuf. Unless
there is mid-circuit measurement involved this is typically 1. If |
None
|
timeout_per_shot
|
float
|
maximum allowable wall clock time (in seconds) per single shot of the circuit |
8
|
reload_cmd
|
bool
|
if True, reload command buffer between circuits |
True
|
reload_freq
|
bool
|
if True, reload freq buffer between circuits |
True
|
reload_env
|
bool
|
if True, reload env buffer between circuits |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict
|
Complex IQ shots for each accbuf in chanlist; each array has shape (len(raw_asm_list), n_total_shots, reads_per_shot) |
Source code in qubic/job_rpc_server.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
ServerConfig
Wrapper around jobserver_config.yaml (example in `scripts/')
Attributes:
| Name | Type | Description |
|---|---|---|
host_ip |
str
|
host IP of the job server |
host_port |
int
|
host port of the job server |
boards |
Dict[str, Dict]
|
Boards controlled by this server. Each board is keyed by its name (as defined in the channel_config file); attributes are 'master'/'slave', IP, and port |
log_level |
str
|
'info' (default) or 'debug' |
Source code in qubic/job_rpc_server.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
run_job_server(server_config)
Run the RPC job server using the provided job server config. Exposes JobServer.run_circuit_batch and
JobServer.load_and_run_acq. Boards are assumed to be running their own RPC servers using qubic.soc_rpc_server
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_config
|
|
required |
Source code in qubic/job_rpc_server.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |