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

Merge pynac sources as src/sage/symbolic/ginac #32386

Closed
mkoeppe opened this issue Aug 16, 2021 · 158 comments
Closed

Merge pynac sources as src/sage/symbolic/ginac #32386

mkoeppe opened this issue Aug 16, 2021 · 158 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 16, 2021

Pynac has a compile-time dependency on the Python library but is not installed using Python package infrastructure. This is problematic because Python users cannot install it using standard Python tools - for example for testing different Python versions.

Pynac has no other uses than as the core of the symbolic expressions facility of Sage; and cannot even be tested without Sage.

We merge Pynac (i.e., the directory https://github.com/pynac/pynac/tree/master/ginac) into the Sage library as src/sage/symbolic/ginac. It is not a very big package - one flat directory with 100 *.h and *.cpp files, a total of 50kLOC. (The existing !Python/Cython symbolics code in sage.symbolic, sage.calculus, sage.functions is about 60kLOC.)

The Pynac sources are compiled like other C++ sources that are already in the Sage source tree. They are linked into a single Python extension module, sage.symbolic.expression. All other extension modules that used to link to pynac (sage.libs.pynac.pynac, sage.symbolic.function, sage.symbolic.series etc.) are

This solves the same issues that #30534 tried to address, which ran into unresolved technical difficulties.

It will also make it easier for Sage developers to make changes to Pynac and the related symbolic implementation.

Follow-up: #32387 Remove pynac spkg

Depends on #32391
Depends on #32407
Depends on #32461

CC: @kliem @kiwifb @antonio-rojas @DaveWitteMorris @slel @dimpase @tscrim @egourgoulhon @nbruin

Component: symbolics

Author: Matthias Koeppe, Jonathan Kliem

Branch: 0d0b58f

Reviewer: Dima Pasechnik

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

@mkoeppe mkoeppe added this to the sage-9.5 milestone Aug 16, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Merge pynac as src/sage/symbolics/ginac Merge pynac as src/sage/symbolic/ginac Aug 16, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

comment:3

I ran git filter-branch -f --tree-filter 'rm -f Makefile.am; mkdir -p src/sage/symbolic/ginac; mv *.* src/sage/symbolic/ginac/; :' -- --all on pynac 0.7.29 and merged it here, thus preserving the relevant history


Last 10 new commits:

f3bb79fMerge pull request #374 from slel/fix-exp-inv-hyp
a99791bapply patches from #31479 and #31554
91cb6faapply trac 31869 fix pynac integer_content
d96393capply trac 30688 patch infinite loop in pynac
80269c5apply trac 31645 handling of constant term in series
4caca2eapply trac 31530 patch pynac power::subs
cba9038trac 31585 32-bit overflow
8acb548also fix /=
f2040c8ginac/numeric.cpp: Only use builtin for smull_overflow if supported by the compiler
e43830dMerge remote-tracking branch 'pynac-filtered/master' into t/32386/merge_pynac_as_src_sage_symbolic_ginac

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

Commit: e43830d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

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

2bbf412build/pkgs/pynac: Remove

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

Changed commit from e43830d to 2bbf412

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

comment:5

Next: Move stuff from sage.libs.pynac to sage.symbolic.ginac, leaving some deprecated reimports behind.

Help from Cython experts very welcome...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

Changed commit from 2bbf412 to e693827

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

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

e693827Move stuff from sage.libs.pynac to sage.symbolic.ginac, leaving some deprecated reimports behind

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

Changed commit from e693827 to 0581bac

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

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

0bfc24fsrc/sage/symbolic/ginac/version.h.in: Remove
0581bacsrc/sage/symbolic/ginac/pynac-config.h: New

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

comment:8

This version compiles OK

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

Author: Matthias Koeppe

@mkoeppe mkoeppe changed the title Merge pynac as src/sage/symbolic/ginac Merge pynac sources as src/sage/symbolic/ginac Aug 16, 2021
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

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

496102dsrc/sage/symbolic/ginac/utils.h, pynac-config.h: Eliminate use of PYNAC_SIZEOF_LONG, PYNAC_SIZEOF_LONG_LONG
fc29c1dsrc/sage/symbolic/pynac.pyx, pynac.pxd: Fixup distutils: sources

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

Changed commit from 0581bac to fc29c1d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

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

8223127src/sage/symbolic/ginac/utils.h: Fixup
add5e89src/sage/symbolic/ginac/utils.cpp: Fixup removal of version.h

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

Changed commit from fc29c1d to add5e89

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

comment:14

This mostly works but I'm getting a few timeouts/crashes that I'm not sure about

sage -t --random-seed=0 src/sage/schemes/elliptic_curves/ell_number_field.py  # Timed out
sage -t --random-seed=0 src/sage/manifolds/differentiable/degenerate_submanifold.py  # 1 doctest failed
sage -t --random-seed=0 src/sage/manifolds/differentiable/tensorfield.py  # Timed out
sage -t --random-seed=0 src/sage/plot/plot3d/parametric_plot3d.py  # Timed out
sage -t --random-seed=0 src/sage/plot/plot3d/plot3d.py  # Timed out
sage -t --random-seed=0 src/sage/plot/plot3d/base.pyx  # Timed out
sage -t --random-seed=0 src/sage/plot/plot3d/implicit_plot3d.py  # Timed out
sage -t --random-seed=0 src/sage/symbolic/relation.py  # Timed out
sage -t --random-seed=0 src/sage/symbolic/expression.pyx  # Killed due to illegal instruction
sage -t --random-seed=0 src/sage/symbolic/pynac_constant.pyx  # 18 doctests failed

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

Changed commit from add5e89 to d9a1420

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 16, 2021

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

d9a1420src/sage/symbolic/pynac_constant.pyx: Fix imports in doctests

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

comment:16

The crash is from this doctest:

>>> m = var('m')
>>> assume(m, 'integer')
>>> (I**m).real_part()

which seems to lead to an infinite recursion through GiNaC::power::real_part()

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 16, 2021

comment:17

Oh, this is #28357 and I forgot to apply realpartloop.patch

@dimpase
Copy link
Member

dimpase commented Sep 3, 2021

@dimpase
Copy link
Member

dimpase commented Sep 3, 2021

comment:107

lgtm

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 3, 2021

comment:108

Thank you!

@dimpase
Copy link
Member

dimpase commented Sep 4, 2021

comment:109

should #32461 be a dependency here?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 4, 2021

Changed dependencies from #32391, #32407 to #32391, #32407, #32461

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 13, 2021

Changed commit from 327ca5f to 0d0b58f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 13, 2021

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

0d0b58fMerge tag '9.5.beta1' into t/32386/merge_pynac_as_src_sage_symbolic_ginac

@vbraun
Copy link
Member

vbraun commented Sep 15, 2021

Changed branch from u/mkoeppe/merge_pynac_as_src_sage_symbolic_ginac to 0d0b58f

@egourgoulhon
Copy link
Member

Changed commit from 0d0b58f to none

@egourgoulhon
Copy link
Member

comment:114

Replying to @mkoeppe:

It will also need to be checked that the deferred imports (such as those introduced in my commit 3153781) do not lead to speed regressions

FWIW, the change performed here did not introduced any speed regression in the rather demanding Kerr spacetime notebook, which involves parallelized (8 threads) heavy symbolic computations. On the contrary, it seems there is some little speed up :-) On my i7-8665U laptop:

  • Sage 9.4: 461 s
  • Sage 9.5.beta2: 449 s

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 28, 2021

