예제 #1
0
def main():
    print('This is an example of how to use the "progress" function.')
    from compmake import Context

    c = Context()

    c.comp(mylongfunction)

    # Run command passed on command line or otherwise run console.    
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake recurse=1" to make all.')
        c.compmake_console()
예제 #2
0
def main():
    print('This is an example of how to use the "progress" function.')
    from compmake import Context

    c = Context()

    c.comp(mylongfunction)

    # Run command passed on command line or otherwise run console.    
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake recurse=1" to make all.')
        c.compmake_console()
예제 #3
0
def main():
    from compmake import Context

    c = Context()

    for param1 in [1, 2, 3]:
        for param2 in [10, 11, 12]:
            res1 = c.comp(func1, param1)
            res2 = c.comp(func2, res1, param2)
            c.comp(draw, res2)

    # Run command passed on command line or otherwise run console.    
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake recurse=1" to make all.')
        c.compmake_console()
예제 #4
0
from mycomputations import funcA, funcB, draw

if __name__ == '__main__':
    from compmake import Context
    context = Context()

    for param_a in [1, 2, 3]:
        for param_b in [10, 11, 12]:
            prefix = 'a%s-b%s' % (param_a, param_b)
            context.comp_prefix(prefix)

            # use job_id to override default naming
            res1 = context.comp(funcA, param_a, job_id='preparing')
            res2 = context.comp(funcB, res1, param_b, job_id='computing')
            context.comp(draw, res2, job_id='drawing')

    context.compmake_console()
예제 #5
0
    print('draw(%s)' % res2)

if __name__ == '__main__':
    from compmake import Context
    context = Context()
    # A typical pattern: you want to try 
    # many combinations of parameters
    for param1 in [1,2,3]:
        for param2 in [10,11,12]:
            # Simply use "y = comp(f, x)" whenever
            # you would have used "y = f(x)".
            res1 = context.comp(funcA, param1)
            # You can use return values as well.
            res2 = context.comp(funcB, res1, param2)
            context.comp(draw, res2)

    # Now, a few options to run this:
    # 1) Call this file using the compmake program:
    #  $ python example.py
    #  and then run "make" at the prompt.
    # 2) Give the command on the command line:
    #  $ python example.py "make"
    import sys
    if len(sys.argv) == 1:
        print('Presenting an interactive console')
        context.compmake_console()
    else:
        print('Running the computation in batch mode')
        cmd = " ".join(sys.argv[1:])
        context.batch_command(cmd)
예제 #6
0
    from compmake import Context
    c = Context()

    branch = 10
    print('We will now define a hierarchy of %d x %d x %d = %d jobs.' %
          (branch, branch, branch, branch * branch * branch))
    print('Each can fail randomly with probability %f.' % failure_prob)

    # args = sys.argv[1:]
    #     if args:
    #         branch = int(args.pop(0))

    for i in range(branch):
        ijobs = []
        for j in range(branch):
            kjobs = []
            for k in range(branch):
                kjobs.append(c.comp(third, job_id='%d-%d-%d' % (i, j, k)))
            ijobs.append(c.comp(second, kjobs, job_id='%d-%d' % (i, j)))

        c.comp(first, ijobs, job_id='%d' % i)

    # Run command passed on command line or otherwise run console.
    import sys
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake" to make all.')
        c.compmake_console()
예제 #7
0
    from compmake import Context
    c = Context()

    branch = 10
    print('We will now define a hierarchy of %d x %d x %d = %d jobs.'
          % (branch, branch, branch, branch * branch * branch))
    print('Each can fail randomly with probability %f.' % failure_prob)

    # args = sys.argv[1:]
    #     if args:
    #         branch = int(args.pop(0))

    for i in range(branch):
        ijobs = []
        for j in range(branch):
            kjobs = []
            for k in range(branch):
                kjobs.append(c.comp(third, job_id='%d-%d-%d' % (i, j, k)))
            ijobs.append(c.comp(second, kjobs, job_id='%d-%d' % (i, j)))

        c.comp(first, ijobs, job_id='%d' % i)

    # Run command passed on command line or otherwise run console.    
    import sys
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake" to make all.')
        c.compmake_console()