-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Autogenerate flint headers #36449
Autogenerate flint headers #36449
Conversation
The linting error is ridiculous
|
|
If you have a simple rule to change a |
No, I think we would need a mechanism for specifying it (or rather, for specifying exceptions, because I think most occurrences of |
Joels says he has some heuristics for deciding if a function is a predicate (= if the return value is a boolean), but nothing in the case of boolean arguments. |
05079b2
to
4799839
Compare
@mezzarobba @fredrik-johansson The header |
I think this is because it is only installed if flint is built with avx2 support. This needs to be enabled explicitly (no automatic detection at the moment), and sage does not do it. |
All right, this is not too bad. With the autogeneration, I could just try to match headers in the installed directory rather than the flint sources. |
Now
Beyond the missing |
The problem is that the header |
Got passed the trouble of /sage/local/include/flint/qqbar.h: In function ‘qqbar_struct* _qqbar_vec_init(mp_limb_signed_t)’:
/sage/local/include/flint/qqbar.h:57:33: error: invalid conversion from ‘void*’ to ‘qqbar_ptr’ {aka ‘qqbar_struct*’} [-fpermissive]
57 | qqbar_ptr vec = flint_malloc(len * sizeof(qqbar_struct));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void*
In file included from /sage/local/include/flint/fexpr.h:26,
from /sage/local/include/flint/ca.h:26,
from /sage/local/include/flint/ca_vec.h:21,
from sage/libs/flint/flint_wrap.h:48,
from sage/algebras/quatalg/quaternion_algebra_cython.cpp:1203:
/sage/local/include/flint/calcium.h: In function ‘void calcium_stream_init_str(calcium_stream_struct*)’:
/sage/local/include/flint/calcium.h:61:26: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
61 | out->s = flint_malloc(16);
| ~~~~~~~~~~~~^~~~
| |
| void*
In file included from /sage/local/include/flint/ca.h:26,
from /sage/local/include/flint/ca_vec.h:21,
from sage/libs/flint/flint_wrap.h:48,
from sage/algebras/quatalg/quaternion_algebra_cython.cpp:1203:
/sage/local/include/flint/fexpr.h: In function ‘void fexpr_init(fexpr_struct*)’:
/sage/local/include/flint/fexpr.h:82:30: error: invalid conversion from ‘void*’ to ‘mp_limb_t*’ {aka ‘long unsigned int*’} [-fpermissive]
82 | expr->data = flint_malloc(sizeof(ulong));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~
| |
| void*
/sage/local/include/flint/fexpr.h: In function ‘fexpr_struct* _fexpr_vec_init(mp_limb_signed_t)’:
/sage/local/include/flint/fexpr.h:97:33: error: invalid conversion from ‘void*’ to ‘fexpr_ptr’ {aka ‘fexpr_struct*’} [-fpermissive]
97 | fexpr_ptr vec = flint_malloc(sizeof(fexpr_struct) * len);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void*
/sage/local/include/flint/fexpr.h: In function ‘void fexpr_fit_size(fexpr_struct*, mp_limb_signed_t)’:
/sage/local/include/flint/fexpr.h:118:35: error: invalid conversion from ‘void*’ to ‘mp_limb_t*’ {aka ‘long unsigned int*’} [-fpermissive]
118 | expr->data = flint_realloc(expr->data, size * sizeof(ulong));
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void*
/sage/local/include/flint/fexpr.h: In function ‘int fexpr_is_builtin_symbol(const fexpr_struct*, mp_limb_signed_t)’:
/sage/local/include/flint/fexpr.h:313:116: warning: comparison of integer expressions of different signedness: ‘mp_limb_t’ {aka ‘long unsigned int’} and ‘mp_limb_signed_t’ {aka ‘long int’} [-Wsign-compare]
313 | return (FEXPR_TYPE(head) == FEXPR_TYPE_SMALL_SYMBOL) && (((head >> 8) & 0xff) == 0) && (FEXPR_BUILTIN_ID(head) == i);
| ^
/sage/local/include/flint/fexpr.h: In function ‘void fexpr_vec_init(fexpr_vec_struct*, mp_limb_signed_t)’:
/sage/local/include/flint/fexpr.h:459:36: error: invalid conversion from ‘void*’ to ‘fexpr_struct*’ [-fpermissive]
459 | vec->entries = flint_malloc(sizeof(fexpr_struct) * len);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Do you mean that cython complains if you try to |
I will try to fix the missing C++ handrails on FLINT's side. |
@@ -130,19 +130,16 @@ def has_rational_point(self, point=False, algorithm='default', | |||
sage: C = Conic(K, [t^2 - 2, 2*t^3, -2*t^3 - 13*t^2 - 2*t + 18]) | |||
sage: C.has_rational_point(point=True) | |||
(True, (-3 : (t + 1)/t : 1)) | |||
|
|||
sage: R.<t> = FiniteField(23)[] | |||
sage: C = Conic([2, t^2 + 1, t^2 + 5]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the # optional
is not needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mezzarobba also coming from at #35848
|
||
sage: # needs sage.rings.number_field | ||
sage: F.<i> = QuadraticField(-1) | ||
sage: R.<t> = F[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version with the block # needs
is the correct one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mezzarobba also coming from at #35848
I also wrote a script for auto-generating the deprecated arb headers. It turns out that the current flint is missing 11 function declarations present in
|
e03d500
to
ba9f134
Compare
The |
45d6b14
to
893e42c
Compare
@mezzarobba At 8dbaac4 everything compiles but remains three files with doctest errors
The two first one looks related to the flint3 update. Don't you have them at #35848?
|
I do. One is flintlib/flint#1410, which Fredrik has no plans to change back before flint-3.0, so I will update the test. The other ones are functions which have become more accurate; I am not sure why I haven't already updated the corresponding tests. (Perhaps the changes come from improvements made between 3.0-alpha1 and 3.0-rc1 ?) |
b46ef9d
to
8e1238b
Compare
Otherwise, a non cleaned installation would still use the "old" cython version rather than the python one.
ae581ee
to
9ab34ea
Compare
We - write down a script to auto-generate flint header files (currently at https://github.com/videlec/flint-header-sage-autogen) - replace most of the files in `src/sage/libs/flint` by auto-generated files. Doing so, the custom sage code in `src/sage/libs/flint` is always contained in files suffixed by `_sage.pxd`/`_sage.pyx`. - deprecate the files in `src/sage/libs/arb/` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies sagemath#35848 #### Upstream issues and patches - flintlib/flint#1523 - flintlib/flint#1529 - flintlib/flint#1532 - flintlib/flint#1535 - flintlib/flint#1536 - cython/cython#5779 - flintlib/flint#1653 - flintlib/flint#1655 URL: sagemath#36449 Reported by: Vincent Delecroix Reviewer(s): Marc Mezzarobba, Matthias Köppe, Vincent Delecroix
We - write down a script to auto-generate flint header files (currently at https://github.com/videlec/flint-header-sage-autogen) - replace most of the files in `src/sage/libs/flint` by auto-generated files. Doing so, the custom sage code in `src/sage/libs/flint` is always contained in files suffixed by `_sage.pxd`/`_sage.pyx`. - deprecate the files in `src/sage/libs/arb/` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies sagemath#35848 #### Upstream issues and patches - flintlib/flint#1523 - flintlib/flint#1529 - flintlib/flint#1532 - flintlib/flint#1535 - flintlib/flint#1536 - cython/cython#5779 - flintlib/flint#1653 - flintlib/flint#1655 URL: sagemath#36449 Reported by: Vincent Delecroix Reviewer(s): Marc Mezzarobba, Matthias Köppe, Vincent Delecroix
We - write down a script to auto-generate flint header files (currently at https://github.com/videlec/flint-header-sage-autogen) - replace most of the files in `src/sage/libs/flint` by auto-generated files. Doing so, the custom sage code in `src/sage/libs/flint` is always contained in files suffixed by `_sage.pxd`/`_sage.pyx`. - deprecate the files in `src/sage/libs/arb/` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies sagemath#35848 #### Upstream issues and patches - flintlib/flint#1523 - flintlib/flint#1529 - flintlib/flint#1532 - flintlib/flint#1535 - flintlib/flint#1536 - cython/cython#5779 - flintlib/flint#1653 - flintlib/flint#1655 URL: sagemath#36449 Reported by: Vincent Delecroix Reviewer(s): Marc Mezzarobba, Matthias Köppe, Vincent Delecroix
…e relative by absolute imports <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> We restructure the `all.py` files for modularization. Guided by the technical constraints outlined in https://groups.google.com/g/sage-devel/c/ozh-7ZZ848s, sagemath#35095 defines distribution packages (pip-installable packages) **sagemath-{brial, combinat, eclib, flint, gap, giac, glpk, graphs, groups, homfly, lcalc, libbraiding, libecm, linbox, modules, mpmath, ntl, pari, plot, polyhedra, schemes, singular, standard-no-symbolics, symbolics}**. When a namespace package such as `sage.misc` is filled by modules from several distribution packages, we create modules named: - `src/sage/misc/all__sagemath_environment.py` - `src/sage/misc/all__sagemath_objects.py` - `src/sage/misc/all__sagemath_repl.py` Import statements are moved from `src/sage/misc/all.py` to these files as appropriate, and `src/sage/misc/all.py` imports `*` from there. Also some imports are replaced by lazy imports. The new files provide the top level namespaces for the modularized distribution packages, thus [enabling modularized testing](https://doc.s agemath.org/html/en/developer/packaging_sage_library.html#testing- distribution-packages). This design was introduced in sagemath#29865 (merged in Jan 2022, early in the Sage 9.6 development cycle). <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Copied from sagemath#35095. - Part of sagemath#29705 Moreover, applied a one-line command to replace relative by absolute imports, thus complementing sagemath#36666, which does not touch `.all*` files. The changes to other files in `sage.modules` etc. come from the PRs sagemath#36597, sagemath#36572, sagemath#36588, sagemath#36589 merged here and do not need review. <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> - Depends on sagemath#36597 (merged here to resolve merge conflict) - Depends on sagemath#36572 (merged here to resolve merge conflict) - Depends on sagemath#36588 (merged here to resolve merge conflict) - Depends on sagemath#36589 (merged here to resolve merge conflict) - Depends on sagemath#36449 (merged here to resolve merge conflict) <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36676 Reported by: Matthias Köppe Reviewer(s): David Coudert, John H. Palmieri, Matthias Köppe, Tobias Diez
This breaks build for me. Sagelib-only build against system libraries on Arch
and a few other similar failures |
The problem is that |
Is it it a problem with flint itself then? |
It's not a problem of flint or fplll per se. They just have conflicting definitions of two macros, so they can't be simultaneously included. |
Did you contact upstream maintainers (@fredrik-johansson @ClementPernet)? |
Regardless of whether upstreams do something about this conflict in the future, this needs to be fixed in Sage as it's currently broken on systems where linbox is built with fplll. Proposed fix at #37064 |
Undefine flint macros that conflict with fplll variables and break build when both are included See sagemath#36449 (comment) URL: sagemath#37064 Reported by: Antonio Rojas Reviewer(s): Tobias Diez, Vincent Delecroix
…e relative by absolute imports <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> We restructure the `all.py` files for modularization. Guided by the technical constraints outlined in https://groups.google.com/g/sage-devel/c/ozh-7ZZ848s, sagemath#35095 defines distribution packages (pip-installable packages) **sagemath-{brial, combinat, eclib, flint, gap, giac, glpk, graphs, groups, homfly, lcalc, libbraiding, libecm, linbox, modules, mpmath, ntl, pari, plot, polyhedra, schemes, singular, standard-no-symbolics, symbolics}**. When a namespace package such as `sage.misc` is filled by modules from several distribution packages, we create modules named: - `src/sage/misc/all__sagemath_environment.py` - `src/sage/misc/all__sagemath_objects.py` - `src/sage/misc/all__sagemath_repl.py` Import statements are moved from `src/sage/misc/all.py` to these files as appropriate, and `src/sage/misc/all.py` imports `*` from there. Also some imports are replaced by lazy imports. The new files provide the top level namespaces for the modularized distribution packages, thus [enabling modularized testing](https://doc.s agemath.org/html/en/developer/packaging_sage_library.html#testing- distribution-packages). This design was introduced in sagemath#29865 (merged in Jan 2022, early in the Sage 9.6 development cycle). <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Copied from sagemath#35095. - Part of sagemath#29705 Moreover, applied a one-line command to replace relative by absolute imports, thus complementing sagemath#36666, which does not touch `.all*` files. The changes to other files in `sage.modules` etc. come from the PRs sagemath#36597, sagemath#36572, sagemath#36588, sagemath#36589 merged here and do not need review. <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> - Depends on sagemath#36597 (merged here to resolve merge conflict) - Depends on sagemath#36572 (merged here to resolve merge conflict) - Depends on sagemath#36588 (merged here to resolve merge conflict) - Depends on sagemath#36589 (merged here to resolve merge conflict) - Depends on sagemath#36449 (merged here to resolve merge conflict) <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36676 Reported by: Matthias Köppe Reviewer(s): David Coudert, John H. Palmieri, Kwankyu Lee, Matthias Köppe, Tobias Diez
The FLINT headers are generated manually using a script from sagemath#36449. However, the documentations are not quite clear, and neither is the commit that the current headers are generated from. This commit adds these two details. @videlec do you mind reviewing? I am not sure if the `flint-commit.txt` is an acceptable way to put this information, or where I should put it. Also I'm aware that this script might be moved in the future (since it shouldn't belong in `sage_setup`?) but that shouldn't conflict with this PR. URL: sagemath#37458 Reported by: grhkm21 Reviewer(s): Vincent Delecroix
We
src/sage/libs/flint
by auto-generated files. Doing so, the custom sage code insrc/sage/libs/flint
is always contained in files suffixed by_sage.pxd
/_sage.pyx
.src/sage/libs/arb/
📝 Checklist
⌛ Dependencies
#35848
Upstream issues and patches