def tree_main(pool, SEQ, num_procs): """Using multiproccessing to see if it is faster Try using the recursive tree approach to the reduction. :returns: The sum over SEQ """ answers = SEQ count = parutils.reduction_tree(pool, parutils.star_add, answers, NP) return count
def tree_main(pool, num_procs): """Using multiproccessing to see if it is faster Try using the recursive tree approach to the reduction. :returns: The sum over SEQ """ timer.tic("map_tree") bools = pool.map(is_prime, SEQ, scale) timer.toc("map_tree") timer.tic("list_tree") answers = list(bools) timer.toc("list_tree") timer.tic("reduce_tree") count = parutils.reduction_tree(pool, parutils.star_add, answers, NP) timer.toc("reduce_tree") return count