From f3c9ecae093ea6a301b690ea1af45225ad11cdf6 Mon Sep 17 00:00:00 2001 From: Sasha Demin Date: Sat, 27 Jan 2024 01:16:22 +0100 Subject: [PATCH] minor fix --- benchmark/results/benchmark_result_0.md | 8 +-- .../results/groebner/benchmark_result_0.md | 4 +- .../results/groebner/benchmark_result_1.md | 51 ++++++++++--------- benchmark/results/maple/benchmark_result_0.md | 8 +-- .../results/msolve/benchmark_result_0.md | 4 +- experimental/lexcmp.jl | 12 +++++ src/groebner/state.jl | 4 +- src/input-output/AbstractAlgebra.jl | 19 ++++--- 8 files changed, 64 insertions(+), 46 deletions(-) diff --git a/benchmark/results/benchmark_result_0.md b/benchmark/results/benchmark_result_0.md index dcbc540f..ba8ac69e 100644 --- a/benchmark/results/benchmark_result_0.md +++ b/benchmark/results/benchmark_result_0.md @@ -1,21 +1,21 @@ ## Benchmark results -2024-01-26T23:39:30.428 +2024-01-27T00:31:15.423 Benchmarked backends: Any["groebner", "maple", "msolve"] Benchmark suite: dummy benchmark set - Workers: 16 -- Timeout: 1800 s +- Timeout: 60 s - Aggregated over: 1 runs **All timings in seconds.** |Model|groebner|maple|msolve| |:----|---|---|---| -|dummy 1|0.00|0.24|0.03| -|dummy 2|0.00|0.23|0.03| +|dummy 1|0.00|0.23|0.03| +|dummy 2|0.00|0.21|0.03| *Benchmarking environment:* diff --git a/benchmark/results/groebner/benchmark_result_0.md b/benchmark/results/groebner/benchmark_result_0.md index cec188c6..fa5e79a4 100644 --- a/benchmark/results/groebner/benchmark_result_0.md +++ b/benchmark/results/groebner/benchmark_result_0.md @@ -1,13 +1,13 @@ ## Benchmark results -2024-01-26T23:39:00.057 +2024-01-27T00:30:45.638 Benchmarked backend: groebner Benchmark suite: dummy benchmark set - Workers: 16 -- Timeout: 1800 s +- Timeout: 60 s - Aggregated over: 1 runs **All timings in seconds.** diff --git a/benchmark/results/groebner/benchmark_result_1.md b/benchmark/results/groebner/benchmark_result_1.md index 5f7a4e45..cb7b9c9b 100644 --- a/benchmark/results/groebner/benchmark_result_1.md +++ b/benchmark/results/groebner/benchmark_result_1.md @@ -1,48 +1,48 @@ ## Benchmark results -2024-01-26T15:00:05.266 +2024-01-27T00:17:07.455 Benchmarked backend: groebner Benchmark suite: Integers modulo 2^30 + 3 - Workers: 16 -- Timeout: 600 s -- Aggregated over: 3 runs +- Timeout: 1800 s +- Aggregated over: 1 runs **All timings in seconds.** |Model|Total, s| |:----|---| -|chandra 11|0.48| -|chandra 12|2.73| -|chandra 13|14.95| -|chandra 14|98.81| +|chandra 11| - | +|chandra 12| - | +|chandra 13| - | +|chandra 14| - | |cyclic 7|0.09| -|cyclic 8|1.17| -|cyclic 9|120.54| +|cyclic 8|1.56| +|cyclic 9|255.31| |cyclic 10| - | |dummy|0.00| -|eco 11|0.30| -|eco 12|1.98| -|eco 13|9.00| -|eco 14|93.24| -|henrion 5|0.00| -|henrion 6|0.03| -|henrion 7|1.97| +|eco 11| - | +|eco 12| - | +|eco 13| - | +|eco 14| - | +|henrion 5| - | +|henrion 6| - | +|henrion 7| - | |henrion 8| - | -|katsura 10|0.75| -|katsura 11|5.14| -|katsura 12|35.77| +|katsura 10| - | +|katsura 11| - | +|katsura 12|101.30| |katsura 13| - | -|noon 7|0.17| -|noon 8|1.37| -|noon 9|13.44| +|noon 7| - | +|noon 8| - | +|noon 9|16.57| |noon 10| - | |noon 11| - | -|reimer 6|0.05| -|reimer 7|0.69| -|reimer 8|18.28| +|reimer 6| - | +|reimer 7| - | +|reimer 8| - | |reimer 9| - | *Benchmarking environment:* @@ -58,6 +58,7 @@ Versions of the dependencies: * PrecompileTools : 1.2.0 * MultivariatePolynomials : 0.5.3 * Combinatorics : 1.0.2 +* HostCPUFeatures : 0.1.16 * AbstractAlgebra : 0.34.7 * Nemo : 0.38.3 * Atomix : 0.1.0 diff --git a/benchmark/results/maple/benchmark_result_0.md b/benchmark/results/maple/benchmark_result_0.md index fdd02ec1..d1c70cb3 100644 --- a/benchmark/results/maple/benchmark_result_0.md +++ b/benchmark/results/maple/benchmark_result_0.md @@ -1,21 +1,21 @@ ## Benchmark results -2024-01-26T23:39:14.885 +2024-01-27T00:30:59.875 Benchmarked backend: maple Benchmark suite: dummy benchmark set - Workers: 16 -- Timeout: 1800 s +- Timeout: 60 s - Aggregated over: 1 runs **All timings in seconds.** |Model|Total, s| |:----|---| -|dummy 1|0.24| -|dummy 2|0.23| +|dummy 1|0.23| +|dummy 2|0.21| *Benchmarking environment:* diff --git a/benchmark/results/msolve/benchmark_result_0.md b/benchmark/results/msolve/benchmark_result_0.md index 0e203dbc..aed138ce 100644 --- a/benchmark/results/msolve/benchmark_result_0.md +++ b/benchmark/results/msolve/benchmark_result_0.md @@ -1,13 +1,13 @@ ## Benchmark results -2024-01-26T23:39:28.793 +2024-01-27T00:31:13.800 Benchmarked backend: msolve Benchmark suite: dummy benchmark set - Workers: 16 -- Timeout: 1800 s +- Timeout: 60 s - Aggregated over: 1 runs **All timings in seconds.** diff --git a/experimental/lexcmp.jl b/experimental/lexcmp.jl index 7058b77b..850073df 100644 --- a/experimental/lexcmp.jl +++ b/experimental/lexcmp.jl @@ -41,10 +41,22 @@ end ######### +function scalar_cmp_lex(x, y) + i = 2 + @inbounds while i < length(x) && x[i] == y[i] + i += 1 + end + @inbounds x[i] < y[i] +end + begin n, step = 1, 5 while n < 500 @info "n = $n" + print("scalar_cmp_lex\t\t\t") + @btime scalar_cmp_lex(xx, yy) setup = begin + cc, xx, yy = _setup3(Int8, max(1, $n)) + end print("Groebner.monom_is_equal\t\t") @btime Groebner.monom_is_equal(xx, yy) setup = begin cc, xx, yy = _setup3(Int8, max(1, $n)) diff --git a/src/groebner/state.jl b/src/groebner/state.jl index 542a600b..15e24351 100644 --- a/src/groebner/state.jl +++ b/src/groebner/state.jl @@ -101,11 +101,11 @@ function clear_denominators!( @inbounds for i in 1:length(coeffs_qq) @invariant length(coeffs_zz[i]) == length(coeffs_qq[i]) den = common_denominator!(den, coeffs_qq[i]) - sz = Base.GMP.MPZ.sizeinbase(den, 2) + # sz = Base.GMP.MPZ.sizeinbase(den, 2) for j in 1:length(coeffs_qq[i]) num = numerator(coeffs_qq[i][j]) Base.GMP.MPZ.tdiv_q!(buf, den, denominator(coeffs_qq[i][j])) - Base.GMP.MPZ.realloc2!(coeffs_zz[i][j], sz) + # Base.GMP.MPZ.realloc2!(coeffs_zz[i][j], sz) Base.GMP.MPZ.mul!(coeffs_zz[i][j], num, buf) end end diff --git a/src/input-output/AbstractAlgebra.jl b/src/input-output/AbstractAlgebra.jl index b3f2be9e..bcca50d0 100644 --- a/src/input-output/AbstractAlgebra.jl +++ b/src/input-output/AbstractAlgebra.jl @@ -452,7 +452,12 @@ end # specialization for multivariate polynomials function extract_coeffs_qq(representation, ring::PolyRing, poly) iszero(poly) && (return zero_coeffs(representation.coefftype, ring)) - map(Rational{BigInt}, AbstractAlgebra.coefficients(poly)) + n = length(poly) + arr = Vector{Rational{BigInt}}(undef, n) + @inbounds for i in 1:n + arr[i] = Rational{BigInt}(AbstractAlgebra.coeff(poly, i)) + end + arr end function get_var_to_index( @@ -523,10 +528,10 @@ function extract_monoms( npolys = length(orig_polys) var_to_index = get_var_to_index(AbstractAlgebra.parent(orig_polys[1])) exps = Vector{Vector{representation.monomtype}}(undef, npolys) - for i in 1:npolys + @inbounds for i in 1:npolys poly = orig_polys[i] exps[i] = Vector{representation.monomtype}(undef, length(poly)) - @inbounds for j in 1:length(poly) + for j in 1:length(poly) exps[i][j] = monom_construct_from_vector( representation.monomtype, poly.exps[(end - 1):-1:1, j] @@ -545,10 +550,10 @@ function extract_monoms( npolys = length(orig_polys) var_to_index = get_var_to_index(AbstractAlgebra.parent(orig_polys[1])) exps = Vector{Vector{representation.monomtype}}(undef, npolys) - for i in 1:npolys + @inbounds for i in 1:npolys poly = orig_polys[i] exps[i] = Vector{representation.monomtype}(undef, length(poly)) - @inbounds for j in 1:length(poly) + for j in 1:length(poly) exps[i][j] = monom_construct_from_vector( representation.monomtype, poly.exps[end:-1:1, j] @@ -567,10 +572,10 @@ function extract_monoms( npolys = length(orig_polys) var_to_index = get_var_to_index(AbstractAlgebra.parent(orig_polys[1])) exps = Vector{Vector{representation.monomtype}}(undef, npolys) - for i in 1:npolys + @inbounds for i in 1:npolys poly = orig_polys[i] exps[i] = Vector{representation.monomtype}(undef, length(poly)) - @inbounds for j in 1:length(poly) + for j in 1:length(poly) exps[i][j] = monom_construct_from_vector( representation.monomtype, poly.exps[1:(end - 1), j]