Changeset 4f3dd42 in sasmodels
- Timestamp:
- Aug 18, 2016 11:30:31 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:
- 3bcb88c, 0dc34c3
- Parents:
- 300a2f7 (diff), deb854f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/ref/magnetism/magnetism.rst
r524e5c4 rdeb854f 4 4 ======================================================= 5 5 6 Magnetic scattering is implemented in five (2D) models 6 In earlier versions of SasView magnetic scattering was implemented in just five 7 (2D) models 7 8 8 9 * :ref:`sphere` … … 11 12 * :ref:`cylinder` 12 13 * :ref:`parallelepiped` 14 15 From SasView 4.x it is implemented on most models in the 'shape' category. 13 16 14 17 In general, the scattering length density (SLD = $\beta$) in each region where the -
sasmodels/kernelcl.py
rbde38b5 r300a2f7 281 281 warnings.warn("the environment variable 'PYOPENCL_CTX' might not be set correctly") 282 282 283 def compile_program(self, name, source, dtype, fast =False):284 # type: (str, str, np.dtype, bool ) -> cl.Program283 def compile_program(self, name, source, dtype, fast, timestamp): 284 # type: (str, str, np.dtype, bool, float) -> cl.Program 285 285 """ 286 286 Compile the program for the device in the given context. 287 287 """ 288 # Note: PyOpenCL caches based on md5 hash of source, options and device 289 # so we don't really need to cache things for ourselves. I'll do so 290 # anyway just to save some data munging time. 288 291 key = "%s-%s%s"%(name, dtype, ("-fast" if fast else "")) 292 # Check timestamp on program 293 program, program_timestamp = self.compiled.get(key, (None, np.inf)) 294 if program_timestamp < timestamp: 295 del self.compiled[key] 289 296 if key not in self.compiled: 290 297 context = self.get_context(dtype) … … 293 300 program = compile_model(self.get_context(dtype), 294 301 str(source), dtype, fast) 295 self.compiled[key] = program 296 return self.compiled[key] 297 298 def release_program(self, name): 299 # type: (str) -> None 300 """ 301 Free memory associated with the program on the device. 302 """ 303 if name in self.compiled: 304 self.compiled[name].release() 305 del self.compiled[name] 302 self.compiled[key] = (program, timestamp) 303 return program 306 304 307 305 def _get_default_context(): … … 399 397 if self.program is None: 400 398 compile_program = environment().compile_program 399 timestamp = generate.timestamp(self.info) 401 400 self.program = compile_program( 402 401 self.info.name, 403 402 self.source['opencl'], 404 403 self.dtype, 405 self.fast) 404 self.fast, 405 timestamp) 406 406 variants = ['Iq', 'Iqxy', 'Imagnetic'] 407 407 names = [generate.kernel_name(self.info, k) for k in variants] … … 421 421 """ 422 422 if self.program is not None: 423 environment().release_program(self.info.name)424 423 self.program = None 425 424 -
sasmodels/sasview_model.py
rbde38b5 r300a2f7 115 115 Load a custom model given the model path. 116 116 """ 117 #print("load custom", path) 117 118 kernel_module = custom.load_custom_kernel_module(path) 118 119 try:
Note: See TracChangeset
for help on using the changeset viewer.