Changeset e1454ab in sasmodels


Ignore:
Timestamp:
Apr 25, 2016 9:46:46 AM (9 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
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
Parents:
81cd2a2
git-author:
Piotr Rozyczko <piotr.rozyczko@…> (04/14/16 05:44:48)
git-committer:
Piotr Rozyczko <piotr.rozyczko@…> (04/25/16 09:46:46)
Message:

Ticket #539: Precompile model dlls and reuse them.

Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kerneldll.py

    r4d76711 re1454ab  
    7979            COMPILE = " ".join((CC, LN)) 
    8080    else: 
    81         COMPILE = "gcc -shared -fPIC -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 
     81        # fPIC is unused on windows 
     82        # COMPILE = "gcc -shared -fPIC -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 
     83        COMPILE = "gcc -shared -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 
    8284        if "SAS_OPENMP" in os.environ: 
    8385            COMPILE = COMPILE + " -fopenmp" 
     
    8587    COMPILE = "cc -shared -fPIC -fopenmp -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" 
    8688 
    87 DLL_PATH = tempfile.gettempdir() 
     89# Assume the default location of module DLLs is within the sasmodel directory. 
     90DLL_PATH = os.path.join(os.path.split(os.path.realpath(__file__))[0], "models", "dll") 
    8891 
    8992ALLOW_SINGLE_PRECISION_DLLS = True 
     
    103106        basename += "128" 
    104107    return joinpath(DLL_PATH, basename+'.so') 
    105  
    106108 
    107109def make_dll(source, model_info, dtype="double"): 
     
    143145    source_files = generate.model_sources(model_info) + [model_info['filename']] 
    144146    dll = dll_path(model_info, dtype) 
    145     newest = max(os.path.getmtime(f) for f in source_files) 
    146     if not os.path.exists(dll) or os.path.getmtime(dll) < newest: 
     147 
     148    #newest = max(os.path.getmtime(f) for f in source_files) 
     149    #if not os.path.exists(dll) or os.path.getmtime(dll) < newest: 
     150    if not os.path.exists(dll): 
    147151        # Replace with a proper temp file 
    148152        fid, filename = tempfile.mkstemp(suffix=".c", prefix=tempfile_prefix) 
  • setup.py

    rf903f0a re1454ab  
     1import os 
    12from setuptools import setup,find_packages 
     3 
     4# Create the model .so's 
     5os.system("python gen_so.py") 
    26 
    37packages = find_packages(exclude=['contrib', 'docs', 'tests*']) 
     
    59    'sasmodels.models': ['*.c','lib/*.c'], 
    610    'sasmodels': ['*.c'], 
     11    'sasmodels.models.dll': ['*.so'], 
    712} 
    813required = [] 
Note: See TracChangeset for help on using the changeset viewer.