Changeset 7fcdc9f in sasmodels


Ignore:
Timestamp:
Oct 16, 2016 4:38:03 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
248561a
Parents:
ff1fff5
Message:

OpenCL: use checksum to distinguish between kernels with the same name

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r234c532 r7fcdc9f  
    166166import re 
    167167import string 
     168from zlib import crc32 
    168169 
    169170import numpy as np  # type: ignore 
     
    356357    return newest 
    357358 
     359def tag_source(source): 
     360    # type: (str) -> str 
     361    """ 
     362    Return a unique tag for the source code. 
     363    """ 
     364    # Note: need 0xffffffff&val to force an unsigned 32-bit number 
     365    return "%08X"%(0xffffffff&crc32(source)) 
    358366 
    359367def convert_type(source, dtype): 
  • sasmodels/kernelcl.py

    r6e5b2a7 r7fcdc9f  
    294294        # so we don't really need to cache things for ourselves.  I'll do so 
    295295        # anyway just to save some data munging time. 
    296         key = "%s-%s%s"%(name, dtype, ("-fast" if fast else "")) 
     296        tag = generate.tag_source(source) 
     297        key = "%s-%s-%s%s"%(name, dtype, tag, ("-fast" if fast else "")) 
    297298        # Check timestamp on program 
    298299        program, program_timestamp = self.compiled.get(key, (None, np.inf)) 
Note: See TracChangeset for help on using the changeset viewer.