Changeset 9707


Ignore:
Timestamp:
Mar 6, 2015, 5:28:51 PM (9 years ago)
Author:
steve
Message:

Playing around wiht parallel tests

Location:
trunk/anuga_core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/__init__.py

    r9703 r9707  
    3333except NameError:
    3434    __ANUGA_SETUP__ = False
    35 
     35   
    3636   
    3737if __ANUGA_SETUP__:
  • trunk/anuga_core/anuga/parallel/tests/skip_parallel_boyd_box_op_apron.py

    r9572 r9707  
    4242This test exercises the parallel culvert and checks values
    4343"""
    44 verbose = False
     44verbose = True
    4545nprocs = 3
    4646   
     
    302302
    303303
    304         assert(success)
    305 
    306     return control_data
     304    return control_data, success
    307305
    308306
     
    315313    def test_parallel_operator(self):
    316314       
    317 
    318         #print "Expect this test to fail if not run from the parallel directory."
    319         result = os.system("mpirun -np %d python test_parallel_boyd_box_op_apron.py" % nprocs)
    320         assert_(result == 0)
     315        abs_script_name = os.path.abspath(__file__)
     316        cmd = "mpirun -np %d python %s" % (nprocs, abs_script_name)
     317        exitstatus = os.system(cmd)
     318
     319
     320        assert_(exitstatus == 0)
    321321
    322322
     
    353353
    354354        if myid == 0:
    355             control_data = run_simulation(parallel=False, test_points = test_points, verbose = verbose)
     355            control_data, success = run_simulation(parallel=False, test_points = test_points, verbose = verbose)
    356356
    357357            for proc in range(1,numprocs):
     
    362362
    363363        pypar.barrier()
    364         run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)
    365 
    366 
    367     finalize()
    368    
    369 
     364        _, success = run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)
     365
     366
     367        #assert(success)
     368        all_success = True
     369        if myid == 0:
     370            all_success = success
     371            for i in range(1,numprocs):
     372                all_success = all_success and pypar.receive(i)
     373        else:
     374            pypar.send(success, 0)
     375           
     376        if myid == 0:
     377            for i in range(1,numprocs):
     378                pypar.send(all_success,i)
     379        else:
     380            all_success= pypar.receive(0)
     381           
     382        print 'myid ',myid, 'all_success ',all_success
     383                     
     384       
     385        finalize()
     386       
     387        import sys
     388        if all_success:
     389            sys.exit(0)
     390        else:
     391            sys.exit(1)
     392
     393   
     394
  • trunk/anuga_core/anuga/parallel/tests/test_parallel_boyd_box_operator.py

    r9701 r9707  
    270270                    print 'P%d average depth, control = %s, actual = %s' %(myid, control_data[samples+4], average_depth)
    271271
    272         assert(success)
    273 
    274        
    275     return control_data
     272        #assert(success)
     273
     274       
     275    return control_data, success
    276276
    277277
     
    284284
    285285        abs_script_name = os.path.abspath(__file__)
    286         exitstatus = mpi_cmd(nprocs, abs_script_name)
     286        cmd = "mpirun -np %d python %s" % (nprocs, abs_script_name)
     287        exitstatus = os.system(cmd)
     288        #exitstatus = mpi_cmd(nprocs, abs_script_name)
    287289
    288290        assert_(exitstatus == 0)
    289291
    290292
    291 def mpi_cmd(nprocs, script_name):
    292 
    293     import subprocess
    294 
    295     cmd = "mpirun -v -np %d python %s" % (nprocs, script_name)
    296 
    297     exitstatus = 0
    298     try:
    299         outtext = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
    300     except subprocess.CalledProcessError as e:
    301         exitstatus=e.returncode
    302         outtext = e.output
    303 
    304     if verbose:
    305         print exitstatus
    306         print outtext
    307 
    308 
    309     return exitstatus
     293# def mpi_cmd(nprocs, script_name):
     294#
     295#     import subprocess
     296#
     297#     cmd = "mpirun -v -np %d python %s" % (nprocs, script_name)
     298#
     299#     exitstatus = 0
     300#     try:
     301#         outtext = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
     302#     except subprocess.CalledProcessError as e:
     303#         exitstatus=e.returncode
     304#         outtext = e.output
     305#
     306#     if verbose:
     307#         print exitstatus
     308#         print outtext
     309#
     310#
     311#     return exitstatus
    310312     
    311313
     
    343345
    344346        if myid == 0:
    345             control_data = run_simulation(parallel=False, test_points = test_points, verbose = verbose)
     347            control_data, success = run_simulation(parallel=False, test_points = test_points, verbose = verbose)
    346348
    347349            for proc in range(1,numprocs):
     
    352354
    353355        pypar.barrier()
    354         run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)
    355 
    356 
     356        _, success = run_simulation(parallel=True, control_data = control_data, test_points = test_points, verbose = verbose)
     357
     358
     359        #assert(success)
     360        all_success = True
     361        if myid == 0:
     362            all_success = success
     363            for i in range(1,numprocs):
     364                all_success = all_success and pypar.receive(i)
     365        else:
     366            pypar.send(success, 0)
     367           
     368        if myid == 0:
     369            for i in range(1,numprocs):
     370                pypar.send(all_success,i)
     371        else:
     372            all_success= pypar.receive(0)
     373           
     374        print 'myid ',myid, 'all_success ',all_success
     375                     
     376       
    357377        finalize()
    358    
    359 
     378       
     379        import sys
     380        if all_success:
     381            sys.exit(0)
     382        else:
     383            sys.exit(1)
     384           
     385   
     386
  • trunk/anuga_core/examples/runup.py

    r8728 r9707  
    3939Bd = anuga.Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
    4040Bw = anuga.Time_boundary(domain=domain,     # Time dependent boundary 
    41                    f=lambda t: [(0.1*sin(t*2*pi)-0.3)*exp(-t), 0.0, 0.0])
     41                   function=lambda t: [(0.1*sin(t*2*pi)-0.3)*exp(-t), 0.0, 0.0])
    4242
    4343# Associate boundary tags with boundary objects
  • trunk/anuga_core/tools/install_packages.sh

    r9701 r9707  
    9393        git clone https://github.com/daleroberts/pypar;
    9494        pushd pypar;
    95         python setup.py install;
     95        python setup.py build;
     96        sudo python setup.py install;
    9697        popd;
    9798    fi
Note: See TracChangeset for help on using the changeset viewer.