Changeset 34756fd in sasmodels for compare_many.py
- Timestamp:
- Dec 3, 2014 3:04:40 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:
- 3699587, 8a3e0af
- Parents:
- 34d49af
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
compare_many.py
r216a9e1 r34756fd 9 9 eval_opencl, eval_ctypes, make_data) 10 10 11 def get_stats(target, model_eval, name, pars, data, index, dtype, cutoff): 12 value, _ = model_eval(name, pars, data, dtype='single', cutoff=cutoff) 11 def get_stats(target, value, index): 13 12 resid = abs(value-target)[index] 14 13 relerr = resid/target[index] … … 45 44 46 45 env = environment() 47 gpu_single = get_stats(target, eval_opencl, name, pars, data, index, 'single', cutoff) 46 gpu_single_value,_ = eval_opencl(name, pars, data, dtype='single', cutoff=cutoff) 47 gpu_single = get_stats(target, gpu_single_value, index) 48 48 if env.has_double: 49 gpu_double = get_stats(target, eval_opencl, name, pars, data, index, 'double', cutoff) 49 gpu_double_value,_ = eval_opencl(name, pars, data, dtype='double', cutoff=cutoff) 50 gpu_double = get_stats(target, gpu_double_value, index) 50 51 else: 51 52 gpu_double = [0]*len(gpu_single) 52 cpu_double = get_stats(target, eval_ctypes, name, pars, data, index, 'double', cutoff) 53 cpu_double_value,_ = eval_ctypes(name, pars, data, dtype='double', cutoff=cutoff) 54 cpu_double = get_stats(target, cpu_double_value, index) 55 single_double = get_stats(cpu_double_value, gpu_single_value, index) 53 56 54 values = list(gpu_single) + list(gpu_double) + list(cpu_double) + [v for _,v in sorted(pars.items())] 57 values = (list(gpu_single) + list(gpu_double) + list(cpu_double) 58 + list(single_double) + [v for _,v in sorted(pars.items())]) 55 59 if gpu_single[0] > 5e-5: 56 60 if first: 57 print_column_headers(pars,'GPU single|GPU double|CPU double '.split('|'))61 print_column_headers(pars,'GPU single|GPU double|CPU double|single/double'.split('|')) 58 62 first = False 59 63 print(("%d,"%seed)+','.join("%g"%v for v in values))
Note: See TracChangeset
for help on using the changeset viewer.