How to use the libensemble.comms.comms.QComm function in libensemble

To help you get started, we’ve selected a few libensemble examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, main, *args, **kwargs):
        self.inbox = Queue()
        self.outbox = Queue()
        self._result = None
        self._exception = None
        self._done = False
        comm = QComm(self.inbox, self.outbox)
        self.process = Process(target=QCommProcess._qcomm_main,
                               args=(comm, main) + args, kwargs=kwargs)
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, main, *args, **kwargs):
        self.inbox = Queue()
        self.outbox = Queue()
        self._result = None
        self._exception = None
        self._done = False
        comm = QComm(self.inbox, self.outbox)
        self.process = Process(target=QCommProcess._qcomm_main,
                               args=(comm, main) + args, kwargs=kwargs)
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def get_num_workers(self):
        """Return global _ncomms"""
        return QComm._ncomms.value
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, inbox, outbox, copy_msg=False):
        "Set the inbox and outbox queues."
        self._inbox = inbox
        self._outbox = outbox
        self._copy = copy_msg
        self._pushback = None
        with QComm.lock:
            QComm._ncomms.value += 1
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, inbox, outbox, copy_msg=False):
        "Set the inbox and outbox queues."
        self._inbox = inbox
        self._outbox = outbox
        self._copy = copy_msg
        self.recv_buffer = None
        with QComm.lock:
            QComm._ncomms.value += 1
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, main, *args, **kwargs):
        self.inbox = queue.Queue()
        self.outbox = queue.Queue()
        self.main = main
        self._result = None
        self._exception = None
        kwargs['comm'] = QComm(self.inbox, self.outbox, True)
        self.thread = Thread(target=self._qcomm_main,
                             args=args, kwargs=kwargs)
github Libensemble / libensemble / libensemble / comms / tcp_mgr.py View on Github external
def await_workers(self, nworkers):
        "Wait for a pool of workers to join."
        sharedq = self.get_shared()
        wqueues = []
        for _ in range(nworkers):
            workerID = sharedq.get()
            inbox = self.get_outbox(workerID)
            outbox = self.get_inbox(workerID)
            wqueues.append(QComm(inbox, outbox))
        return wqueues
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, main, *args, **kwargs):
        self.inbox = queue.Queue()
        self.outbox = queue.Queue()
        self.main = main
        self._result = None
        self._exception = None
        kwargs['comm'] = QComm(self.inbox, self.outbox, True)
        self.thread = Thread(target=self._qcomm_main,
                             args=args, kwargs=kwargs)
github Libensemble / libensemble / libensemble / comms / comms.py View on Github external
def __init__(self, inbox, outbox, copy_msg=False):
        "Set the inbox and outbox queues."
        self._inbox = inbox
        self._outbox = outbox
        self._copy = copy_msg
        self.recv_buffer = None
        with QComm.lock:
            QComm._ncomms.value += 1
github Libensemble / libensemble / libensemble / comms / tcp_mgr.py View on Github external
def __enter__(self):
        "Enter the context."
        return QComm(self.get_inbox(), self.get_outbox())