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

Improved input output for backend polymake #31864

Closed
kliem opened this issue May 27, 2021 · 16 comments
Closed

Improved input output for backend polymake #31864

kliem opened this issue May 27, 2021 · 16 comments

Comments

@kliem
Copy link
Contributor

kliem commented May 27, 2021

From #26368.

The interface to polymake seems to have a significant delay. For input, we can avoid it, as polymake accepts nested lists of integers, rationals, floats.

For output we can avoid it, as at least for matrices and vectors, we can just parse the representation string.

Before:

sage: %time P = polytopes.hypercube(8, backend='polymake')                                                                                                                                                                                                                                                                                                                 
CPU times: user 4.54 s, sys: 260 ms, total: 4.8 s
Wall time: 4.81 s
sage: %time P = polytopes.hypercube(8, backend='polymake')                                                                                                                                                                                                                                                                                                                 
CPU times: user 3.08 s, sys: 236 ms, total: 3.31 s
Wall time: 3.31 s
sage: %time P1 = loads(dumps(P))                                                                                                                                                                                                                                                                                                                                           
CPU times: user 805 ms, sys: 48 ms, total: 853 ms
Wall time: 853 ms
sage: %time P = polytopes.dodecahedron(backend='polymake')                                                                                                                                                                                                                                                                                                                 
CPU times: user 763 ms, sys: 48.2 ms, total: 811 ms
Wall time: 811 ms
sage: %time P = polytopes.dodecahedron(backend='polymake')                                                                                                                                                                                                                                                                                                                 
CPU times: user 661 ms, sys: 31.7 ms, total: 692 ms
Wall time: 692 ms
sage: %time P1 = loads(dumps(P))                                                                                                                                                                                                                                                                                                                                           
CPU times: user 62.9 ms, sys: 0 ns, total: 62.9 ms
Wall time: 62.6 ms
sage: %time P = polytopes.dodecahedron(backend='polymake', exact=False)                                                                                                                                                                                                                                                                                                    
CPU times: user 408 ms, sys: 19.6 ms, total: 428 ms
Wall time: 427 ms

After:

sage: %time P = polytopes.hypercube(8, backend='polymake')                                                                            
CPU times: user 1.56 s, sys: 47.4 ms, total: 1.61 s
Wall time: 1.62 s
sage: %time P = polytopes.hypercube(8, backend='polymake')                                                                            
CPU times: user 69.1 ms, sys: 4.07 ms, total: 73.2 ms
Wall time: 72.8 ms
sage: %time P1 = loads(dumps(P))                                                                                                      
CPU times: user 36.5 ms, sys: 30 µs, total: 36.5 ms
Wall time: 36 ms
sage: %time P = polytopes.dodecahedron(backend='polymake')                                                                            
CPU times: user 206 ms, sys: 4.1 ms, total: 210 ms
Wall time: 209 ms
sage: %time P = polytopes.dodecahedron(backend='polymake')                                                                            
CPU times: user 67.9 ms, sys: 0 ns, total: 67.9 ms
Wall time: 67.2 ms
sage: %time P1 = loads(dumps(P))                                                                                                      
CPU times: user 39.2 ms, sys: 3.7 ms, total: 42.9 ms
Wall time: 41.8 ms
sage: %time P = polytopes.dodecahedron(backend='polymake', exact=False)                                                               
CPU times: user 78.3 ms, sys: 4.01 ms, total: 82.3 ms
Wall time: 81.3 ms

Depends on #27745

CC: @mkoeppe

Component: geometry

Keywords: polymake, input, output

Author: Jonathan Kliem

Branch/Commit: e6fef55

Reviewer: Matthias Koeppe

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

@kliem kliem added this to the sage-9.4 milestone May 27, 2021
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 27, 2021

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

543d211fix number field input

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 27, 2021

Changed commit from 4a66357 to 543d211

@kliem

This comment has been minimized.

@mkoeppe
Copy link
Member

mkoeppe commented May 27, 2021

comment:4

I think it would be better to call NumberFieldElement_quadratic._polymake_init_ instead of duplicating it

@kliem
Copy link
Contributor Author

kliem commented May 27, 2021

comment:5

Good point.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 27, 2021

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

cd6212dexpose memoryallocator as extra package
b2c75d8replace by memory_allocator package
4d8927eMerge branch 'u/gh-kliem/outsource_memory_allocator' of git://trac.sagemath.org/sage into u/gh-kliem/outsource_memory_allocator2
4589081updated to newest beta
fd87c9531866: fixing 3 doctests
44a0df4Merge branch 'u/slabbe/31866' of git://trac.sagemath.org/sage into u/gh-kliem/outsource_memory_allocator
ef9f3b2Merge branch 'u/gh-kliem/polymake_input_output' of git://trac.sagemath.org/sage into u/gh-kliem/polymake_input_output_reb
2f818beuse `_polymake_init_` for quadratic fields

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 27, 2021

Changed commit from 543d211 to 2f818be

@mkoeppe
Copy link
Member

mkoeppe commented May 27, 2021

comment:7

Is #31866 a dependency now?

@kliem
Copy link
Contributor Author

kliem commented May 27, 2021

Changed commit from 2f818be to e6fef55

@kliem
Copy link
Contributor Author

kliem commented May 27, 2021

@kliem
Copy link
Contributor Author

kliem commented May 27, 2021

New commits:

c0eb507use `_polymake_init_` for quadratic fields
e6fef55Merge branch 'develop' of git://trac.sagemath.org/sage into u/gh-kliem/polymake_input_output2

@kliem
Copy link
Contributor Author

kliem commented May 27, 2021

comment:9

Replying to @mkoeppe:

Is #31866 a dependency now?

No, of course not. I am starting to pull in stuff into wrong branches...

@mkoeppe
Copy link
Member

mkoeppe commented May 27, 2021

Reviewer: Matthias Koeppe

@mkoeppe
Copy link
Member

mkoeppe commented May 27, 2021

comment:10

This is a very nice improvement.

@kliem
Copy link
Contributor Author

kliem commented May 27, 2021

comment:11

Thank you. Sometimes it is surprising what the bottle neck of a calculation is.

@vbraun
Copy link
Member

vbraun commented Jul 23, 2021

Changed branch from u/gh-kliem/polymake_input_output2 to e6fef55

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