Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions netqmpi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0"
1 change: 0 additions & 1 deletion netqmpi/runtime/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import importlib
import subprocess
import sys
import os
import time
Expand Down
7 changes: 2 additions & 5 deletions netqmpi/sdk/communicator/communicator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from typing import List

import netqasm.sdk.toolbox
import numpy as np
from netqasm.sdk import EPRSocket, Qubit, set_qubit_state
from netqasm.sdk import EPRSocket, Qubit
from netqasm.sdk.classical_communication.broadcast_channel import BroadcastChannel
from netqasm.sdk.classical_communication.message import StructuredMessage
from netqasm.sdk.external import Socket
from netqasm.sdk.external import NetQASMConnection
from netqasm.sdk.toolbox import create_ghz
from netqasm.sdk.classical_communication.broadcast_channel import BroadcastChannel, BroadcastChannelBySockets

from netqmpi.sdk.primitives.collective.collective import CollectiveCommTeledata, CollectiveCommTelegate
from netqmpi.sdk.primitives.p2p import P2PCommTeledata
Expand Down Expand Up @@ -47,8 +46,6 @@ def __init__(self, rank, size, app_config):
# Get remote app names
remote_app_names = [self.__get_rank_name(i) for i in range(size) if i != rank]

# self.broadcast_channel = BroadcastChannelBySockets(self.__get_rank_name(rank), remote_app_names)

def __enter__(self):
self.connection.__enter__()
return self
Expand Down
6 changes: 4 additions & 2 deletions netqmpi/sdk/primitives/collective/collective.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def expose(communicator: "QMPICommunicator", qubits: List[Qubit], rank: int = 0)
bit = int(measure)

# If bit is 1, apply an X gate to the GHZ qubit
bit and communicator.ghz_qubit.X()
if bit:
communicator.ghz_qubit.X()
qubits.insert(0, communicator.ghz_qubit)

@staticmethod
Expand All @@ -186,7 +187,8 @@ def unexpose(communicator: "QMPICommunicator", rank: int = 0) -> None:
communicator.connection.flush()

# Compute AND of all bits
np.bitwise_and.reduce(bits) and communicator.ghz_qubit.Z()
if np.bitwise_and.reduce(bits):
communicator.ghz_qubit.Z()

else:
# Apply Hadamard gate to the GHZ qubit
Expand Down