Skip to content

Commit 99213b1

Browse files
author
Bart van der Vecht
committed
Clean up host
1 parent 11bc52d commit 99213b1

File tree

3 files changed

+11
-34
lines changed

3 files changed

+11
-34
lines changed

squidasm/qoala/lang/lhr.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
import abc
22
from dataclasses import dataclass
33
from enum import Enum, auto
4-
from typing import Dict, List, Optional, Union
4+
from typing import Any, Dict, List, Optional, Union
55

66
from netqasm.lang.instr import NetQASMInstruction
77
from netqasm.lang.instr.flavour import NVFlavour
88
from netqasm.lang.operand import Template
99
from netqasm.lang.parsing.text import parse_text_subroutine
1010
from netqasm.lang.subroutine import Subroutine
1111

12-
from squidasm.qoala.runtime.program import ProgramContext, ProgramMeta
13-
1412
LhrValue = Union[int, Template]
1513

1614

15+
@dataclass
16+
class ProgramMeta:
17+
name: str
18+
parameters: Dict[str, Any]
19+
csockets: List[str]
20+
epr_sockets: List[str]
21+
max_qubits: int
22+
23+
1724
class LhrInstructionType(Enum):
1825
CC = 0
1926
CL = auto()
@@ -362,9 +369,6 @@ def __str__(self) -> str:
362369
# return "\n".join(" " + i for i in instrs)
363370
return "\n".join(" " + str(i) for i in self.instructions)
364371

365-
def compile(self, context: ProgramContext) -> None:
366-
raise NotImplementedError
367-
368372

369373
class EndOfTextException(Exception):
370374
pass

squidasm/qoala/runtime/program.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from netqasm.sdk.classical_communication.socket import Socket
66
from netqasm.sdk.connection import BaseNetQASMConnection
7-
from netqasm.sdk.epr_socket import EPRSocket
87

98
from squidasm.qoala.lang.lhr import LhrProgram
109

@@ -14,12 +13,10 @@ def __init__(
1413
self,
1514
netqasm_connection: BaseNetQASMConnection,
1615
csockets: Dict[str, Socket],
17-
epr_sockets: Dict[str, EPRSocket],
1816
app_id: int,
1917
):
2018
self._connection = netqasm_connection
2119
self._csockets = csockets
22-
self._epr_sockets = epr_sockets
2320
self._app_id = app_id
2421

2522
@property
@@ -30,31 +27,11 @@ def connection(self) -> BaseNetQASMConnection:
3027
def csockets(self) -> Dict[str, Socket]:
3128
return self._csockets
3229

33-
@property
34-
def epr_sockets(self) -> Dict[str, EPRSocket]:
35-
return self._epr_sockets
36-
3730
@property
3831
def app_id(self) -> int:
3932
return self._app_id
4033

4134

42-
@dataclass
43-
class ProgramMeta:
44-
name: str
45-
parameters: Dict[str, Any]
46-
csockets: List[str]
47-
epr_sockets: List[str]
48-
max_qubits: int
49-
50-
51-
class Program(abc.ABC):
52-
@property
53-
def meta(self) -> ProgramMeta:
54-
raise NotImplementedError
55-
56-
def run(self, context: ProgramContext) -> Dict[str, Any]:
57-
raise NotImplementedError
5835

5936

6037
@dataclass

squidasm/qoala/sim/host.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def setup(self) -> Generator[EventExpression, None, None]:
5757
compiler=self._host._compiler,
5858
)
5959

60-
# Create EPR sockets that can be used by the program SDK code.
61-
epr_sockets: Dict[int, EPRSocket] = {}
60+
# Open the EPR sockets required by the program.
6261
for i, remote_name in enumerate(prog_meta.epr_sockets):
6362
remote_id = None
6463

@@ -72,8 +71,6 @@ def setup(self) -> Generator[EventExpression, None, None]:
7271
self._host.send_qnos_msg(
7372
bytes(OpenEPRSocketMessage(self._app_id, i, remote_id))
7473
)
75-
epr_sockets[remote_name] = EPRSocket(remote_name, i)
76-
epr_sockets[remote_name].conn = conn
7774

7875
# Create classical sockets that can be used by the program SDK code.
7976
classical_sockets: Dict[int, ClassicalSocket] = {}
@@ -94,7 +91,6 @@ def setup(self) -> Generator[EventExpression, None, None]:
9491
self._context = ProgramContext(
9592
netqasm_connection=conn,
9693
csockets=classical_sockets,
97-
epr_sockets=epr_sockets,
9894
app_id=self._app_id,
9995
)
10096

0 commit comments

Comments
 (0)