Changeset 5d316e9 in sasmodels for sasmodels/compare.py
- Timestamp:
- Dec 8, 2015 8:08:51 AM (8 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:
- cf404cb
- Parents:
- eaca9eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
r9404dd3 r5d316e9 190 190 return value, average_time 191 191 192 def eval_opencl(model_definition, pars, data, dtype='single', Nevals=1, cutoff=0.): 192 def eval_opencl(model_definition, pars, data, dtype='single', Nevals=1, 193 cutoff=0., fast=False): 193 194 try: 194 model = core.load_model(model_definition, dtype=dtype, platform="ocl") 195 model = core.load_model(model_definition, dtype=dtype, 196 platform="ocl", fast=fast) 195 197 except Exception as exc: 196 198 print(exc) 197 199 print("... trying again with single precision") 198 model = core.load_model(model_definition, dtype='single', platform="ocl") 200 model = core.load_model(model_definition, dtype='single', 201 platform="ocl", fast=fast) 199 202 calculator = DirectModel(data, model, cutoff=cutoff) 200 203 value = None # silence the linter … … 259 262 dtype = ('longdouble' if '-quad' in opts 260 263 else 'double' if '-double' in opts 264 else 'half' if '-half' in opts 261 265 else 'single') 262 266 cutoff = float(opt_values.get('-cutoff','1e-5')) 267 fast = "-fast" in opts and dtype is 'single' 263 268 264 269 # randomize parameters … … 282 287 base_name = target.name 283 288 base, base_time = eval_ctypes(target, pars, data, 284 289 dtype='longdouble', cutoff=0., Nevals=Ncomp) 285 290 elif Nbase > 0 and "-ctypes" in opts and "-sasview" in opts: 286 291 try: … … 295 300 elif Nbase > 0: 296 301 base, base_time = eval_opencl(model_definition, pars, data, 297 dtype=dtype, cutoff=cutoff, Nevals=Nbase)302 dtype=dtype, cutoff=cutoff, Nevals=Nbase, fast=fast) 298 303 base_name = "ocl" 299 304 print("opencl t=%.1f ms, intensity=%.0f"%(base_time, sum(base))) … … 304 309 if Ncomp > 0 and "-ctypes" in opts: 305 310 comp, comp_time = eval_ctypes(model_definition, pars, data, 306 311 dtype=dtype, cutoff=cutoff, Nevals=Ncomp) 307 312 comp_name = "ctypes" 308 313 print("ctypes t=%.1f ms, intensity=%.0f"%(comp_time, sum(comp))) … … 398 403 399 404 -plot*/-noplot plots or suppress the plot of the model 400 - single*/-double/-quad use single/double/quad precision for comparison405 -half/-single*/-double/-quad/-fast sets the calculation precision 401 406 -lowq*/-midq/-highq/-exq use q values up to 0.05, 0.2, 1.0, 10.0 402 407 -Nq=128 sets the number of Q points in the data set … … 411 416 -hist/-nohist* plot histogram of relative error 412 417 -res=0 sets the resolution width dQ/Q if calculating with resolution 413 -accuracy=Low resolution accuracyLow, Mid, High, Xhigh418 -accuracy=Low accuracy of the resolution calculation Low, Mid, High, Xhigh 414 419 415 420 Key=value pairs allow you to set specific values to any of the model … … 421 426 422 427 NAME_OPTIONS = set([ 423 'plot', 'noplot',424 ' single','double','quad',425 'lowq', 'midq','highq','exq',426 '2d', '1d',427 'preset', 'random',428 'poly', 'mono',429 'sasview', 'ctypes',430 'nopars', 'pars',431 'rel', 'abs',428 'plot', 'noplot', 429 'half', 'single', 'double', 'quad', 'fast', 430 'lowq', 'midq', 'highq', 'exq', 431 '2d', '1d', 432 'preset', 'random', 433 'poly', 'mono', 434 'sasview', 'ctypes', 435 'nopars', 'pars', 436 'rel', 'abs', 432 437 'linear', 'log', 'q4', 433 'hist', 'nohist',438 'hist', 'nohist', 434 439 ]) 435 440 VALUE_OPTIONS = [
Note: See TracChangeset
for help on using the changeset viewer.