comment:115

Thanks for testing!

mkoeppe added a commit to mkoeppe/sage that referenced this issue Sep 19, 2023
mkoeppe added a commit to mkoeppe/sage that referenced this issue Oct 11, 2023
vbraun pushed a commit to vbraun/sage that referenced this issue Oct 17, 2023
…h#18036, sagemath#29738, sagemath#32386, sagemath#32638, sagemath#32665, sagemath#34215

    
<!-- ^^^^^
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 -->

<!-- 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". -->
<!-- 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.
- [ ] 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: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36304
Reported by: Matthias Köppe
Reviewer(s): David Coudert
vbraun pushed a commit to vbraun/sage that referenced this issue Oct 19, 2023
…h#18036, sagemath#29738, sagemath#32386, sagemath#32638, sagemath#32665, sagemath#34215

    
<!-- ^^^^^
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 -->

<!-- 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". -->
<!-- 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.
- [ ] 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: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36304
Reported by: Matthias Köppe
Reviewer(s): David Coudert
mkoeppe added a commit to mkoeppe/sage that referenced this issue Apr 25, 2024
mkoeppe added a commit to mkoeppe/sage that referenced this issue May 8, 2024
mkoeppe added a commit to mkoeppe/sage that referenced this issue May 12, 2024
vbraun pushed a commit to vbraun/sage that referenced this issue May 24, 2024
…2386 (2021)

    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [ ] 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 and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#37873
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
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

7 participants