Skip to content

MOI wrapper doesn't implement full SemidefiniteOptInterface interface? #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ericphanson opened this issue Jul 22, 2019 · 4 comments
Closed

Comments

@ericphanson
Copy link
Contributor

Context: @JiazhengZhu and I are trying to translate (automatically) some problems from a Julia formulation to SDPA-format file in an effort to debug #17. It seems like some of the problem is a choice of parameters (and a SOC problem that snuck in), but I want to check that directly going to the binary (well, Convex -> MOI -> SDPA-formatted file -> binary) gives the same answers as Convex -> MBP -> SDPA.jl (or now Convex -> MOI -> SDPA.jl via https://github.com/ericphanson/Convex.jl/tree/MathOptInterface), to see if the "bad" parameters giving very wrong results is due to something in SDPA.jl or in the binary itself (I'm thinking it's not a bug in Convex.jl because the other solvers are fine). Being able to write SDPA-formatted files will help us later too, because we want to wrap SDPA-GMP, so we can use that for tests there too.

The problem: Trying to use the MOI.write method provided by SemiOptInterface gives MethodError: no method matching getnumberofconstraints(::SDPA.SDOptimizer) and suggests only getnumberofconstraints(::SemidefiniteOptInterface.MockSDOptimizer). Looking through the code, I don't think SDPA provides a method for getnumberofconstraints, which I guess is the problem.

So I think one way for us to resolve this is to write the methods to fill our the SemidefiniteOptInterface interface (from its src/interface.jl). But looking at JuliaOpt/SemidefiniteOptInterface.jl#30, it sounds like maybe the plan is to move SDPA to not depend on SemidefiniteOptInterface anyway, and to move the SDPA-format stuff to MathOptFormat.jl. In that case, what can we do to help? I think we'll want to follow whatever's done for SDPA anyway in our wrapping of SDPA-GMP, so if we can push that forward first, it'll probably be easier for us anyway.

@blegat
Copy link
Member

blegat commented Jul 22, 2019

@JiazhengZhu
Copy link

Thank you for the advice!

My fork for SDPABuilder at https://github.com/JiazhengZhu/SDPABuilder works with the line https://github.com/JuliaOpt/SDPABuilder/blob/7b8593aad85cca1bd3d13439fb46764bac943c13/bundled/sdpawrap/sdpawrap.cpp#L72 commented, however if it is uncommented, Julia gives the following error. In both cases the package builds only if we manually add 'using CxxWrap' at the beginning of the generated 'build.jl'. But is this error related to the reason you commented the line?

julia> using SDPA
[ Info: Recompiling stale cache file /home/jiazheng/.julia/compiled/v1.1/SDPA/SpZyo.ji for SDPA [b9a10b5b-afa4-512f-a053-bb3d8080febc]
julia: /workspace/destdir/include/jlcxx/type_conversion.hpp:319: static jl_datatype_t* jlcxx::static_type_mapping<SourceT, Enable>::julia_type() [with SourceT = char; Enable = void; jl_datatype_t = _jl_datatype_t]: Assertion `type_pointer() != nullptr' failed.

signal (6): Aborted
in expression starting at /home/jiazheng/.julia/dev/SDPA/src/SDPA.jl:16
__libc_signal_restore_set at /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/nptl-signals.h:80 [inlined]
raise at /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:48
abort at /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:79
__assert_fail_base at /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:92
__assert_fail at /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:101
_ZN5jlcxx19static_type_mappingIcvE10julia_typeEv at /home/jiazheng/.julia/dev/SDPA/deps/usr/lib/libsdpawrap.so (unknown line)
_ZN5jlcxx19static_type_mappingIPcvE10julia_typeEv at /home/jiazheng/.julia/dev/SDPA/deps/usr/lib/libsdpawrap.so (unknown line)
_ZN5jlcxx10julia_typeIPcEEP14_jl_datatype_tv at /home/jiazheng/.julia/dev/SDPA/deps/usr/lib/libsdpawrap.so (unknown line)
_ZN5jlcxx6detail14argtype_vectorIJR4SDPAPcS4_EEESt6vectorIP14_jl_datatype_tSaIS7_EEv at /home/jiazheng/.julia/dev/SDPA/deps/usr/lib/libsdpawrap.so (unknown line)
_ZNK5jlcxx15FunctionWrapperIvJR4SDPAPcS3_EE14argument_typesEv at /home/jiazheng/.julia/dev/SDPA/deps/usr/lib/libsdpawrap.so (unknown line)
register_julia_module at /home/jiazheng/.julia/packages/CxxWrap/KcmSi/deps/usr/lib/libcxxwrap_julia.so (unknown line)
register_julia_module at /home/jiazheng/.julia/packages/CxxWrap/KcmSi/src/CxxWrap.jl:151 [inlined]
readmodule at /home/jiazheng/.julia/packages/CxxWrap/KcmSi/src/CxxWrap.jl:378
wrapmodule at /home/jiazheng/.julia/packages/CxxWrap/KcmSi/src/CxxWrap.jl:384
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1842
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:323
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:411
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:362 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:773
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:885
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f1d069c1c7f)
unknown function (ip: 0x3)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:894
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:179
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:614
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:883
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:826
include at ./boot.jl:326 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:323
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:411
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:362 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:773
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:689
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:885
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f1d057922bf)
unknown function (ip: 0x2)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:894
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:793
eval at ./boot.jl:328 [inlined]
eval at ./client.jl:404
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
top-level scope at ./none:3
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1842
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:758
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:793
eval at ./boot.jl:328
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
exec_options at ./client.jl:243
_start at ./client.jl:436
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
jl_apply at /buildworker/worker/package_linux64/build/ui/../src/julia.h:1571 [inlined]
true_main at /buildworker/worker/package_linux64/build/ui/repl.c:96
main at /buildworker/worker/package_linux64/build/ui/repl.c:217
__libc_start_main at /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
_start at /home/jiazheng/Downloads/julia-1.1.1/bin/julia (unknown line)
Allocations: 3603594 (Pool: 3602851; Big: 743); GC: 6
ERROR: Failed to precompile SDPA [b9a10b5b-afa4-512f-a053-bb3d8080febc] to /home/jiazheng/.julia/compiled/v1.1/SDPA/SpZyo.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853

@blegat
Copy link
Member

blegat commented Jul 25, 2019

@ericphanson
Copy link
Contributor Author

I think this can be closed since SemidefiniteOptInterface.jl is deprecated.

P.S. If someone ends up at this issue for some reason, @JiazhengZhu wrote the code we needed to read and write SDPA formatted files here: https://github.com/ericphanson/SDPAFamily.jl/blob/master/src/file_io.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants