Changeset 319ab14 in sasmodels for sasmodels/compare.py
- Timestamp:
- Nov 25, 2015 11:12:06 AM (9 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:
- 0fa687d
- Parents:
- 38d8774
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
rdc056b9 r319ab14 278 278 279 279 # OpenCl calculation 280 if Nocl > 0: 280 if Nocl > 0 and "-ctypes" in opts and "-sasview" in opts: 281 try: 282 ocl, ocl_time = eval_sasview(model_definition, pars, data, Ncpu) 283 base = "sasview" 284 #print "ocl/sasview", (ocl-pars['background'])/(cpu-pars['background']) 285 print "sasview t=%.1f ms, intensity=%.0f"%(ocl_time, sum(ocl)) 286 #print "sasview",cpu 287 except ImportError: 288 traceback.print_exc() 289 Ncpu = 0 290 elif Nocl > 0: 281 291 ocl, ocl_time = eval_opencl(model_definition, pars, data, 282 292 dtype=dtype, cutoff=cutoff, Nevals=Nocl) 293 base = "ocl" 283 294 print "opencl t=%.1f ms, intensity=%.0f"%(ocl_time, sum(ocl)) 284 295 #print "ocl", ocl … … 311 322 #bad = (relerr>1e-4) 312 323 #print relerr[bad],cpu[bad],ocl[bad],data.qx_data[bad],data.qy_data[bad] 313 _print_stats("| ocl-%s|"%comp+(" "*(3+len(comp))), resid)314 _print_stats("|( ocl-%s)/%s|"%(comp,comp), relerr)324 _print_stats("|%s-%s|"%(base,comp)+(" "*(3+len(comp))), resid) 325 _print_stats("|(%s-%s)/%s|"%(base,comp,comp), relerr) 315 326 316 327 # Plot if requested … … 325 336 if Ncpu > 0: plt.subplot(132) 326 337 plot_theory(data, ocl, view=view, plot_data=False) 327 plt.title(" opencl t=%.1f ms"%ocl_time)338 plt.title("%s t=%.1f ms"%(base,ocl_time)) 328 339 #cbar_title = "log I" 329 340 if Ncpu > 0 and Nocl > 0: … … 388 399 -preset*/-random[=seed] preset or random parameters 389 400 -mono/-poly* force monodisperse/polydisperse 390 -ctypes/-sasview* whether cpu is tested using sasview or ctypes401 -ctypes/-sasview* selects gpu:cpu, gpu:sasview, or sasview:cpu if both 391 402 -cutoff=1e-5* cutoff value for including a point in polydispersity 392 403 -pars/-nopars* prints the parameter set or not … … 406 417 NAME_OPTIONS = set([ 407 418 'plot','noplot', 408 'single','double',' longdouble',419 'single','double','quad', 409 420 'lowq','midq','highq','exq', 410 421 '2d','1d', … … 442 453 def main(): 443 454 opts = [arg for arg in sys.argv[1:] if arg.startswith('-')] 444 args = [arg for arg in sys.argv[1:] if not arg.startswith('-')] 455 popts = [arg for arg in sys.argv[1:] if not arg.startswith('-') and '=' in arg] 456 args = [arg for arg in sys.argv[1:] if not arg.startswith('-') and '=' not in arg] 445 457 models = "\n ".join("%-15s"%v for v in MODELS) 446 458 if len(args) == 0: … … 451 463 print "Model %r not available. Use one of:\n %s"%(args[0],models) 452 464 sys.exit(1) 465 if len(args) > 3: 466 print("expected parameters: model Nopencl Nsasview") 453 467 454 468 invalid = [o[1:] for o in opts … … 476 490 # Fill in parameters given on the command line 477 491 set_pars = {} 478 for arg in args[3:]:479 k,v = arg.split('=' )492 for arg in popts: 493 k,v = arg.split('=',1) 480 494 if k not in pars: 481 495 # extract base name without distribution
Note: See TracChangeset
for help on using the changeset viewer.