def test_comm_size_unity(self): s_comm = comm.Split(comm.Get_rank(), 0) assert get_HybridComm_obj(s_comm) is d_comm s_comm.Free()
def array(self): np.random.seed(comm.Get_rank()) return (np.random.rand(size, 10))
# %% IMPORTS # Built-in imports from types import BuiltinMethodType, MethodType # Package imports import numpy as np import pytest # mpi4pyd imports from mpi4pyd import MPI from mpi4pyd.dummyMPI import COMM_WORLD as d_comm from mpi4pyd.MPI import (COMM_WORLD as comm, HYBRID_COMM_WORLD as h_comm, get_HybridComm_obj) # Get size and rank rank = comm.Get_rank() size = comm.Get_size() # Get method types m_types = (BuiltinMethodType, MethodType) # %% PYTEST CLASSES AND FUNCTIONS # Pytest for get_HybridComm_obj() function class Test_get_HybridComm_obj(object): # Test if default input arguments work def test_default(self): assert get_HybridComm_obj() is h_comm # Test if providing comm returns h_comm def test_comm(self):