Exemplo n.º 1
0
def main():
    #print dir(hello)
    import sys
    print sys.modules['__main__'].__file__

    a = nesoni.future(func, 'a', [])
    b = nesoni.future(func, 'b', [])
    c = nesoni.future(func, 'c', [a, b])
    d = nesoni.future(func, 'd', [a, b])

    c()
    d()

    #print legion.coordinator().get_cores()
    #legion.coordinator().job(hello)

    with Timer('100 status updates'):
        for i in xrange(100):
            grace.status(str(i))
        grace.status('')

    with Timer('100 parallel threads'):

        @nesoni.thread_for(xrange(100))
        def loop(i):
            pass

    with Timer('100 parallel processes'):
        nesoni.parallel_for(xrange(100))(do_nothing)

    with Timer('100 parallel processes updating statuses'):
        nesoni.parallel_for(xrange(100))(do_status)
Exemplo n.º 2
0
def main():
    #print dir(hello)
    import sys
    print sys.modules['__main__'].__file__
    
    a = nesoni.future(func,'a',[])
    b = nesoni.future(func,'b',[])
    c = nesoni.future(func,'c',[a,b])
    d = nesoni.future(func,'d',[a,b])
    
    c()
    d()

    #print legion.coordinator().get_cores()
    #legion.coordinator().job(hello)

    with Timer('100 status updates'):
        for i in xrange(100):
            grace.status(str(i))
        grace.status('')

    with Timer('100 parallel threads'):
        @nesoni.thread_for(xrange(100))
        def loop(i):
            pass

    with Timer('100 parallel processes'):
        nesoni.parallel_for(xrange(100))(do_nothing)

    with Timer('100 parallel processes updating statuses'):
        nesoni.parallel_for(xrange(100))(do_status)
Exemplo n.º 3
0
    def depth_test(self, ref, variant, others=[]):
        depths = range(1, 30 + 1)
        #results = [ self.tryout(ref, ['%sx%d'%(variant,i)] + others) for i in depths ]
        result_futures = [
            nesoni.future(self.tryout, ref, ['%sx%d' % (variant, i)] + others)
            for i in depths
        ]
        results = [item() for item in result_futures]

        report = '%s -> %s' % (ref or '-', variant or '-')
        if others: report += '  with contamination  ' + ', '.join(others)
        report += '\n'

        if self.legacy:
            report += 'nesoni consensus: [' + ''.join(
                '+' if item[1] else 'X' if item[0] else ' '
                for item in results) + ']\n'
        report += 'VCF pipeline      [' + ''.join(
            '+' if item[3] else 'X' if item[2] else ' '
            for item in results) + ']\n'

        depth_line = ''
        for i in depths:
            if i == 1 or i % 5 == 0:
                depth_line += ' ' * (i - len(depth_line)) + str(i)
        report += 'depth             ' + depth_line + '\n'

        return report
Exemplo n.º 4
0
    def depth_test(self, ref, variant, others=[]):
        depths = range(1,30+1)
        #results = [ self.tryout(ref, ['%sx%d'%(variant,i)] + others) for i in depths ]
        result_futures = [ nesoni.future(self.tryout, ref, ['%sx%d'%(variant,i)] + others) for i in depths ]
        results = [ item() for item in result_futures ]
        
        report = '%s -> %s' % (ref or '-', variant or '-')
        if others: report += '  with contamination  ' + ', '.join(others)
        report += '\n'
        
        if self.legacy:
            report += 'nesoni consensus: [' + ''.join( '+' if item[1] else 'X' if item[0] else ' ' for item in results ) + ']\n'
        report += 'VCF pipeline      [' + ''.join( '+' if item[3] else 'X' if item[2] else ' ' for item in results ) + ']\n'

        depth_line = ''
        for i in depths:
            if i == 1 or i % 5 == 0:
                depth_line += ' '*(i-len(depth_line)) + str(i)
        report += 'depth             '+depth_line+'\n'
        
        return report
Exemplo n.º 5
0
 def run(self):
     f = nesoni.future(self.hello)
     print f()
Exemplo n.º 6
0
 def run(self):
     f = nesoni.future(self.hello)
     print f()