def test_model_dict_group(): data = [('a','b',10., 1.), ('a','b',100., 1.), ('b','a',10., 1.), ('b','a',100., 1.)] d = model_dict_group(data) mod_dict = d['a', 'b'] int, slope = mod_dict['intercept'], mod_dict['slope'] assert abs(int-1)<.000001 and abs(slope - 0) < .000001
def commtime_dict_mpi(network, nbytes=[10, 100, 1000, 10000]): """ inputs network - dict like {(A, B): {'type': 'mpi'}} nbytes - iterable of byte counts outputs network - dict like {(A, B): {'type': 'mpi', 'intercept':1, 'slope':2}} """ # TODO: This is incorrect. We're assuming that the network is a clique hosts = set(host for (send, recv) in network for host in (send, recv) if network[send, recv]['type'] is 'mpi') performance = model_dict_group(comm_times_group(nbytes, hosts)) # inject new information into network dict return {key: merge(network[key], performance[key]) for key in performance}