def main(): start = hpx.time_now() num_ranks = hpx.get_num_ranks() and_lco = hpx.And(num_ranks) for i in range(num_ranks): worker(hpx.THERE(i), i, num_ranks, rsync_lco=and_lco) and_lco.wait() print(hpx.time_elapsed_ms(start)) hpx.exit()
def main(): num_ranks = hpx.get_num_ranks() print(num_ranks) array = hpx.GlobalMemory.alloc_cyclic(num_ranks, (64, 1024, 1024), dtype=np.dtype(float)) start = hpx.time_now() and_lco = hpx.And(num_ranks) for i in range(num_ranks): copy_from_array(hpx.THERE(i), array, i, num_ranks, rsync_lco=and_lco) and_lco.wait() print(hpx.time_elapsed_ms(start)) hpx.exit()
def main_action(): num_node = hpx.get_num_ranks() print("program runs on {0} nodes".format(num_node)) step_size = (high - low) / total_cells cell_per_node = total_cells // num_node result_lco = hpx.Reduce(num_node, (1, ), np.dtype(float), result_init, result_op) for i in range(num_node): calculate_integral(hpx.THERE(i), low + i * step_size * cell_per_node, step_size, cell_per_node, result_lco) print(result_lco.get()) print(fint(high) - fint(low)) hpx.exit()
def set_domain_size(domain_size_arg): global domain_size, domain_count domain_size = domain_size_arg domain_count = hpx.get_num_ranks() return hpx.SUCCESS