Opened 9 years ago
Last modified 9 years ago
#13588 closed enhancement
libGAP! -- create a Cython library interface to gap — at Version 33
Reported by: | vbraun | Owned by: | joyner |
---|---|---|---|
Priority: | major | Milestone: | sage-5.7 |
Component: | group theory | Keywords: | |
Cc: | mmarco, tfeulner, iandrus, SimonKing | Merged in: | |
Authors: | Volker Braun | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #13211, #13880 | Stopgaps: |
Description (last modified by )
Currently, libGAP doesn't give useful errors if something goes wrong during initialization.
Also, the GAP SIGINT handler got installed, this is fixed in the new spkg. Now Ctrl-C works as expected.
- Start with sage-5.6.beta1 or later.
- Install http://www.stp.dias.ie/~vbraun/Sage/spkg/libgap-4.5.7.spkg
- Apply trac_6391_libGAP_root.patch to the root repository
- Apply trac_6391_libGAP.patch to the Sage library
- Apply trac_13588_improve_libGAP.patch to the Sage library
- Apply trac_13588_exec_fix.patch to the Sage library
The trac_6391_*
patches have already been reviewed at #6391, I'm just attaching them to this ticket for convenience.
Change History (37)
comment:1 Changed 9 years ago by
- Cc mmarco added
- Dependencies set to #6391, #13211
- Status changed from new to needs_review
comment:2 Changed 9 years ago by
I have been checking the different updates of libgap, and the error seemed to go away several versions ago. Anyways, i will keep testing it.
comment:3 Changed 9 years ago by
I don't know if it is an issue related with this patch or if it comes from libgap itself, but i have experienced some problems when i use tab completion in a session in the command line (i haven't checked it in the notebook).
An example:
sage: F=libgap.eval('FreeGroup(2)') sage: (a,b)=F.GeneratorsOfGroup() sage: H=F/libgap([a^2,b^2,a*b*a*b]) sage: H <fp group on the generators [ f1, f2 ]> sage: H.IsomorphismSimplifiedFpGroup() [ f1, f2 ] -> [ f1, f2 ] sage: H=F/libgap([a^2,b^2,a*b]) sage: c=H.Gene H.GeneralLinearGroup H.GeneralisedEigenspaces H.GeneralizedEigenvalues H.GeneratorsOfIdeal H.GeneralOrthogonalGroup H.GeneralisedEigenvalues H.GeneratorsOfField H.GeneralUnitaryGroup H.GeneralizedEigenspaces H.GeneratorsOfGroup sage: c=H.GeneratorsOfGroup()[0] --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/mmarco/sage-5.4/<ipython console> in <module>() /home/mmarco/sage-5.4/local/lib/python2.7/site-packages/sage/libs/gap/element.so in sage.libs.gap.element.GapElement.__getattr__ (sage/libs/gap/element.c:3555)() AttributeError: Name "GeneratorsOfGroup" is not defined in GAP. sage: c=H.GeneratorsOfGroup() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/mmarco/sage-5.4/<ipython console> in <module>() /home/mmarco/sage-5.4/local/lib/python2.7/site-packages/sage/libs/gap/element.so in sage.libs.gap.element.GapElement.__getattr__ (sage/libs/gap/element.c:3555)() AttributeError: Name "GeneratorsOfGroup" is not defined in GAP. sage: H Exception RuntimeError: 'Entered a critical block twice' in 'sage.libs.gap.util.error_handler' ignored <fp group on the generators [ f1, f2 ]> sage: H.GeneratorsOfGroup() [ f1, f2 ] sage: c=H.GeneratorsOfGroup()[0] sage: c f1 sage: c=H.Generat H.GeneratorsOfField H.GeneratorsOfGroup H.GeneratorsOfIdeal sage: c=H.GeneratorsOfGroup() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/mmarco/sage-5.4/<ipython console> in <module>() /home/mmarco/sage-5.4/local/lib/python2.7/site-packages/sage/libs/gap/element.so in sage.libs.gap.element.GapElement.__getattr__ (sage/libs/gap/element.c:3555)() AttributeError: Name "GeneratorsOfGroup" is not defined in GAP. sage: c=H.GeneratorsOfGroup() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/mmarco/sage-5.4/<ipython console> in <module>() /home/mmarco/sage-5.4/local/lib/python2.7/site-packages/sage/libs/gap/element.so in sage.libs.gap.element.GapElement.__getattr__ (sage/libs/gap/element.c:3555)() AttributeError: Name "GeneratorsOfGroup" is not defined in GAP. sage: H Exception RuntimeError: 'Entered a critical block twice' in 'sage.libs.gap.util.error_handler' ignored <fp group on the generators [ f1, f2 ]> sage: c=H.GeneratorsOfGroup()
comment:4 Changed 9 years ago by
This same behaviour appears when i don't use this patch, so reported in the libgap ticket.
comment:5 Changed 9 years ago by
- Description modified (diff)
comment:6 Changed 9 years ago by
Updated patch fixes the issue with the command line completion
comment:7 Changed 9 years ago by
- Cc tfeulner added
Updated spkg fixes long input lines (>32k characters):
sage: S = SymmetricGroup(10000) sage: s = S.random_element() sage: len(str(s._gap_())) 61673 sage: libgap(s) (1,5243,8582,5012,6862,7477,1681,7423,8405,3101,...,5257,9362,2495,8500)( [...] )
comment:8 Changed 9 years ago by
- Description modified (diff)
comment:9 Changed 9 years ago by
I've added the same workaround for the gap command line option issue as just discussed in #13211
comment:10 Changed 9 years ago by
I've added __nonzero__
for wrapped GAP booleans for easier use.
comment:11 Changed 9 years ago by
The new patch allows to change the comparison method for libgap objects since not all GAP objects can be compared. This is important if you want use them as cache keys.
Also, the comparison was not properly wrapped in sig_on/sig_off
comment:12 Changed 9 years ago by
I forgot to package aclocal.m4
, updated spkg adds that file.
comment:13 Changed 9 years ago by
- Description modified (diff)
comment:14 Changed 9 years ago by
- Description modified (diff)
comment:15 Changed 9 years ago by
Updated to libGap-4.5.7
comment:16 Changed 9 years ago by
- Dependencies changed from #6391, #13211 to #13211
- Description modified (diff)
comment:17 Changed 9 years ago by
- Description modified (diff)
comment:18 Changed 9 years ago by
- Description modified (diff)
comment:19 Changed 9 years ago by
- Milestone changed from sage-5.6 to sage-5.7
- Summary changed from Improve libGAP startup error handling to libGAP! -- create a Cython library interface to gap
comment:20 Changed 9 years ago by
- Cc iandrus added
comment:21 Changed 9 years ago by
I still see the segfault when trying to execute "Exec" trough libgap. This seems to make it impossible to load gap packages that make use of external programs.
comment:22 Changed 9 years ago by
Thanks for reminding me, I completely forgot about the Exec thing.
In the meantime, can we get this reviewed and included into Sage before the next GAP version comes out?
comment:23 Changed 9 years ago by
- Description modified (diff)
I've replaced the spkg with a new version that fixes the GAP Exec command.
comment:24 Changed 9 years ago by
Thanks. Still i can't load the kbmag package :(
comment:25 Changed 9 years ago by
I've updated the spkg, now loading kbmag works for me. I had to install it by hand since your spkg at #13673 is offline.
comment:26 Changed 9 years ago by
I get a slew of errors in ptestlong after following the instructions of the ticket with Sage 5.5; e.g.:
sage -t --long -force_lib devel/sage/sage/libs/gap/libgap.pyx ********************************************************************** File "/usr/local/src/sage/sage-5.5/devel/sage-main/sage/libs/gap/libgap.pyx", line 11: sage: a = libgap(10) Exception raised: Traceback (most recent call last): File "/usr/local/src/sage/sage-5.5/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/local/src/sage/sage-5.5/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/local/src/sage/sage-5.5/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_0[2]>", line 1, in <module> a = libgap(Integer(10))###line 11: sage: a = libgap(10) File "lazy_import.pyx", line 244, in sage.misc.lazy_import.LazyImport.__call__ (sage/misc/lazy_import.c:2012) File "lazy_import.pyx", line 148, in sage.misc.lazy_import.LazyImport._get_object (sage/misc/lazy_import.c:1291) File "libgap.pyx", line 574, in init sage.libs.gap.libgap (sage/libs/gap/libgap.c:4157) libgap = Gap() File "libgap.pyx", line 395, in sage.libs.gap.libgap.Gap.__init__ (sage/libs/gap/libgap.c:2716) initialize() File "util.pyx", line 193, in sage.libs.gap.util.initialize (sage/libs/gap/util.c:3312) from sage.interfaces.gap import get_gap_memory_pool_size ImportError: cannot import name get_gap_memory_pool_size ********************************************************************** File "/usr/local/src/sage/sage-5.5/devel/sage-main/sage/libs/gap/libgap.pyx", line 12: sage: a Exception raised: Traceback (most recent call last): File "/usr/local/src/sage/sage-5.5/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/usr/local/src/sage/sage-5.5/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/usr/local/src/sage/sage-5.5/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_0[3]>", line 1, in <module> a###line 12: sage: a NameError: name 'a' is not defined
are some patches missing or not up date?
comment:27 follow-up: ↓ 28 Changed 9 years ago by
Did you apply the patches from #13211? The get_gap_memory_pool_size()
function was added in trac_13211_fix_gap_doctests_vb.patch
.
comment:28 in reply to: ↑ 27 Changed 9 years ago by
comment:29 Changed 9 years ago by
Does sig_on() need a matching sig_off() in case sig_on() is issued in a try block, which throws an exception?
Comparison functions returning -1, 0, +1... So FORTRAN |V... :-)
comment:30 Changed 9 years ago by
sig_on
and sig_off
must be paired, though ideally they enclose only C/Cython code which cannot raise Python exceptions. A C signal will jump back to sig_on
and raise there.
http://www.sagemath.org/doc/developer/coding_in_cython.html#using-sig-on-and-sig-off
comment:31 Changed 9 years ago by
- Dependencies changed from #13211 to #13211, #13880
patches from #13880 are needed for doctests to (eventually) pass here.
comment:32 Changed 9 years ago by
- Status changed from needs_review to positive_review
comment:33 Changed 9 years ago by
- Description modified (diff)
Miguel, you said that you had some mysterious error. Can you try this patch? It depends on the recently-updated patches on #6391, #13211.