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
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2016 California Institute of Technology.
# Copyright (c) 2016-2018 The Uncertainty Quantification Foundation.
# License: 3-clause BSD.  The full license text is available at:
#  - https://github.com/uqfoundation/pyina/blob/master/LICENSE

from pyina.launchers import SerialMapper
from pyina.schedulers import Torque
from pyina.mpi import _save, _debug


#_debug(True)
#_save(True)
def host(id):
    import socket
    return "Rank: %d -- %s" % (id, socket.gethostname())


print("Submit a non-parallel job to torque in the 'productionQ' queue...")
print("Using 5 items over 1 nodes and the default mapping strategy")
torque = Torque(queue='productionQ', timelimit='20:00:00', workdir='.')
pool = SerialMapper(scheduler=torque)
res = pool.map(host, range(5))
print(pool)
print('\n'.join(res))

# end of file
Exemplo n.º 4
0
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2016 California Institute of Technology.
# License: 3-clause BSD.  The full license text is available at:
#  - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/pyina/LICENSE

from pyina.launchers import SerialMapper
from pyina.schedulers import Torque
from pyina.mpi import _save, _debug

#_debug(True)
#_save(True)
def host(id):
    import socket
    return "Rank: %d -- %s" % (id, socket.gethostname())

print "Submit a non-parallel job to torque in the 'productionQ' queue..."
print "Using 5 items over 1 nodes and the default mapping strategy"
torque = Torque(queue='productionQ', timelimit='20:00:00', workdir='.')
pool = SerialMapper(scheduler=torque)
res = pool.map(host, range(5))
print pool
print '\n'.join(res)

# end of file