Opened 7 years ago
Closed 7 years ago
#1043 closed defect (fixed)
problem compiling marketplace models
Reported by: | wojciech | Owned by: | GitHub <noreply@…> |
---|---|---|---|
Priority: | blocker | Milestone: | SasView 4.2.0 |
Component: | sasmodels Markeplace | Keywords: | |
Cc: | Work Package: | SasView Bug Fixing |
Description
When trying to compile models from marketplce numerous erros pop up related orientation/magnetism. This probably has something to do with recent orientation branch pushed to sasmodels. I've basically downloaded cylinder model from marketplace changed its name to marketplace_cylinder (also in python file where its pointing to c file) and run it from sasview as plugin model. One can probably do the same with sascomp.
Error message is long, so posting just a part of it
Traceback (most recent call last): File "/Users/wojciechpotrzebowski/SASVIEW_WORKSPACE/sasview/src/sas/sascalc/data_util/calcthread.py", line 274, in _run self.compute(*args, **kwargs) RuntimeError: compile failed. cc -shared -fPIC -std=c99 -O2 -Wall /var/folders/8c/pd135bx14f3_7xbhfxmkrcdx1ksm4c/T/sas64_marketplace_cylinder_qmYBBF.c -o /var/folders/8c/pd135bx14f3_7xbhfxmkrcdx1ksm4c/T/sas64_marketplace_cylinder.so -lm /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:61:5: warning: implicit declaration of function 'ORIENT_SYMMETRIC' is invalid in C99 [-Wimplicit-function-declaration] ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); ^ /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:61:42: warning: variable 'q' is uninitialized when used here [-Wuninitialized] ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); ^ /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:60:13: note: initialize the variable 'q' to silence this warning double q, sin_alpha, cos_alpha; ^ = 0.0 /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:61:45: warning: variable 'sin_alpha' is uninitialized when used here [-Wuninitialized] ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); ^~~~~~~~~ /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:60:24: note: initialize the variable 'sin_alpha' to silence this warning double q, sin_alpha, cos_alpha; ^ = 0.0 /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:61:56: warning: variable 'cos_alpha' is uninitialized when used here [-Wuninitialized] ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha); ^~~~~~~~~ /Users/wojciechpotrzebowski/.sasview/plugin_models/marketplace_cylinder.c:60:35: note: initialize the variable 'cos_alpha' to silence this warning double q, sin_alpha, cos_alpha; ^ = 0.0
It probably also applies to old plugin models. It also seems that dummy Iqxy shouldn't be included in models as they fail to compile too.
We probably need to provide a patch for old/marketplace models.
Change History (11)
comment:1 Changed 7 years ago by pkienzle
comment:2 Changed 7 years ago by butler
I am confused here. At this point there is only a handful of models in the marketplace that are different from the built in models … including the cylinder model mentioned here. These models are supposed to be automatically updated if changed in sasmodels so they should just work. Is the real problem that the script to update marketplace models is not working?
comment:3 Changed 7 years ago by smk78
No, Lewis put all the built-ins on the Marketplace, remember.
comment:4 Changed 7 years ago by butler
That is not what he said or documented on the wiki at
DevNotes/Processeses/MarketplaceDeployment
and I believe Was tested at least once.
comment:5 Changed 7 years ago by butler
Interestingly models have not in fact been automatically updating since sep 7, 2017 it seems. This may be related to ticket #1044. I note that a python only model was successfully uploaded to the marketplace on Dec 5, 2017. Probably need to check the server log files and file permissions as noted by Lewis in his notes.
comment:6 Changed 7 years ago by wojciech
Sep 7 is when Lewis finished off upload script: https://github.com/SasView/sasmodel-marketplace/commit/c5d579a2222cb244b0946e83110b25779e62dd9d and it was probably last time it was triggered.
Checking logs is probably good starting point. Should we assaign omeone with utk.edu credentials to this ticket?
comment:7 Changed 7 years ago by richardh
[ To further clarify Paul K's comment above, I include below extracts of emails exchanged with him after I noticed that he had changed the way 2d intensity is calculated, less arguments to Iqxy and no longer any call to orient_symmetric or orient_assymmetric, as part of the massive #776 orientation_776 ticket.]
[ There seem to be three submitted marketplace models (2 in cylinder, 1 in ellipsoid) that are actually affected, and as Paul B says could be edited by hand by us. BUT we would then have a backwards comaptibility issue if older versions of sasview are still to be supported by the marketplace, so there would need to be old and new versions.]
[ This does raise a more general issue about the marketplace, how do we maintain backwards compatibility or flag which version of sasview][ (or at least for the current and previous saview releases?)][ a marketplace model will work with if we change the way the sasview kernel calculates things.]
[ The marketplace could tell users where to find source code for built in sasview models in either their install directories (which would at least mean they have a version that works for them) or else perhaps on github? - though this would not be as elegant as the current links to download the code for models.]
[ Richard]
[ From: Paul Kienzle []mailto:paul.kienzle@…]
Sent: 02 November 2017 16:51
To: Heenan, Richard (STFC,RAL,ISIS)
Subject: Re: when did orient_asymmetric go?
No longer need the theta, phi, psi arguments in Iqxy.
- Paul
From: Paul Kienzle paul.kienzle@…
Sent: 02 November 2017 15:55
To: Heenan, Richard (STFC,RAL,ISIS)
Subject: Re: when did orient_asymmetric go? PS
Just to be clear, in updating all the models I noticed that they all had q*xhat or the equivalent, so rather than sending in four parameters (q, xhat, yhat, zhat), I decided to send in (qx, qy, qz), renamed (qa, qb, qc) to avoid confusion with the lab-space qx, qy coordinate system. This also means that I don't have to compute |q| as part of the kernel. The only kernels that actually needed |q| were the paracrystal kernels, which use it for the radius in the spherical form factor.
- Paul
Hi Paul,
In early October I gave some users in Korea a special version of core_shell_bicelle_elliptical (attached fyi only) but that no longer compiles (at least in orientation branch) as there is now no longer a call to orient_asymmetric in the 2d intensity.
Looking at the history on git for core_shell_bicelle_elliptical.c does not show when or how you removed the call and sorted the parameters. Was this done automatically or by some hard work?
[more likely I was not looking in the correct branch?]
Thanks, Richard
comment:8 Changed 7 years ago by butler
As agreed at the Tuesday fortnightly meeting, the first part of the answer will be #2 given above. The issue with the marketplace not updating is now in ticket #1047 while the need to add a "flag" to the marketplace so that the version of the API supported is documented with each model is in ticket #1045. Finally the need to change the handful of custom models in the marketplace that use 2D to use the new API is documented in ticket #1046.
comment:9 Changed 7 years ago by pkienzle
Yet another issue: line.Iqxy returns (m*qx+b)*(m*qy+b), but the new interface no longer provides Iqxy.
It could be useful to have arbitrary 2D calculations without orientation parameters converting qx, qy to qa, qb, qc, for example, if there is a strange 2D background that somebody is trying to model.
We can fake it by including theta, phi, psi fixed at 0 and hidden so that Iqabc(qa, qb, qc, ...) is the same as Iqabc(qx, qy, 0, ...), but that is messy.
So, do we need to continue to support Iqxy functions?
comment:10 Changed 7 years ago by pkienzle
PR 57 supports Iqabc and Iqxy.
comment:11 Changed 7 years ago by GitHub <noreply@…>
- Owner set to GitHub <noreply@…>
- Resolution set to fixed
- Status changed from new to closed
Yes, this will be a problem during the transition to the new sasview.
I don't think you want to maintain both old and new ways of calling the kernel in the code.
Doing a correct code transformation automatically would be much too hard.
(1) Could strip out old style Iqxy in the new version:
check if source contains the string ORIENT_A?SYMMETRIC. If so, look for “Iqxy”, scan forward to the next “{“, set nesting_level = 1 and scan the text, adding 1 for each ‘{‘ and subtracting 1 for each ‘}’ until nesting_level is 0. Replace the substring with “return NAN;”.
Something like:
2D models will be broken for this model, but arguably they were anyway. Maybe spit something out through logger.
This does not cover the case of the trivial Iqxy = Iq(sqrt(qx*qx + qy*qy)).
(2) Could change API for the new models to use Iqac or Iqabc instead of Iqxy. Then strip any Iqxy function from the source with code similar to the above.
(3) Could document that old-style Iqxy models no longer work and give instructions on updating them.