def main(args): my = Mytest() tree = my.tree driver = my.cal() very_start = time() f = charm.createFuture() f_other = charm.createFuture() ro.driver = driver step3_array = Array(step3_chare, args=[6, f], dims=6, map=Group(WorkerMap)) my_array = Array(MyChare, args=[f_other, tree.nsources], dims=2) for i in range(0, 6): step3_array[i].index_setter(i) step3_array.calculate() driver.step21() driver.step22() my_array[0].summation_setter(driver) my_array[0].flag_setter("4") my_array[1].summation_setter(driver) my_array[1].flag_setter("6") my_array.work() local_result = driver.step5() if driver.traversal.from_sep_close_bigger_starts is not None: step_6_extra = driver.step6_extra() local_result += step_6_extra local_result += f.get() local_exps = f_other.get() local_exps = driver.wrangler.refine_locals( driver.traversal.level_start_target_or_target_parent_box_nrs, driver.traversal.target_or_target_parent_boxes, local_exps) local_result_from_exp = driver.wrangler.eval_locals( driver.traversal.level_start_target_box_nrs, driver.traversal.target_boxes, local_exps) end = time() result = driver.wrangler.reorder_potentials(local_result_from_exp + local_result) result = driver.wrangler.finalize_potentials(result) print("at the end:" + str(end - very_start)) assert (result == driver.src_weights.sum()).all() exit()
def main(args): my = Mytest() tree = my.tree driver = my.cal() ti = time() very_start = time() f = charm.createFuture() f_other = charm.createFuture() creation_time = time() step4_future = charm.createFuture() step6_future = charm.createFuture() step3_array = Array(step3_chare, args=[driver, 4, f], dims=4, map=Group(WorkerMap)) for i in range(0,4): step3_array[i].index_setter(i) step3_array.calculate() ro.driver = driver print("hehheh") #a = np.zeros(9000000) #driver.step3() driver.step21() driver.step22() step4_array = Array(step4_chare, args=[ 2, step4_future], dims=2, map=Group(ExpWorkerMap)) step6_array = Array(step6_chare, args=[ 2, step6_future], dims=2, map=Group(ExpWorkerMap2)) for i in range(0,2): step4_array[i].index_setter(i) step6_array[i].index_setter(i) step4_array.calculate() step6_array.calculate() #print("creation for step3 finished " + str(time() - creation_time)) #start = time() #print(start - ti) #my_array = Array(MyChare, args=[driver, f_other], dims=2) # create one instance of MyChare on every processor #my_group = Group(MyChare) # create 3 instances of MyChare, distributed among the cores by the runtime #first = MyChare() # create 2 x 2 instances of MyChare, indexed using 2D index and distributed # among all cores by the runtime #my_2d_array = Array(MyChare, (2, 2)) #charm.awaitCreation(my_array) #while(True): # pass #print("###############################3") #charm.awaitCreation(first) #charm.awaitCreation(my_array) #from CustomGreen import CustomConstantOneExpansionWrangler #c = CustomConstantOneExpansionWrangler(tree) #my_array[0].time_setter(ti) #my_array[0].summation_setter(driver) tii = time() #print("time for creating two array, step1,2 and mmy array start:" + str(time() - start)) #my_array.work() #print(local_result) local_exps = step4_future.get() + step6_future.get() local_result = f.get() local_result += driver.step5() print("time to get local_result:" + str(time() - tii)) local_exps = driver.wrangler.refine_locals(driver.traversal.level_start_target_or_target_parent_box_nrs, driver.traversal.target_or_target_parent_boxes, local_exps) local_result_from_exp = driver.wrangler.eval_locals( driver.traversal.level_start_target_box_nrs, driver.traversal.target_boxes, local_exps) # end = time() result = driver.wrangler.reorder_potentials(local_result_from_exp + local_result) result = driver.wrangler.finalize_potentials(result) print("at the end:"+str(end - very_start)) #print(result) assert (result == 9000000).all() charm.printStats() exit()