Changeset 34756fd in sasmodels for compare_many.py


Ignore:
Timestamp:
Dec 3, 2014 3:04:40 PM (10 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

add single to double comparison for the new models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • compare_many.py

    r216a9e1 r34756fd  
    99                     eval_opencl, eval_ctypes, make_data) 
    1010 
    11 def get_stats(target, model_eval, name, pars, data, index, dtype, cutoff): 
    12     value, _ = model_eval(name, pars, data, dtype='single', cutoff=cutoff) 
     11def get_stats(target, value, index): 
    1312    resid = abs(value-target)[index] 
    1413    relerr = resid/target[index] 
     
    4544 
    4645        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) 
    4848        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) 
    5051        else: 
    5152            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) 
    5356 
    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())]) 
    5559        if gpu_single[0] > 5e-5: 
    5660            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('|')) 
    5862                first = False 
    5963            print(("%d,"%seed)+','.join("%g"%v for v in values)) 
Note: See TracChangeset for help on using the changeset viewer.