Skip to content
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

giacpy_sage causes doctest failures due to threading #23976

Closed
jdemeyer opened this issue Oct 6, 2017 · 16 comments
Closed

giacpy_sage causes doctest failures due to threading #23976

jdemeyer opened this issue Oct 6, 2017 · 16 comments

Comments

@jdemeyer
Copy link

jdemeyer commented Oct 6, 2017

Sometimes, giacpy_sage doctests can run out of memory. This happens on systems with many cores because too many threads are started. Analogous to #23713, the number of threads should be limited by SAGE_NUM_THREADS.

// Groebner basis computation time 0.003507 Memory 0.296004M
sage: gb  # optional - giacpy_sage ## line 3485 ##
[c^3 - 79/210*c^2 + 1/30*b + 1/70*c, b^2 - 3/5*c^2 - 1/5*b + 1/5*c, b*c + 6/5*c^2 - 1/10*b - 2/5*c, a + 2*b + 2*c - 1]
sage: J.groebner_basis.set_cache(gb)  # optional - giacpy_sage ## line 3488 ##
sage: ideal(J.transformed_basis()).change_ring(P).interreduced_basis()  # testing trac 21884 ## line 3489 ##
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
sage: A9=PolynomialRing(QQ,9,'x') # optional - giacpy_sage ## line 3495 ##
sage: I9=sage.rings.ideal.Katsura(A9) # optional - giacpy_sage ## line 3496 ##
sage: I9.groebner_basis("giac",proba_epsilon=1e-7) # optional - giacpy_sage, long time (3s) ## line 3497 ##
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
terminate called recursively
------------------------------------------------------------------------
/home/jdemeyer/sage/local/lib/python2.7/site-packages/cysignals/signals.so(+0x58e8)[0x7fa1751f98e8]
/home/jdemeyer/sage/local/lib/python2.7/site-packages/cysignals/signals.so(+0x5955)[0x7fa1751f9955]
/home/jdemeyer/sage/local/lib/python2.7/site-packages/cysignals/signals.so(+0x8b56)[0x7fa1751fcb56]
/lib64/libpthread.so.0(+0x10e40)[0x7fa17a1b2e40]
/lib64/libc.so.6(gsignal+0x37)[0x7fa179730067]
/lib64/libc.so.6(abort+0x16a)[0x7fa1797314ba]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0xfd)[0x7fa169ea25ad]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6(+0x79486)[0x7fa169ea0486]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6(+0x794d1)[0x7fa169ea04d1]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6(+0x796e8)[0x7fa169ea06e8]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/libstdc++.so.6(+0x79c79)[0x7fa169ea0c79]
/home/jdemeyer/sage/local/lib/libgiac.so.0(_ZN4giac10in_zgbasisINS_8tdeg_t14EEEbRNS_11vectpolymodIT_EEjRSt6vectorIjSaIjEEibPS6_INS_5paireESaISA_EERS6_INS_7zinfo_tIS3_EESaISF_EEbbb+0x4ea)[0x7fa0f3fc23fa]
/home/jdemeyer/sage/local/lib/libgiac.so.0(_ZN4giac7zgbasisINS_8tdeg_t14EEEbRNS_9vectpoly8IT_EERNS_11vectpolymodIS3_EERSt6vectorIjSaIjEEibPS9_INS_5paireESaISD_EERS9_INS_7zinfo_tIS3_EESaISI_EEbbbb+0xf7)[0x7fa0f3fc5ff7]
/home/jdemeyer/sage/local/lib/libgiac.so.0(_ZN4giac13thread_gbasisINS_8tdeg_t14EEEPvS2_+0x3e)[0x7fa0f3fc606e]
/lib64/libpthread.so.0(+0x73d4)[0x7fa17a1a93d4]
/lib64/libc.so.6(clone+0x6d)[0x7fa1797e41ad]
------------------------------------------------------------------------
terminate called recursively

(default max thread, add a setitem method, take account of giac entries in pynac dict for translations from giacpy to sage)

CC: @frederichan-IMJPRG

Component: packages: optional

Author: Frederic Han

Branch/Commit: dda5551

Reviewer: Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/23976

@jdemeyer jdemeyer added this to the sage-8.1 milestone Oct 6, 2017
@jdemeyer
Copy link
Author

jdemeyer commented Oct 6, 2017

Author: Jeroen Demeyer

@jdemeyer

This comment has been minimized.

@frederichan-IMJPRG
Copy link

Commit: c2c8fd8

@frederichan-IMJPRG
Copy link

comment:2

So now the default giacsettings.threads is SAGE_NUM_THREADS or 1 if failed to import.

Some linear algebra tutorial is added in the libgiac doc and a _setitem_ function was added.

@frederichan-IMJPRG
Copy link

Branch: u/frederichan/giacpy_sage-0.6.6

@frederichan-IMJPRG

This comment has been minimized.

@frederichan-IMJPRG frederichan-IMJPRG self-assigned this Oct 6, 2017
@frederichan-IMJPRG

This comment has been minimized.

@jdemeyer
Copy link
Author

jdemeyer commented Oct 6, 2017

Reviewer: Jeroen Demeyer

@jdemeyer
Copy link
Author

jdemeyer commented Oct 6, 2017

comment:4

I planned to fix this in the Sage interface, but I guess your fix also works.

@jdemeyer
Copy link
Author

jdemeyer commented Oct 6, 2017

Changed author from Jeroen Demeyer to Frederic Han

@jdemeyer
Copy link
Author

jdemeyer commented Oct 7, 2017

comment:5

Why are you adding that extra doctest in Sage?

@jdemeyer
Copy link
Author

jdemeyer commented Oct 7, 2017

comment:6

I tested the new version of giacpy_sage and it seems to work fine. So that leaves the question of the extra doctest...

@frederichan-IMJPRG
Copy link

comment:7

Replying to @jdemeyer:

Why are you adding that extra doctest in Sage?

Indeed, I though that the doctest was increasing the giacsettings.threads by two and was not restoring it back but it was not the case, I will remove this line.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2017

Changed commit from c2c8fd8 to dda5551

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

dda5551remove duplicate restoration of giacsetting.threads in doctest

@vbraun
Copy link
Member

vbraun commented Oct 15, 2017

Changed branch from u/frederichan/giacpy_sage-0.6.6 to dda5551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants