Exemplo n.º 1
0
 def taskDone(self):
     self.tasks_completed += 1
     if self.tasks_completed == self.num_workers * TASKS_PER_WORKER:
         self.tasks_completed = 0
         self.iteration += 1
         if self.iteration == NUM_ITERS:
             charm.printStats()
             exit()
         else:
             self.sendWork()
Exemplo n.º 2
0
 def iterationComplete(self):
     if self.iterations % 10 == 0:
         print('Iteration', self.iterations, 'complete')
     self.iterations += 1
     if self.iterations == MAX_ITER:
         print('Program done. Total time =', time.time() - self.startTime)
         charm.printStats()
         exit()
     else:
         self.testProxy.doIteration()
Exemplo n.º 3
0
 def __init__(self, args):
     ro.X = 47
     num_chares = min(charm.numPes() * CHARES_PER_PE, MAX_CHARES)
     assert num_chares % 2 == 0
     workers = Array(Worker, num_chares, args=[self.thisProxy])
     self.num_responses1 = self.num_responses2 = 0
     self.result = 0
     for i in range(NUM_ITER):
         workers.sendVal()
         self.wait("self.num_responses1 == " + str(num_chares // 2) +
                   " and 33 == TEST_GLOBAL")
         self.wait("self.num_responses2 == " + str(num_chares // 2) +
                   " and 47 == ro.X")
         assert (self.result == num_chares * 237)
         assert (self.num_responses1 == num_chares // 2)
         assert (self.num_responses2 == num_chares // 2)
         self.num_responses1 = self.num_responses2 = 0
         self.result = 0
     charm.printStats()
     exit()
Exemplo n.º 4
0
 def done(self):
     print('Program done in', time.time() - self.startTime)
     charm.printStats()
     exit()
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
 def done(self):
     charm.printStats()
     exit()