source: anuga_validation/automated_validation_tests/fitting/validate_benchmark_fit.py @ 4861

Last change on this file since 4861 was 4861, checked in by duncan, 16 years ago

Fit speed up for when there is a lot of blocking

File size: 2.3 KB
Line 
1"""Automatic verification that the ANUGA fitting code is not taking more time
2or memory than usual.  This test has been tailored for computers in GA.
3
4I'm leaving a 20% error margin
5"""
6
7import unittest
8import os, sys
9
10from anuga.fit_interpolate.benchmark_least_squares import BenchmarkLeastSquares
11
12class Test_uq(unittest.TestCase):
13    def setUp(self):
14        pass
15       
16
17    def tearDown(self):
18        pass
19
20    # FIXME test the time to put .pts elevation into a domain object
21    # FIXME do tests for interpolate as well.
22    def test_fit_time_and_mem(self):
23        import socket
24        host =  socket.gethostname()
25        #print "host", host
26        ben = BenchmarkLeastSquares()
27        time, mem, num_tri, one_t, more_t, quad_t = ben.trial(
28            num_of_points=1000
29            ,maxArea=0.0001
30            ,is_fit=True
31            ,segments_in_mesh=False
32            ,use_file_type='pts'
33            ,save=False
34            )
35        #print "time", time
36        #print "mem", mem
37        if host.find('tornado') == 0 or host.find('compute-1') == 0:
38            # Tornado headnode or node
39            time_standard = 11.5
40            self.assert_(time<time_standard*1.2)
41            mem_standard = 21280 
42            self.assert_(mem<mem_standard*1.2)
43           
44        elif host.find('compute-0') == 0: # cyclone node
45            time_standard = 17.0
46            self.assert_(time<time_standard*1.2)
47            mem_standard = 21168
48            self.assert_(mem<mem_standard*1.2)
49
50        elif host.find('cyclone') == 0: # cyclone headnode
51            time_standard = 11.8
52            self.assert_(time<time_standard*1.2)
53            mem_standard = 20500
54            self.assert_(mem<mem_standard*1.2)
55
56        elif host.find('nautilus') == 0:
57            time_standard = 29.1
58            self.assert_(time<time_standard*1.2)
59            mem_standard = 9896 # !!!
60            self.assert_(mem<mem_standard*1.2)
61
62        elif host.find('pc-31569') == 0: # DSG's PC
63            time_standard = 26.1
64            self.assert_(time<time_standard*1.2)
65           
66           
67#-------------------------------------------------------------
68if __name__ == "__main__":
69    suite = unittest.makeSuite(Test_uq,'test')
70    runner = unittest.TextTestRunner(verbosity=2)
71    runner.run(suite)
Note: See TracBrowser for help on using the repository browser.