Hecke.jl
Hecke.jl copied to clipboard
Avoiding Repeated Function Compilation.
Of course, I know, this is not just a problem related to this package. But I really noticed the following example, which needs so much time each time when I re-start Julia to do the same testing:
werner@X10DAi:~/Downloads/julia-1.9.0-rc2-linux-x86_64/julia-1.9.0-rc2/bin$ ./julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.9.0-rc2 (2023-04-01)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Hecke
Welcome to
_ _ _
| | | | | |
| |__| | ___ ___| | _____
| __ |/ _ \/ __| |/ / _ \
| | | | __/ (__| < __/
|_| |_|\___|\___|_|\_\___|
Version 0.18.9 ...
... which comes with absolutely no warranty whatsoever
(c) 2015-2023 by Claus Fieker, Tommy Hofmann and Carlo Sircana
julia> A = [
0 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 1 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 1 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 1 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 1 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 1 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 1 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 1 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 1;
-2 -2 -2 -2 -1 -1 -1 -1 0 0 -2 0 0 0
]
14×14 Matrix{Int64}:
0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1
-2 -2 -2 -2 -1 -1 -1 -1 0 0 -2 0 0 0
julia> B = [
-21 -11 12 9 15 8 -22 -23 2 6 8 -2 2 -8;
32 17 -22 -10 -18 -14 28 35 -5 -6 -13 4 -1 13;
1 4 -17 6 11 -12 -6 18 -16 8 -7 7 4 9;
21 13 -24 -11 -19 -21 33 48 -15 -4 -15 7 -1 18;
14 8 -16 -2 -2 -11 10 23 -9 0 -9 5 0 9;
-1 8 -14 -3 13 -9 -2 21 -18 6 -7 8 0 9;
29 14 -13 -15 -27 -10 36 31 1 -11 -10 1 -4 10;
-26 -8 -8 10 21 -12 -16 14 -25 14 -3 9 5 8;
-8 -6 -1 -9 -31 -14 34 31 -8 -7 -4 1 -2 10;
-19 -8 11 -15 -39 -8 38 24 -4 -9 2 -2 -3 7;
-35 -25 30 3 -11 11 -2 -27 14 -4 14 -9 -2 -13;
-19 -21 32 -6 -34 11 21 -21 23 -14 13 -13 -5 -12;
10 5 3 11 31 16 -36 -36 11 7 5 -2 3 -12;
12 7 -7 -13 -27 -7 30 24 2 -11 -5 -1 -5 6
];
julia> is_GLZ_conjugate(matrix(ZZ,A), matrix(ZZ,B))
[...]
So, I wonder whether there is a way to avoid repeated function compilation, especially for those time-consuming ones.
Regards, Zhao
On Tue, Apr 18, 2023 at 01:57:44AM -0700, hongyi-zhao wrote:
Of course, I know, this is not just a problem related to this package. But I really noticed the following example, which needs so much time each time when I re-start julia to the same testing:
If you don't chage Hecke, you can try:
using Hecke Hecke.build()
(this will run some minutes)
and then start Julia with -J /tmp/Hecke.so you will still have to do using Hecke (but won't see a banner) Then the test should be there immediately...
Greetings Claus
***@***.***:~/Downloads/julia-1.9.0-rc2-linux-x86_64/julia-1.9.0-rc2/bin$ ./julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.9.0-rc2 (2023-04-01) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia> using Hecke Welcome to _ _ _ | | | | | | | |__| | ___ ___| | _____ | __ |/ _ \/ __| |/ / _ \ | | | | __/ (__| < __/ |_| |_|\___|\___|_|\_\___| Version 0.18.9 ... ... which comes with absolutely no warranty whatsoever (c) 2015-2023 by Claus Fieker, Tommy Hofmann and Carlo Sircana julia> A = [ 0 1 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 1 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 1; -2 -2 -2 -2 -1 -1 -1 -1 0 0 -2 0 0 0 ] 14×14 Matrix{Int64}: 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -2 -2 -2 -2 -1 -1 -1 -1 0 0 -2 0 0 0 julia> B = [ -21 -11 12 9 15 8 -22 -23 2 6 8 -2 2 -8; 32 17 -22 -10 -18 -14 28 35 -5 -6 -13 4 -1 13; 1 4 -17 6 11 -12 -6 18 -16 8 -7 7 4 9; 21 13 -24 -11 -19 -21 33 48 -15 -4 -15 7 -1 18; 14 8 -16 -2 -2 -11 10 23 -9 0 -9 5 0 9; -1 8 -14 -3 13 -9 -2 21 -18 6 -7 8 0 9; 29 14 -13 -15 -27 -10 36 31 1 -11 -10 1 -4 10; -26 -8 -8 10 21 -12 -16 14 -25 14 -3 9 5 8; -8 -6 -1 -9 -31 -14 34 31 -8 -7 -4 1 -2 10; -19 -8 11 -15 -39 -8 38 24 -4 -9 2 -2 -3 7; -35 -25 30 3 -11 11 -2 -27 14 -4 14 -9 -2 -13; -19 -21 32 -6 -34 11 21 -21 23 -14 13 -13 -5 -12; 10 5 3 11 31 16 -36 -36 11 7 5 -2 3 -12; 12 7 -7 -13 -27 -7 30 24 2 -11 -5 -1 -5 6 ]; julia> is_GLZ_conjugate(matrix(ZZ,A), matrix(ZZ,B)) [...]
So, I wonder whether there is a way to avoid repeated function compilation, especially for those time-consuming ones.
Regards, Zhao
-- Reply to this email directly or view it on GitHub: https://github.com/thofma/Hecke.jl/issues/1046 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
@fieker Thank you for your tips and it works. But what should I do if I want several or all packages to work in this way?
On Wed, Apr 19, 2023 at 05:42:16AM -0700, hongyi-zhao wrote:
@fieker Thank you for your tips and it works. But what should I do if I want several or all packages to work in this way?
- not all will work, there are julia problems in some
- put it into Hecke/system/precompile.jl
- hope
-- Reply to this email directly or view it on GitHub: https://github.com/thofma/Hecke.jl/issues/1046#issuecomment-1514667576 You are receiving this because you were mentioned.
Message ID: @.***>
One could use https://julialang.github.io/PackageCompiler.jl/stable/sysimages.html to do it for as many packages one wants. There is not much we can do on our part.
@fieker
put it into Hecke/system/precompile.jl
There are currently some code snippets in this file, but they seem to have nothing to do with the issues discussed here. More specifically, the default content in this file seems to be intended for the purpose of completing some tests.
@thofma
One could use https://julialang.github.io/PackageCompiler.jl/stable/sysimages.html to do it for as many packages one wants. There is not much we can do on our part.
So, the question becomes this:
- For several packages, should I compile a separate
.so
sysimage for each of them, or should I combine them into a huge one? - If I've already compiled some sysimages, then is it possible to combine them into the newly created sysimage without having to compile them from scratch?
As far as I understand this at this point the answer is: you'll have to produce a single image containing all packages you're interested in. Reason: loading a second package can easily force a change in the bahviour of an older package (think itroducing a special case for a generic function e.g.) thus the sysimage can only be done this way.
Julia is, I think, working on allowing a more incremental approach, but for now, my very limited understanding implies
- you'll have to do a single image containing all you want
- do this, mostly from scratch, in one go