Opened 9 years ago
Closed 8 years ago
#576 closed defect (fixed)
updated custom models not being recompiled
Reported by: | pkienzle | Owned by: | wojciech |
---|---|---|---|
Priority: | major | Milestone: | SasView 4.1.0 |
Component: | SasView | Keywords: | |
Cc: | Work Package: | SasView Bug Fixing |
Description ¶
When updating the custom model within sasview on opencl the model doesn't always get updated.
When compiling to a dll, compile fails because dll is already loaded.
Change History (14)
comment:1 Changed 8 years ago by wojciech
- Owner set to wojciech
- Status changed from new to assigned
comment:2 Changed 8 years ago by pkienzle
comment:3 Changed 8 years ago by pkienzle
To reproduce, create a custom model using Fitting>Edit Custom Model>New, setting model to e.g.,
return a + cos(b*x)
You can then use this model on the fit page. When the model is updated, e.g., to:
return a + cos(b*x) + 100
the new model is not updated.
The same is true for C models. Update the model to:
form_volume = """return 1.0;"""
Iq = """return a + cos(b*q) + 1;"""
Iqxy = None
Test model update and reload on mac, windows wt/ opencl and windows wt/ tinycc.
comment:4 Changed 8 years ago by pkienzle
OpenCL fixed, DLL fails.
To get the DLL to work, first remove the frozen check in sasmodels.kerneldll.make_dll, then restructure the DllKernel so that it doesn't hold any references to the DLL.
Follow the instructions to reproduce above, but with sasmodels.core.HAVE_OPENCL=False.
We can do this by wrapping the ct.CDLL in a class with methods for the different kernels. Instead of calling the kernels directly, calls from DllKernel will go through this object. DllModel may be could do this if we can guarantee there is only ever one DllModel instance for a particular dll, for example, by caching DllModel within load_dll(). Then its internal dll can be released, recompiled and reloaded with any attached kernels automatically updated.
comment:5 Changed 8 years ago by ajj
A student I am working with (Windows / no OpenCL) noticed this problem and currently is working round it by deleting the dll to force a rebuild.
He also noticed that python models will rebuild if secondary functions are changed, but not if Iq and Iqxy are changed. Which is odd.
comment:6 Changed 8 years ago by ajj
Attached model (hexagonal_cylinder.py) is the one that was causing problems - there was different rebuild behaviour between modifying secondary functions (e.g. Reflections() ) vs modifying Iq or Iqxy.
Changed 8 years ago by ajj
comment:7 Changed 8 years ago by wojciech
I did some testing and it seems that python models behave properly (are being updated). This also applies to hexagonal_cylinder.py (at least according to my test).
However, the problem still persist if the plugin models have c code sections like:
form_volume = """return 1.0;"""
Iq = """return a + cos(b*q) + 1;"""
Iqxy = None
These models don't update but SasView doesn't crush.
So this bug seems to apply to rather limited number of cases (plugins with C code embedded and no OpenCL). I guess it shouldn't affect too many users. Shouldn't we wait with fixing it until full 4.0 is out?
comment:8 Changed 8 years ago by butler
- Milestone changed from SasView 4.0.0 to SasView 4.1.0
As decided at the fortnightly meeting Sep 27, 2016 we feel this is good enough for release 4.0 and it would be dangerous to try to fix the rest 3 days before the final release — moving to 4.1
comment:9 Changed 8 years ago by wojciech
comment:10 Changed 8 years ago by ajj
comment:11 Changed 8 years ago by wojciech
comment:12 Changed 8 years ago by wojciech
comment:13 Changed 8 years ago by wojciech
- Resolution set to fixed
- Status changed from assigned to closed
Can force use of DLL rather than OpenCL using the following in the python shell: