Changeset 4f3dd42 in sasmodels


Ignore:
Timestamp:
Aug 18, 2016 11:30:31 AM (5 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:
3bcb88c, 0dc34c3
Parents:
300a2f7 (diff), deb854f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:sasview/sasmodels

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • doc/ref/magnetism/magnetism.rst

    r524e5c4 rdeb854f  
    44======================================================= 
    55 
    6 Magnetic scattering is implemented in five (2D) models 
     6In earlier versions of SasView magnetic scattering was implemented in just five  
     7(2D) models 
    78 
    89*  :ref:`sphere` 
     
    1112*  :ref:`cylinder` 
    1213*  :ref:`parallelepiped` 
     14 
     15From SasView 4.x it is implemented on most models in the 'shape' category. 
    1316 
    1417In general, the scattering length density (SLD = $\beta$) in each region where the 
  • sasmodels/kernelcl.py

    rbde38b5 r300a2f7  
    281281            warnings.warn("the environment variable 'PYOPENCL_CTX' might not be set correctly") 
    282282 
    283     def compile_program(self, name, source, dtype, fast=False): 
    284         # type: (str, str, np.dtype, bool) -> cl.Program 
     283    def compile_program(self, name, source, dtype, fast, timestamp): 
     284        # type: (str, str, np.dtype, bool, float) -> cl.Program 
    285285        """ 
    286286        Compile the program for the device in the given context. 
    287287        """ 
     288        # Note: PyOpenCL caches based on md5 hash of source, options and device 
     289        # so we don't really need to cache things for ourselves.  I'll do so 
     290        # anyway just to save some data munging time. 
    288291        key = "%s-%s%s"%(name, dtype, ("-fast" if fast else "")) 
     292        # Check timestamp on program 
     293        program, program_timestamp = self.compiled.get(key, (None, np.inf)) 
     294        if program_timestamp < timestamp: 
     295            del self.compiled[key] 
    289296        if key not in self.compiled: 
    290297            context = self.get_context(dtype) 
     
    293300            program = compile_model(self.get_context(dtype), 
    294301                                    str(source), dtype, fast) 
    295             self.compiled[key] = program 
    296         return self.compiled[key] 
    297  
    298     def release_program(self, name): 
    299         # type: (str) -> None 
    300         """ 
    301         Free memory associated with the program on the device. 
    302         """ 
    303         if name in self.compiled: 
    304             self.compiled[name].release() 
    305             del self.compiled[name] 
     302            self.compiled[key] = (program, timestamp) 
     303        return program 
    306304 
    307305def _get_default_context(): 
     
    399397        if self.program is None: 
    400398            compile_program = environment().compile_program 
     399            timestamp = generate.timestamp(self.info) 
    401400            self.program = compile_program( 
    402401                self.info.name, 
    403402                self.source['opencl'], 
    404403                self.dtype, 
    405                 self.fast) 
     404                self.fast, 
     405                timestamp) 
    406406            variants = ['Iq', 'Iqxy', 'Imagnetic'] 
    407407            names = [generate.kernel_name(self.info, k) for k in variants] 
     
    421421        """ 
    422422        if self.program is not None: 
    423             environment().release_program(self.info.name) 
    424423            self.program = None 
    425424 
  • sasmodels/sasview_model.py

    rbde38b5 r300a2f7  
    115115    Load a custom model given the model path. 
    116116    """ 
     117    #print("load custom", path) 
    117118    kernel_module = custom.load_custom_kernel_module(path) 
    118119    try: 
Note: See TracChangeset for help on using the changeset viewer.