How to use the pyuvsim.mpi.world_comm.bcast function in pyuvsim

To help you get started, we’ve selected a few pyuvsim 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 RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / simsetup.py View on Github external
def share(self, root=0):
        """
        Share across MPI processes. (requires mpi4py to use).
        All attributes are put in shared memory.
        """
        if mpi is None:
            raise ImportError("You need mpi4py to use this method. "
                              "Install it by running pip install pyuvsim[sim] "
                              "or pip install pyuvsim[all] if you also want the "
                              "line_profiler installed.")
        mpi.start_mpi()
        self.Ncomponents = mpi.world_comm.bcast(self.Ncomponents, root=root)

        # Get list of attributes that are set.
        isset = None
        if mpi.rank == root:
            isset = [key for key, value in self.__dict__.items() if value is not None]
        isset = mpi.world_comm.bcast(isset, root=root)

        for key in isset:
            attr = getattr(self, key)
            if key in self.put_in_shared:
                val = mpi.shared_mem_bcast(attr, root=root)
            else:
                val = mpi.world_comm.bcast(attr, root=root)
            if val is not None:
                setattr(self, key, val)
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / simsetup.py View on Github external
Share across MPI processes. (requires mpi4py to use).
        All attributes are put in shared memory.
        """
        if mpi is None:
            raise ImportError("You need mpi4py to use this method. "
                              "Install it by running pip install pyuvsim[sim] "
                              "or pip install pyuvsim[all] if you also want the "
                              "line_profiler installed.")
        mpi.start_mpi()
        self.Ncomponents = mpi.world_comm.bcast(self.Ncomponents, root=root)

        # Get list of attributes that are set.
        isset = None
        if mpi.rank == root:
            isset = [key for key, value in self.__dict__.items() if value is not None]
        isset = mpi.world_comm.bcast(isset, root=root)

        for key in isset:
            attr = getattr(self, key)
            if key in self.put_in_shared:
                val = mpi.shared_mem_bcast(attr, root=root)
            else:
                val = mpi.world_comm.bcast(attr, root=root)
            if val is not None:
                setattr(self, key, val)

        mpi.world_comm.Barrier()
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / simsetup.py View on Github external
"line_profiler installed.")
        mpi.start_mpi()
        self.Ncomponents = mpi.world_comm.bcast(self.Ncomponents, root=root)

        # Get list of attributes that are set.
        isset = None
        if mpi.rank == root:
            isset = [key for key, value in self.__dict__.items() if value is not None]
        isset = mpi.world_comm.bcast(isset, root=root)

        for key in isset:
            attr = getattr(self, key)
            if key in self.put_in_shared:
                val = mpi.shared_mem_bcast(attr, root=root)
            else:
                val = mpi.world_comm.bcast(attr, root=root)
            if val is not None:
                setattr(self, key, val)

        mpi.world_comm.Barrier()