Changeset 0dc34c3 in sasmodels


Ignore:
Timestamp:
Aug 19, 2016 11:01:57 PM (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:
3a45c2c, 407bf48
Parents:
4f3dd42
Message:

don't check timestamps of files in library.zip

Location:
sasmodels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r7722b4a r0dc34c3  
    316316 
    317317 
    318 def timestamp(model_info): 
     318def dll_timestamp(model_info): 
    319319    # type: (ModelInfo) -> int 
    320320    """ 
    321321    Return a timestamp for the model corresponding to the most recently 
    322322    changed file or dependency. 
     323    """ 
     324    # TODO: fails DRY; templates appear two places. 
     325    model_templates = [joinpath(DATA_PATH, filename) 
     326                       for filename in ('kernel_header.c', 'kernel_iq.c')] 
     327    source_files = (model_sources(model_info) 
     328                    + model_templates 
     329                    + [model_info.filename]) 
     330    # Note: file may not exist when it is a standard model from library.zip 
     331    times = [getmtime(f) for f in source_files if exists(f)] 
     332    newest = max(times) if times else 0 
     333    return newest 
     334 
     335def ocl_timestamp(model_info): 
     336    # type: (ModelInfo) -> int 
     337    """ 
     338    Return a timestamp for the model corresponding to the most recently 
     339    changed file or dependency. 
    323340 
    324341    Note that this does not look at the time stamps for the OpenCL header 
    325342    information since that need not trigger a recompile of the DLL. 
    326343    """ 
     344    # TODO: fails DRY; templates appear two places. 
     345    model_templates = [joinpath(DATA_PATH, filename) 
     346                       for filename in ('kernel_header.c', 'kernel_iq.cl')] 
    327347    source_files = (model_sources(model_info) 
    328                     + model_templates() 
     348                    + model_templates 
    329349                    + [model_info.filename]) 
    330     newest = max(getmtime(f) for f in source_files) 
     350    # Note: file may not exist when it is a standard model from library.zip 
     351    times = [getmtime(f) for f in source_files if exists(f)] 
     352    newest = max(times) if times else 0 
    331353    return newest 
    332  
    333  
    334 def model_templates(): 
    335     # type: () -> List[str] 
    336     # TODO: fails DRY; templates appear two places. 
    337     # should instead have model_info contain a list of paths 
    338     # Note: kernel_iq.cl is not on this list because changing it need not 
    339     # trigger a recompile of the dll. 
    340     return [joinpath(DATA_PATH, filename) 
    341             for filename in ('kernel_header.c', 'kernel_iq.c')] 
    342354 
    343355 
  • sasmodels/kernelcl.py

    r300a2f7 r0dc34c3  
    397397        if self.program is None: 
    398398            compile_program = environment().compile_program 
    399             timestamp = generate.timestamp(self.info) 
     399            timestamp = generate.ocl_timestamp(self.info) 
    400400            self.program = compile_program( 
    401401                self.info.name, 
  • sasmodels/kerneldll.py

    rbde38b5 r0dc34c3  
    226226    else: 
    227227        dll_time = os.path.getmtime(dll) 
    228         newest_source = generate.timestamp(model_info) 
     228        newest_source = generate.dll_timestamp(model_info) 
    229229        need_recompile = dll_time < newest_source 
    230230    if need_recompile: 
Note: See TracChangeset for help on using the changeset viewer.