Esempio n. 1
0
 def __init__(self, prodder):
     condition = CondEq(Function('omp_get_thread_num')(), 0)
     then_body = Call(prodder.name, prodder.arguments)
     Conditional.__init__(self, condition, then_body)
     Prodder.__init__(self,
                      prodder.name,
                      prodder.arguments,
                      periodic=prodder.periodic)
Esempio n. 2
0
    def __init__(self, prodder):
        # Atomic-ize any single-thread Prodders in the parallel tree
        condition = CondEq(Ompizer.lang['thread-num'], 0)

        # Prod within a while loop until all communications have completed
        # In other words, the thread delegated to prodding is entrapped for as long
        # as it's required
        prod_until = Not(DefFunction(prodder.name, [i.name for i in prodder.arguments]))
        then_body = List(header=c.Comment('Entrap thread until comms have completed'),
                         body=While(prod_until))

        Conditional.__init__(self, condition, then_body)
        Prodder.__init__(self, prodder.name, prodder.arguments, periodic=prodder.periodic)