diff --git a/netqmpi/__init__.py b/netqmpi/__init__.py index e69de29..3dc1f76 100644 --- a/netqmpi/__init__.py +++ b/netqmpi/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/netqmpi/runtime/cli.py b/netqmpi/runtime/cli.py index 7582164..acafac4 100644 --- a/netqmpi/runtime/cli.py +++ b/netqmpi/runtime/cli.py @@ -1,6 +1,5 @@ import argparse import importlib -import subprocess import sys import os import time diff --git a/netqmpi/sdk/communicator/communicator.py b/netqmpi/sdk/communicator/communicator.py index 73b9bfc..7c72a1b 100644 --- a/netqmpi/sdk/communicator/communicator.py +++ b/netqmpi/sdk/communicator/communicator.py @@ -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 @@ -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 diff --git a/netqmpi/sdk/primitives/collective/collective.py b/netqmpi/sdk/primitives/collective/collective.py index 24c2c4e..dab897e 100644 --- a/netqmpi/sdk/primitives/collective/collective.py +++ b/netqmpi/sdk/primitives/collective/collective.py @@ -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 @@ -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