Skip to content

Commit ea32480

Browse files
committed
SnoopPrecompile -> PrecompileTools
1 parent e680794 commit ea32480

File tree

7 files changed

+90
-20
lines changed

7 files changed

+90
-20
lines changed

.github/workflows/PerformanceCheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: julia-actions/julia-buildpkg@latest
2020
- run: julia -e '
2121
using Pkg;
22-
Pkg.add(["Test", "TestSetExtensions", "Random", "GitHubActions", "Logging", "AbstractAlgebra"]);
22+
Pkg.add(["Test", "TestSetExtensions", "Random", "GitHubActions", "Logging", "AbstractAlgebra", "Nemo"]);
2323
Pkg.add(url="https://github.com/sumiya11/Groebner.jl");
2424
using GitHubActions, Logging;
2525
global_logger(GitHubActionsLogger());

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
99
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
1010
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1111
MultivariatePolynomials = "102ac46a-7ee4-5c85-9060-abc95bfdeaa3"
12+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1213
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
1314
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1415
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1516
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224"
16-
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
1717
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
1818

1919
[compat]
@@ -22,9 +22,9 @@ BenchmarkTools = "1"
2222
Combinatorics = "1"
2323
ExprTools = "0.1"
2424
MultivariatePolynomials = "0.4, 0.5"
25+
PrecompileTools = "1"
2526
Primes = "0.5"
2627
SIMD = "3"
27-
SnoopPrecompile = "1"
2828
TestSetExtensions = "2"
2929
TimerOutputs = "0.5"
3030
julia = "1.6"

benchmark/CI-scripts/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
33
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
4+
Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
45
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
56
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
67
TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04"

benchmark/CI-scripts/run_benchmarks.jl

+81-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Groebner
55
using AbstractAlgebra
6+
import Nemo
67

78
suite = []
89

@@ -17,69 +18,138 @@ function compute_gb(system)
1718
minimum(times)
1819
end
1920

20-
# Compute Groebner bases over
21+
# Compute Groebner bases over integers modulo a large prime
22+
problem = (
23+
problem_name="groebner, AA, GF(2^31-1), katsura 5",
24+
result=compute_gb(Groebner.katsuran(5, ordering=:degrevlex, ground=GF(2^31 - 1)))
25+
)
26+
push!(suite, problem)
2127
push!(
2228
suite,
2329
(
24-
problem_name="groebner, GF(2^31-1), katsura 5",
30+
problem_name="groebner, AA, GF(2^31-1), katsura 5",
2531
result=compute_gb(Groebner.katsuran(5, ordering=:degrevlex, ground=GF(2^31 - 1)))
2632
)
2733
)
2834
push!(
2935
suite,
3036
(
31-
problem_name="groebner, GF(2^31-1), katsura 6",
37+
problem_name="groebner, AA, GF(2^31-1), katsura 6",
3238
result=compute_gb(Groebner.katsuran(6, ordering=:degrevlex, ground=GF(2^31 - 1)))
3339
)
3440
)
3541
push!(
3642
suite,
3743
(
38-
problem_name="groebner, GF(2^31-1), katsura 8",
44+
problem_name="groebner, AA, GF(2^31-1), katsura 8",
3945
result=compute_gb(Groebner.katsuran(8, ordering=:degrevlex, ground=GF(2^31 - 1)))
4046
)
4147
)
4248
push!(
4349
suite,
4450
(
45-
problem_name="groebner, GF(2^31-1), katsura 10",
51+
problem_name="groebner, AA, GF(2^31-1), katsura 10",
4652
result=compute_gb(Groebner.katsuran(10, ordering=:degrevlex, ground=GF(2^31 - 1)))
4753
)
4854
)
4955
push!(
5056
suite,
5157
(
52-
problem_name="groebner, GF(2^31-1), cyclic 8",
58+
problem_name="groebner, AA, GF(2^31-1), cyclic 8",
5359
result=compute_gb(Groebner.cyclicn(8, ordering=:degrevlex, ground=GF(2^31 - 1)))
5460
)
5561
)
5662
push!(
5763
suite,
5864
(
59-
problem_name="groebner, QQ, katsura 8",
65+
problem_name="groebner, Nemo, GF(2^31-1), cyclic 8",
66+
result=compute_gb(
67+
Groebner.cyclicn(8, ordering=:degrevlex, ground=Nemo.GF(2^31 - 1), np=Nemo)
68+
)
69+
)
70+
)
71+
72+
# Compute Groebner bases over the rationals
73+
push!(
74+
suite,
75+
(
76+
problem_name="groebner, AA, QQ, katsura 8",
6077
result=compute_gb(Groebner.katsuran(8, ordering=:degrevlex, ground=QQ))
6178
)
6279
)
6380
push!(
6481
suite,
6582
(
66-
problem_name="groebner, QQ, eco 10",
83+
problem_name="groebner, Nemo, QQ, katsura 8",
84+
result=compute_gb(
85+
Groebner.katsuran(8, ordering=:degrevlex, ground=Nemo.QQ, np=Nemo)
86+
)
87+
)
88+
)
89+
push!(
90+
suite,
91+
(
92+
problem_name="groebner, AA, QQ, eco 10",
6793
result=compute_gb(Groebner.eco10(ordering=:degrevlex, ground=QQ))
6894
)
6995
)
7096
push!(
7197
suite,
7298
(
73-
problem_name="groebner, QQ, cyclic 7",
99+
problem_name="groebner, AA, QQ, cyclic 7",
74100
result=compute_gb(Groebner.cyclicn(7, ordering=:degrevlex, ground=QQ))
75101
)
76102
)
77103

