-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cypari2 threadsafe #107
Comments
I doubt https://trac.sagemath.org/ticket/31029 to be the source of problems (this was a minor upgrade). Did you test it with other cypari2 versions ? |
Also, what is the paralellization enabled into your PARI/GP (the option |
I ran cypari using As a test to see if it's #31029, I'll build 9.3.beta5 and 9.3.beta5+#31029 tonight and see if that makes a difference. If you can let me know how to change the Thanks! |
@roed314, you can change it here: https://github.com/sagemath/sage/blob/develop/build/pkgs/pari/spkg-install.in#L130 |
I just checked and you were right. The problem is due to #30537 rather than #31029: there is no error with 9.3.beta7, but adding #30537 yields the problem described. What resolution would you suggest? Changing the parallelization option for pari in Sage back to |
I believe that some of the PARI functions interacting with the stack have to be used with care in a multithreaded PARI. I will ask Bill Allombert. |
Could you copy/paste the gdb traceback (ie launch sage with
which is weird since that involves sage integers... |
Ha in sage 15 is an integer... should be 15r, traceback is different
|
I am unsure about the mechanism underlying
|
Neither @edgarcosta or I has been able to get gdb working correctly, but it sounds like you don't need it anymore? I think Pari's requirements for using threads is going to make higher level threading interfaces (like Python's From Sage's perspective, I'm going to ask on #30537 about why they made that change to I'm not sure what you want to do with cypari. Let us know if there's anything else we can do to help. |
@videlec here is my attempt to do what you asked us: https://gist.github.com/edgarcosta/55870bd5df1ac2f326931a2068a9c775 but I don't seem to manage to catch the traceback this way. |
I think I reproduced enough. Though what Edgar sent is very different from mine...
Disabling
Thanks for the report! I am glad that you found a way around. |
Flask looks to use the |
We're running into this again. We managed to disable threading most of the time, but threading is required to use the flask debugger, so we're not currently able to use the debugger in the LMFDB. If anyone's interested in tackling this, we'd be grateful! |
I would like to add to the requests by @roed314 and @edgarcosta . With Sage 9.5 due to be released soon it would be unfortunate for this problem to still be there. Thank you, cypari developers! |
Just to echo @JohnCremona, we would be extremely grateful to anyone who can help with this, it is now impacting LMFDB development in a pretty serious way. |
@JohnCremona @AndrewVSutherland cypari2 very welcome pull requests. |
We totally understand that you (and other people with more Neither @edgarcosta or I have worked much with the PARI stack, and we would appreciate any tips you can give us about where to begin. If the best option is to email the pari developer list and ask there, we'd be happy to do that. |
Usage examples of multithread in PARI/GP are available in As Bill mentioned to me, one has to be careful : in a multithreaded compiled PARI, some functions are likely to spawn thread. When using |
Thanks to Bill, I have a working prototype. I hope to push a branch soon. |
@JohnCremona @AndrewVSutherland @roed314 @edgarcosta Could you test the branch at #116 to see if you can break it ? |
Absolutely! I'll take a look. |
In my work I have switched from threading (https://docs.python.org/3/library/threading.html) to multiprocessing (https://docs.python.org/3/library/multiprocessing.html) and no PARI segfaults. |
It seems that the 1st thing is to get a proper documentation for Pari/GP threading model. |
As discussed here, the update from Sage 9.2 to 9.3 caused new segmentation faults when running with threads, which we believe is related to the cypari upgrade. Here's an illustration of the problem just with cypari.
Traceback with gdb
The text was updated successfully, but these errors were encountered: