Changeset 17bbadd in sasmodels for sasmodels/kernelcl.py


Ignore:
Timestamp:
Mar 15, 2016 10:47:12 AM (8 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:
754e27b
Parents:
5ceb7d0
Message:

refactor so all model defintion queries use model_info; better documentation of model_info structure; initial implementation of product model (broken)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernelcl.py

    re6a5556 r17bbadd  
    289289    GPU wrapper for a single model. 
    290290 
    291     *source* and *info* are the model source and interface as returned 
    292     from :func:`gen.make`. 
     291    *source* and *model_info* are the model source and interface as returned 
     292    from :func:`generate.make_source` and :func:`generate.make_model_info`. 
    293293 
    294294    *dtype* is the desired model precision.  Any numpy dtype for single 
     
    300300    that the compiler is allowed to take shortcuts. 
    301301    """ 
    302     def __init__(self, source, info, dtype=generate.F32): 
    303         self.info = info 
     302    def __init__(self, source, model_info, dtype=generate.F32): 
     303        self.info = model_info 
    304304        self.source = source 
    305305        self.dtype = generate.F32 if dtype == 'fast' else np.dtype(dtype) 
     
    356356    """ 
    357357    def __init__(self, q_vectors, dtype=generate.F32): 
     358        # TODO: do we ever need double precision q? 
    358359        env = environment() 
    359360        self.nq = q_vectors[0].size 
     
    389390    *kernel* is the GpuKernel object to call 
    390391 
    391     *info* is the module information 
     392    *model_info* is the module information 
    392393 
    393394    *q_vectors* is the q vectors at which the kernel should be evaluated 
     
    403404    Call :meth:`release` when done with the kernel instance. 
    404405    """ 
    405     def __init__(self, kernel, info, q_vectors, dtype): 
     406    def __init__(self, kernel, model_info, q_vectors, dtype): 
    406407        q_input = GpuInput(q_vectors, dtype) 
    407408        self.kernel = kernel 
    408         self.info = info 
     409        self.info = model_info 
    409410        self.res = np.empty(q_input.nq, q_input.dtype) 
    410411        dim = '2d' if q_input.is_2d else '1d' 
    411         self.fixed_pars = info['partype']['fixed-' + dim] 
    412         self.pd_pars = info['partype']['pd-' + dim] 
     412        self.fixed_pars = model_info['partype']['fixed-' + dim] 
     413        self.pd_pars = model_info['partype']['pd-' + dim] 
    413414 
    414415        # Inputs and outputs for each kernel call 
     
    430431                else np.float32)  # will never get here, so use np.float32 
    431432 
     433        #print "pars", fixed_pars, pd_pars 
    432434        res_bi = self.res_b 
    433435        nq = np.uint32(self.q_input.nq) 
Note: See TracChangeset for help on using the changeset viewer.