Changeset a42fec0 in sasmodels for compare.py
- Timestamp:
- Aug 4, 2014 3:20:07 PM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 8cdb9f1
- Parents:
- 099e053
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
compare.py
r473183c ra42fec0 4 4 import datetime 5 5 6 from Models.sasmodel import SasModel, load_data, set_beam_stop, plot_data6 from sasmodel import SasModel, load_data, set_beam_stop, plot_data 7 7 8 8 … … 46 46 if len(sys.argv) > 1: 47 47 N = int(sys.argv[1]) 48 data = load_data(' JUN03289.DAT')48 data = load_data('December/DEC07098.DAT') 49 49 set_beam_stop(data, 0.004) 50 50 51 dtype = "float" 51 52 pars = dict( 52 scale=1, radius=64.1, length=266.96, sldCyl=.291e-6, sldSolv=5.77e-6, background=0, 53 cyl_theta=0, cyl_phi=0, radius_pd=0.1, radius_pd_n=10, radius_pd_nsigma=3,length_pd=0.1, 54 length_pd_n=5, length_pd_nsigma=3, cyl_theta_pd=0.1, cyl_theta_pd_n=5, cyl_theta_pd_nsigma=3, 53 scale=.08, radius=64.1, length=266.96, sldCyl=.291e-6, sldSolv=5.77e-6, background=.1, 54 cyl_theta=0, cyl_phi=0, 55 radius_pd=0.1, radius_pd_n=10, radius_pd_nsigma=3, 56 length_pd=0.1,length_pd_n=5, length_pd_nsigma=3, 57 cyl_theta_pd=0.1, cyl_theta_pd_n=5, cyl_theta_pd_nsigma=3, 55 58 cyl_phi_pd=0.1, cyl_phi_pd_n=10, cyl_phi_pd_nsigma=3, 56 59 ) … … 62 65 cpu_time = toc()*1000./N 63 66 64 from code_cylinder import GpuCylinder 67 68 from Models.code_cylinder import GpuCylinder 65 69 model = SasModel(data, GpuCylinder, dtype='f', **pars) 66 70 tic() … … 69 73 gpu_time = toc()*1000./N 70 74 75 print "gpu/cpu", max(gpu/cpu) 76 cpu *= max(gpu/cpu) 71 77 relerr = (gpu - cpu)/cpu 72 78 print "max(|(ocl-omp)/ocl|)", max(abs(relerr)) … … 76 82 plt.subplot(131); plot_data(data, cpu); plt.title("omp t=%.1f ms"%cpu_time) 77 83 plt.subplot(132); plot_data(data, gpu); plt.title("ocl t=%.1f ms"%gpu_time) 78 plt.subplot(133); plot_data(data, 1e8*relerr); plt.title("relerr x 10^8"); plt.colorbar()84 plt.subplot(133); plot_data(data, relerr); plt.title("relerr x 10^8"); plt.colorbar() 79 85 plt.show() 80 86 … … 85 91 if len(sys.argv) > 1: 86 92 N = int(sys.argv[1]) 87 data = load_data('DEC071 33.DAT')93 data = load_data('DEC07106.DAT') 88 94 set_beam_stop(data, 0.004) 89 95 … … 99 105 cpu_time = toc()*1000./N 100 106 101 from code_ellipse import GpuEllipse107 from Models.code_ellipse import GpuEllipse 102 108 model = SasModel(data, GpuEllipse, dtype='f', **pars) 103 109 tic() … … 116 122 plt.show() 117 123 118 def coreshell(N= 4):124 def coreshell(N=1): 119 125 import sys 120 126 import matplotlib.pyplot as plt … … 122 128 if len(sys.argv) > 1: 123 129 N = int(sys.argv[1]) 124 data = load_data('D EC07133.DAT')130 data = load_data('December/DEC07098.DAT') 125 131 set_beam_stop(data, 0.004) 126 132 … … 141 147 cpu_time = toc()*1000./N 142 148 143 from code_coreshellcyl import GpuCoreShellCylinder149 from Models.code_coreshellcyl import GpuCoreShellCylinder 144 150 model = SasModel(data, GpuCoreShellCylinder, dtype='f', **pars) 145 151 tic()
Note: See TracChangeset
for help on using the changeset viewer.