Exemplo n.º 1
0
def test_launcher():
    # configured launch commands for selected launchers
    serial = SerialMapper()
    print("non-python serial launch:", serial)
    settings = {'python': '', 'program': "hostname"}
    print(serial._launcher(settings), "\n")

    print("serial python launch:", serial)
    defaults['program'] = "tools.py"
    defaults['progargs'] = "12345"
    print(serial._launcher(defaults), "\n")

    qsub = Torque()
    serial.scheduler = qsub
    print("scheduled serial launch:", serial)
    settings = {'program': "tools.py", 'progargs': '12345'}
    print(serial._launcher(settings), "\n")

    mpi = Mpi()
    print("non-scheduled parallel launch:", mpi)
    print(mpi._launcher(settings), "\n")

    qsub.nodes = '4:ppn=2'
    mpi.nodes = mpi.njobs(qsub.nodes)
    print("scheduled parallel launch:", mpi, "| Torque")
    print(qsub._submit(mpi._launcher(settings)), "\n")

    mpi.scheduler = qsub
    print("scheduled parallel launch:", mpi)
    print(mpi._launcher(settings), "\n")

    _mpi = Mpi(scheduler=Torque(nodes='4:ppn=2'))
    print("scheduled parallel launch:", _mpi)
    print(_mpi._launcher(settings), "\n")

    _mpi = TorqueMpi(nodes='4:ppn=2')
    print("scheduled parallel launch:", _mpi)
    print(_mpi._launcher(settings), "\n")

    qsub.nodes = 1
    serial = SerialMapper()
    print("scheduled serial launch:", serial, "| Torque")
    print(qsub._submit(serial._launcher(settings)), "\n")
Exemplo n.º 2
0
def test_launcher():
    # configured launch commands for selected launchers
    serial = SerialMapper()
    print "non-python serial launch:", serial
    settings = {'python':'', 'program':"hostname"}
    print serial._launcher(settings), "\n"

    print "serial python launch:", serial
    defaults['program'] = "tools.py"
    defaults['progargs'] = "12345"
    print serial._launcher(defaults), "\n"

    qsub = Torque()
    serial.scheduler = qsub
    print "scheduled serial launch:", serial
    settings = {'program':"tools.py", 'progargs':'12345'}
    print serial._launcher(settings), "\n"

    mpi = Mpi()
    print "non-scheduled parallel launch:", mpi
    print mpi._launcher(settings), "\n"

    qsub.nodes = '4:ppn=2'
    mpi.nodes = mpi.njobs(qsub.nodes)
    print "scheduled parallel launch:", mpi, "| Torque"
    print qsub._submit(mpi._launcher(settings)), "\n"

    mpi.scheduler = qsub
    print "scheduled parallel launch:", mpi
    print mpi._launcher(settings), "\n"

    _mpi = Mpi(scheduler=Torque(nodes='4:ppn=2'))
    print "scheduled parallel launch:", _mpi
    print _mpi._launcher(settings), "\n"

    _mpi = TorqueMpi(nodes='4:ppn=2')
    print "scheduled parallel launch:", _mpi
    print _mpi._launcher(settings), "\n"

    qsub.nodes = 1
    serial = SerialMapper()
    print "scheduled serial launch:", serial, "| Torque"
    print qsub._submit(serial._launcher(settings)), "\n"
Exemplo n.º 3
0
#  - https://github.com/uqfoundation/pyina/blob/master/LICENSE

from pyina.launchers import Mpi

#XXX:: can fail with NameError: global name 'func' is not defined
#XXX:: can fail with RuntimeError: maximum recursion depth exceeded
#from mystic.models.poly import chebyshev8cost as func

def host(coeffs):
    from mystic.models.poly import chebyshev8cost as func
    return "Chebyshev%s = %s" % (coeffs, func(coeffs))

params = [(i,0,-2*i,0,4*i,0,-2*i,0,i) for i in range(10)]
pool = Mpi()

print("Evaluate the 8th order Chebyshev polynomial...")
print("Using 'dill' for 10 combinations over 4 nodes")
pool.nodes = 4
res1 = pool.map(host, params)
print(pool)
print('\n'.join(res1))
print('')

print("Using 'dill.source' for 10 combinations over 4 nodes")
pool.source = True
res2 = pool.map(host, params)
print(pool)
print('\n'.join(res2))

# end of file
Exemplo n.º 4
0
#  - https://github.com/uqfoundation/pyina/blob/master/LICENSE

from pyina.launchers import Mpi

#XXX:: can fail with NameError: global name 'func' is not defined
#XXX:: can fail with RuntimeError: maximum recursion depth exceeded
#from mystic.models.poly import chebyshev8cost as func

def host(coeffs):
    from mystic.models.poly import chebyshev8cost as func
    return "Chebyshev%s = %s" % (coeffs, func(coeffs))

params = [(i,0,-2*i,0,4*i,0,-2*i,0,i) for i in range(10)]
pool = Mpi()

print("Evaluate the 8th order Chebyshev polynomial...")
print("Using 'dill' for 10 combinations over 4 nodes")
pool.nodes = 4
res1 = pool.map(host, params)
print(pool)
print('\n'.join(res1))
print('')

print("Using 'dill.source' for 10 combinations over 4 nodes")
pool.source = True
res2 = pool.map(host, params)
print(pool)
print('\n'.join(res2))

# end of file