Changeset cde11f0f in sasmodels for sasmodels/kernelcl.py
- Timestamp:
- Dec 23, 2015 8:07:37 AM (8 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:
- 07e72e6
- Parents:
- e3a9733
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernelcl.py
r5d316e9 rcde11f0f 183 183 184 184 def has_type(self, dtype): 185 dtype = np.dtype(dtype)185 dtype = generate.F32 if dtype == 'fast' else np.dtype(dtype) 186 186 return all(has_type(d, dtype) for d in self.context.devices) 187 187 … … 195 195 196 196 def compile_program(self, name, source, dtype, fast=False): 197 if name not in self.compiled: 197 key = "%s-%s-%s"%(name, dtype, fast) 198 if key not in self.compiled: 198 199 #print("compiling",name) 199 self.compiled[name] = compile_model(self.context, source, dtype, 200 fast) 201 return self.compiled[name] 200 dtype = np.dtype(dtype) 201 program = compile_model(self.context, source, dtype, fast) 202 self.compiled[key] = program 203 return self.compiled[key] 202 204 203 205 def release_program(self, name): … … 232 234 for single and 'd', 'float64' or 'double' for double. Double precision 233 235 is an optional extension which may not be available on all devices. 234 235 *fast* is True if fast inaccurate math is acceptable (40% speed increase) 236 """ 237 def __init__(self, source, info, dtype=generate.F32, fast=False): 236 Half precision ('float16','half') may be available on some devices. 237 Fast precision ('fast') is a loose version of single precision, indicating 238 that the compiler is allowed to take shortcuts. 239 """ 240 def __init__(self, source, info, dtype=generate.F32): 238 241 self.info = info 239 242 self.source = source 240 self.dtype = np.dtype(dtype)241 self.fast = fast243 self.dtype = generate.F32 if dtype=='fast' else np.dtype(dtype) 244 self.fast = (dtype == 'fast') 242 245 self.program = None # delay program creation 243 246
Note: See TracChangeset
for help on using the changeset viewer.