Changeset 5a91c6b in sasmodels
- Timestamp:
- May 4, 2016 7:29:22 PM (9 years ago)
- 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:
- 3832f27
- Parents:
- 6ce9048
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kerneldll.py
r3ecf034 r5a91c6b 48 48 import sys 49 49 import os 50 from os.path import join as joinpath, split as splitpath, realpath,splitext50 from os.path import join as joinpath, split as splitpath, splitext 51 51 import tempfile 52 52 import ctypes as ct 53 53 from ctypes import c_void_p, c_int, c_longdouble, c_double, c_float 54 import _ctypes55 54 56 55 import numpy as np … … 79 78 else: 80 79 COMPILE = " ".join((CC, LN)) 81 elif True: # Don't use mingw 80 elif True: 81 # If MSVC compiler is not available, try using mingw 82 82 # fPIC is not needed on windows 83 83 COMPILE = "gcc -shared -std=c99 -O2 -Wall %(source)s -o %(output)s -lm" … … 85 85 COMPILE = COMPILE + " -fopenmp" 86 86 else: 87 # If MSVC compiler is not available, try using tinycc 87 88 from tinycc import TCC 88 89 COMPILE = TCC + " -shared -rdynamic -Wall %(source)s -o %(output)s" … … 151 152 tempfile_prefix = 'sas_' + model_info['name'] + '128_' 152 153 153 source = generate.convert_type(source, dtype)154 source_files = generate.model_sources(model_info) + [model_info['filename']]155 154 dll = dll_path(model_info, dtype) 156 155 157 #newest = max(os.path.getmtime(f) for f in source_files)158 #if not os.path.exists(dll) or os.path.getmtime(dll) < newest:159 156 if not os.path.exists(dll): 160 # Replace with a proper temp file 157 need_recompile = True 158 elif getattr(sys, 'frozen', False): 159 # TODO: don't suppress time stamp 160 # Currently suppressing recompile when running in a frozen environment 161 need_recompile = False 162 else: 163 dll_time = os.path.getmtime(dll) 164 source_files = generate.model_sources(model_info) + [model_info['filename']] 165 newest_source = max(os.path.getmtime(f) for f in source_files) 166 need_recompile = dll_time < newest_source 167 if need_recompile: 161 168 fid, filename = tempfile.mkstemp(suffix=".c", prefix=tempfile_prefix) 169 source = generate.convert_type(source, dtype) 162 170 os.fdopen(fid, "w").write(source) 163 171 command = COMPILE%{"source":filename, "output":dll} … … 258 266 del dll, self.dll 259 267 self.dll = None 260 #_ctypes.FreeLibrary(libHandle)261 268 ct.windll.kernel32.FreeLibrary(libHandle) 262 269 else:
Note: See TracChangeset
for help on using the changeset viewer.