Skip to content

Commit

Permalink
fixing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
pogudingleb committed Dec 15, 2024
1 parent 34a3406 commit b07e3b6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Symbolics = "6.2"
Test = "1.10, 1.11"
TestSetExtensions = "2"
TimerOutputs = "0.5"
julia = "1.10.0-1.10.2, 1.10.4, 1.11.2"
julia = "1.10.4, 1.11.2"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Expand Down
8 changes: 4 additions & 4 deletions benchmarking/IdentifiableFunctions/experiments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1478,10 +1478,10 @@ mqs_spec = StructuralIdentifiability.ParamPunPam.specialize_mod_p(mqs, point);

Groebner.logging_enabled() = false

@time graph, gb = Groebner.groebner_learn(mqs_spec, loglevel = 0, sweep = true);
@time Groebner.groebner_apply!(graph, mqs_spec, loglevel = 0, sweep = true);
@time graph, gb = Groebner.groebner_learn(mqs_spec, sweep = true);
@time Groebner.groebner_apply!(graph, mqs_spec, sweep = true);

@benchmark Groebner.groebner_apply!($graph, $mqs_spec, loglevel = 0, sweep = true)
@benchmark Groebner.groebner_apply!($graph, $mqs_spec, sweep = true)

# Results for covid
#=
Expand Down Expand Up @@ -1523,4 +1523,4 @@ BenchmarkTools.Trial: 180 samples with 1 evaluation.
Memory estimate: 775.77 KiB, allocs estimate: 3662.
=#

@my_profview_allocs Groebner.groebner_apply!(graph, mqs_spec, loglevel = 0, sweep = true);
@my_profview_allocs Groebner.groebner_apply!(graph, mqs_spec, sweep = true);
2 changes: 1 addition & 1 deletion benchmarking/IdentifiableFunctions/homogenization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ideal_spec = StructuralIdentifiability.specialize_mod_p(mqs, point)
@time gb = groebner(ideal_spec, ordering = Groebner.DegRevLex());

# There is an existent possibility that this would not finish in two and a half lifetimes
# @time gb = groebner(ideal_spec, ordering = Groebner.Lex(), loglevel = -3);
# @time gb = groebner(ideal_spec, ordering = Groebner.Lex());

homogeneous_ideal_spec = StructuralIdentifiability.homogenize(ideal_spec);
# 100 ms
Expand Down
2 changes: 1 addition & 1 deletion src/ODE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ end
Input: ode is an ODE over QQ, p is a prime number
Output: the reduction mod p, throws an exception if p divides one of the denominators
"""
function reduce_ode_mod_p(ode::ODE{<:MPolyRingElem{Nemo.QQFieldElem}}, p::Int)
function reduce_ode_mod_p(ode::ODE, p::Int)
new_ring, new_vars =
Nemo.polynomial_ring(Nemo.Native.GF(p), map(var_to_str, gens(ode.poly_ring)))
new_type = typeof(new_vars[1])
Expand Down
8 changes: 4 additions & 4 deletions src/RationalFunctionFields/RationalFunctionField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ Output:
mqs_ratfuncs = specialize(IdealMQS(ratfuncs), point; saturated = false)
@assert parent(first(mqs_specialized)) == parent(first(mqs_ratfuncs))
@debug "Starting the groebner basis computation"
gb = groebner(mqs_specialized, loglevel = _groebner_loglevel[])
result = map(iszero, normalform(gb, mqs_ratfuncs, loglevel = _groebner_loglevel[]))
gb = groebner(mqs_specialized)
result = map(iszero, normalform(gb, mqs_ratfuncs))
return result
end

Expand Down Expand Up @@ -256,8 +256,8 @@ end
polys_specialized =
ParamPunPam.specialize_mod_p(mqs_tobereduced, point, saturated = false)
@assert parent(first(gens_specialized)) == parent(first(polys_specialized))
gb = groebner(gens_specialized, loglevel = _groebner_loglevel[])
nf = normalform(gb, polys_specialized, loglevel = _groebner_loglevel[])
gb = groebner(gens_specialized)
nf = normalform(gb, polys_specialized)
result = map(iszero, nf)
return result
end
Expand Down
2 changes: 1 addition & 1 deletion src/RationalFunctionFields/normalforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function local_normal_forms(
@assert parent(first(point)) == finite_field
point_ff_ext = append_at_index(point, mqs.sat_var_index, one(finite_field))
gens_ff_spec = specialize_mod_p(mqs, point)
gb_ff_spec = Groebner.groebner(gens_ff_spec, loglevel = _groebner_loglevel[])
gb_ff_spec = Groebner.groebner(gens_ff_spec)
ring_ff = parent(gb_ff_spec[1])
xs_ff = gens(ring_ff)
normal_forms_ff = Vector{elem_type(ring_ff)}(undef, 0)
Expand Down
9 changes: 0 additions & 9 deletions src/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ else
Ref{Logging.ConsoleLogger}(Logging.ConsoleLogger(stderr, Logging.Info))
end

const _groebner_loglevel = Ref{Int}(0)

function restart_logging(; loglevel = Logging.Info)
@assert loglevel isa Base.CoreLogging.LogLevel
_si_logger[] = @static if VERSION >= v"1.7.0"
Expand All @@ -41,13 +39,6 @@ function restart_logging(; loglevel = Logging.Info)
for r in _runtime_rubrics
_runtime_logger[r] = 0
end
if loglevel < Logging.Info
_groebner_loglevel[] = 0
elseif loglevel < Logging.Warn
_groebner_loglevel[] = 0
else
_groebner_loglevel[] = 10
end
return nothing
end

Expand Down
6 changes: 3 additions & 3 deletions src/primality_check.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ------------------------------------------------------------------------------

function check_primality_zerodim(J::Array{QQMPolyRingElem, 1})
J = Groebner.groebner(J, loglevel = _groebner_loglevel[])
basis = Groebner.kbase(J, loglevel = _groebner_loglevel[])
J = Groebner.groebner(J)
basis = Groebner.kbase(J)
dim = length(basis)
S = Nemo.matrix_space(Nemo.QQ, dim, dim)
matrices = []
Expand All @@ -11,7 +11,7 @@ function check_primality_zerodim(J::Array{QQMPolyRingElem, 1})
for v in gens(parent(first(J)))
M = zero(S)
for (i, vec) in enumerate(basis)
image = Groebner.normalform(J, v * vec, loglevel = _groebner_loglevel[])
image = Groebner.normalform(J, v * vec)
for (j, base_vec) in enumerate(basis)
M[i, j] = Nemo.QQ(coeff(image, base_vec))
end
Expand Down

0 comments on commit b07e3b6

Please sign in to comment.