"""Automatic verification that the ANUGA fitting code is not taking more time or memory than usual. This test has been tailored for computers in GA. I'm leaving a 20% error margin Note, going from version 4897 to 4917 uses more memory, based on how memory is measured here. What is actually happening is the mesh generation is using less memory, in version 4917. In version 4897 mesh gen uses and frees up more memory, so python asks for less extra memory in the fitting stage. So overall version 4917 is an improvement. RAW DATA version 4897 test_fit_time_and_mem (__main__.Test_uq) ... very start mem_usage() 98108 before fitting mem_usage() 134696 after fitting mem_usage() 155820 version 4917 test_fit_time_and_mem (__main__.Test_uq) ... very start mem_usage() 98076 before fitting mem_usage() 120012 after fitting mem_usage() 150212 time 15.19490695 mem 30200 """ import unittest import os, sys from anuga.fit_interpolate.benchmark_least_squares import BenchmarkLeastSquares class Test_uq(unittest.TestCase): def setUp(self): pass def tearDown(self): pass # FIXME test the time to put .pts elevation into a domain object # FIXME do tests for interpolate as well. # A version round 4872 has slower times. # That's because v4872 is using geo-ref, whereas the # previous version did not. def test_fit_time_and_mem(self): import socket host = socket.gethostname() #print "host", host ben = BenchmarkLeastSquares() time, mem, num_tri, one_t, more_t, quad_t = ben.trial( num_of_points=1000 ,maxArea=0.0001 ,is_fit=True ,segments_in_mesh=False ,use_file_type='pts' ,save=False ) #print "time", time #print "mem", mem #Defaults time_standard = 120. mem_standard = 50000. if host.find('tornado') == 0: # Tornado headnode #time_standard = 14.5 time_standard = 24. mem_standard = 302404. elif host.find('compute-1') == 0: # cyclone or tornado node time_standard = 19.0 mem_standard = 30204. elif host.find('cyclone') == 0: # cyclone headnode time_standard = 13.3 mem_standard = 29424. elif host.find('nautilus') == 0: time_standard = 27.6 # v 4910 is giving a mem of 15572 mem_standard = 15572. elif host.find('bogong') == 0: time_standard = 14.2 mem_standard = 30000. # Updated by Ole 20080507 elif host.find('pc-31569') == 0: # DSG's PC time_standard = 31.6 mem_standard = 15000. #? """ test_fit_time_and_mem (__main__.Test_uq) ... very start mem_usage() 98076 before fitting mem_usage() 120012 after fitting mem_usage() 150212 time 15.19490695 mem 30200 test_fit_time_and_mem (__main__.Test_uq) ... very start mem_usage() 98108 before fitting mem_usage() 134696 after fitting mem_usage() 155820 """ # Do the assertions here assert time