104+
function compute_normalforms(system)
105+
R = parent(system[1])
106+
gb = Groebner.groebner(system)
107+
times = []
108+
trials = 7
109+
for _ in 1:trials
110+
GC.gc()
111+
time = @elapsed begin
112+
n1 = normalform(gb, system)
113+
n2 = normalform(gb, gb)
114+
end
115+
push!(times, time)
116+
end
117+
minimum(times)
118+
end
119+
120+
# Compute normal forms over integers modulo a prime
78121
push!(
79122
suite,
80123
(
81-
problem_name="groebner, QQ, cyclic 7",
82-
result=compute_gb(Groebner.cyclicn(7, ordering=:degrevlex, ground=QQ))
124+
problem_name="normalform, AA, GF(2^31-1), cyclic 7",
125+
result=compute_normalforms(
126+
Groebner.cyclicn(7, ordering=:degrevlex, ground=GF(2^31 - 1))
127+
)
128+
)
129+
)
130+
push!(
131+
suite,
132+
(
133+
problem_name="normalform, AA, GF(103), cyclic 8",
134+
result=compute_normalforms(
135+
Groebner.cyclicn(8, ordering=:degrevlex, ground=GF(103))
136+
)
137+
)
138+
)
139+
push!(
140+
suite,
141+
(
142+
problem_name="normalform, Nemo, GF(103), cyclic 8",
143+
result=compute_normalforms(
144+
Groebner.cyclicn(8, ordering=:degrevlex, ground=Nemo.GF(103), np=Nemo)
145+
)
146+
)
147+
)
148+
push!(
149+
suite,
150+
(
151+
problem_name="normalform, AA, QQ, katsura 9",
152+
result=compute_normalforms(Groebner.katsuran(9, ordering=:degrevlex, ground=QQ))
83153
)
84154
)
85155

docs/developer.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ groebner([x*y + z, x*z + y], loglevel=-2)
6969
All functions in the interface have keyword argument `statistics`. This argument can be set to either of: `:no`, `:timings`, and `:all`.
7070

7171
Use `statistics=:timings` to print the table with timings and allocations of internal functions of Groebner.jl.
72-
73-
Since `Groebner.performance_counters_enabled()` is `false` by default, you should set it to `true` to record runtime statistics. For example,
72+
You should also set `Groebner.performance_counters_enabled()` to `true` to record runtime statistics. For example,
7473

7574
```julia:dev-timings
7675
using Groebner, AbstractAlgebra

src/Groebner.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ include("fglm/kbase.jl")
152152
# API
153153
include("interface.jl")
154154

155-
using SnoopPrecompile
155+
using PrecompileTools
156156
include("precompile.jl")
157157

158158
export groebner, groebner_learn, groebner_apply!

src/precompile.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
@assert VERSION >= v"1.6.0-DEV.154"
44

5-
@precompile_setup begin
5+
@setup_workload begin
66
# Putting some things in `setup` can reduce the size of the
77
# precompile file and potentially make loading faster.
8-
@precompile_all_calls begin
8+
@compile_workload begin
99
# all calls in this block will be precompiled, regardless of whether
1010
# they belong to your package or not (on Julia 1.8 and higher)
1111
R, (x, y) =
@@ -16,7 +16,7 @@
1616
normalform(arr, arr)
1717

1818
R, (x, y) = AbstractAlgebra.PolynomialRing(AbstractAlgebra.GF(2^31 - 1), ["x", "y"])
19-
arr = [x, y]
19+
arr = [x^2 * y + 1, x * y^2 + 1]
2020
gb = groebner(arr, ordering=DegRevLex())
2121
end
2222
end

0 commit comments

Comments
 (0)