Changeset 9611


Ignore:
Timestamp:
Feb 4, 2015, 11:30:38 PM (9 years ago)
Author:
steve
Message:

Testing to get parallel unit test to work under openmpi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/parallel/tests/test_parallel_boyd_box_operator.py

    r9571 r9611  
    284284
    285285        abs_script_name = os.path.abspath(__file__)
    286         cmd = "mpirun -np %d python %s" % (nprocs, abs_script_name)
    287         result = os.system(cmd)
    288 
    289         assert_(result == 0)
    290 
     286        exitstatus = mpi_cmd(nprocs, abs_script_name)
     287
     288        assert_(exitstatus == 0)
     289
     290
     291def mpi_cmd(nprocs, script_name):
     292
     293    import os
     294    import commands
     295
     296    (exitstatus, outtext) = commands.getstatusoutput('mpirun -q pwd')
     297
     298    if exitstatus == 0: # openmpi:
     299        PYTHONPATH = os.getenv('PYTHONPATH')
     300        cmd = "mpirun -np %d -q -x PYTHONPATH=%s python %s" % (nprocs, PYTHONPATH, script_name)
     301    else:               # mpich
     302        cmd = "mpirun -np %d python %s" % (nprocs, script_name)
     303
     304    print cmd
     305    (exitstatus, outtext) = commands.getstatusoutput(cmd)
     306
     307    return exitstatus
     308     
    291309
    292310# Because we are doing assertions outside of the TestCase class
Note: See TracChangeset for help on using the changeset viewer.