ederc / GroebnerBasis.jl

Julia wrapper for gb
Other
7 stars 6 forks source link

Multi-Modular Groebner Basis Computation #37

Closed iliailmer closed 2 years ago

iliailmer commented 3 years ago

Hi,

I was trying to check msolve functionality of this package and ran into a couple of issues.

  1. I was trying to run a test example for msolve but ran into the following error: ERROR: failed process: Process(`/Users/iliailmer/.julia/packages/GroebnerBasis/JI3W4/src/../deps/msolve-binary -v0 -l2 -P0 -m0 -s17 -t 1 -p 64 -f /tmp/in.ms -o /tmp/out.ms`, ProcessExited(126)) [126] This is running on macOS 11.2 with Apple M1.

  2. Has multi-modular computation support for Groebner Basis/F4 been added to the package?

Thanks.

ederc commented 3 years ago

Right now msolve only supports x86 on Linux. We are working on support for other systems.

Multi-modular solving is part of msolve.

iliailmer commented 3 years ago

Thank you for your response! We tried running the following on CentOS 7 machine with Julia 1.6 (edit: same for Julia 1.5.4):

using GroebnerBasis, Singular
n=4
R, X = Singular.PolynomialRing(
                   Singular.QQ,
                   ["x$i" for i in 1:n],
                   ordering = :degrevlex
               )
id = let R=R, (x1, x2, x3, x4) = X
                   gens = [
                       x1+2*x2+2*x3+2*x4-1,
                       x1^2+2*x2^2+2*x3^2+2*x4^2-x1,
                       2*x1*x2+2*x2*x3+2*x3*x4-x2,
                       x2^2+2*x1*x3+2*x2*x4-x3
                   ]
                   Singular.Ideal(R, gens)
               end
sols = msolve(id, la_option=2)

and got

julia> sols = msolve(id, la_option=2)
ERROR: failed process: Process(`/.../.julia/packages/GroebnerBasis/JI3W4/src/../deps/msolve-binary -v0 -l2 -P0 -m0 -s17 -t 1 -p 64 -f /tmp/in.ms -o /tmp/out.ms`, ProcessSignaled(4)) [0]

Stacktrace:
 [1] pipeline_error
   @ ./process.jl:525 [inlined]
 [2] run(::Cmd; wait::Bool)
   @ Base ./process.jl:440
 [3] run
   @ ./process.jl:438 [inlined]
 [4] msolve(I::sideal{spoly{n_Q}}; initial_hts::Int64, nr_thrds::Int64, max_nr_pairs::Int64, la_option::Int64, info_level::Int64, input_file::String, output_file::String, precision::Int64, get_param::Bool)
   @ GroebnerBasis ~/.julia/packages/GroebnerBasis/JI3W4/src/Msolve.jl:324
 [5] top-level scope
   @ REPL[12]:1

ProcessSignaled(4) I think means illegal instruction. Is this the msolve_binary issue?

edit: Illegal instruction (core dumped) when running the msolve-binary command with flags and inputs from error message.

ederc commented 3 years ago

Let me be more specific: At the moment the underlying msolve binary only works on x86-64 Linux with AVX2 required. We are working on an updated version to work also in other configurations and we try also to provide the binaries via BinaryBuilder in julia. I suspect that your machine with CentOS 7 does not support AVX2.

iliailmer commented 3 years ago

Thank you, @ederc. The CPU installed on that machine has an avx2 flag in the lscpu output, so I assume this means it does support AVX2.

ederc commented 3 years ago

Well, then I am not sure what is the problem, I do not have a CentOS system available for testing. If you wish you can try to call the msolve binary directly without julia and see the crash report:

Maybe you get more information from this besides "illegal instruction", but I assume one needs to do a deeper debugging for the issue. Other than that we hope to solve this kind of problems with a fixed autotools environment for msolve in the near future.

iliailmer commented 3 years ago

Thank you for your help. I think the CPUs we have do support avx2 but I will try to experiment further.

Multi-modular solving is part of msolve.

Is it possible to call multimodular Groebner Basis directly without msolve if I am just interested in the basis and not in solutions to a polynomial system?

ederc commented 3 years ago

You can get the basis via msolve, but only modulo some prime number. In general, you either want the solutions over QQ or you want to compute something further with the basis, but in general you want to do this in another modular approach.