- Timestamp:
- Aug 1, 2007, 10:22:11 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/benchmark_least_squares.py
r4648 r4649 91 91 #m0 = None on windows 92 92 m0 = mem_usage() 93 94 profile_file = "P" + str(num_of_points) + \ 93 if is_fit is True: 94 op = "Fit_" 95 else: 96 op = "Interp_" 97 profile_file = op + "P" + str(num_of_points) + \ 95 98 "T" + str(len(mesh_dict['triangles'])) + \ 96 99 "PPC" + str(max_points_per_cell) + \ … … 160 163 mesh_dict['triangles'], 161 164 max_vertices_per_cell = max_points_per_cell) 162 s = """calc = interp.interpolate(mesh_dict['vertex_attributes'] 165 166 if run_profile: 167 s="""calc=interp.interpolate(mesh_dict['vertex_attributes'] 168 ,points_dict['points'],start_blocking_len=blocking_len)""" 169 pobject = profile.Profile() 170 presult = pobject.runctx(s, 171 vars(sys.modules[__name__]), 172 vars()) 173 prof_file = tempfile.mktemp(".prof") 174 presult.dump_stats(prof_file) 175 # 176 # Let process these results 177 S = pstats.Stats(prof_file) 178 saveout = sys.stdout 179 pfile = open(profile_file, "w") 180 sys.stdout = pfile 181 s = S.sort_stats('cumulative').print_stats(30) 182 sys.stdout = saveout 183 pfile.close() 184 os.remove(prof_file) 185 186 else: 187 calc = interp.interpolate(mesh_dict['vertex_attributes'] 163 188 ,points_dict['points'] 164 ,start_blocking_len=blocking_len)""" 165 166 fileName = tempfile.mktemp(".prof") 167 profile.run(s, fileName) #profile_file) 168 169 S = pstats.Stats(fileName) 170 s = S.sort_stats('cumulative').print_stats(30) 171 print "***********" 172 print s 173 print "***********" 174 pfile = file.open(profile_file, "w") 175 pfile.write(s) 176 pfile.close() 189 ,start_blocking_len = 500000) 190 177 191 time_taken_sec = (time.time()-t0) 178 192 m1 = mem_usage()
Note: See TracChangeset
for help on using the changeset viewer.