niessner / Opt

Opt DSL
Other
256 stars 68 forks source link

undefined reference error for graph examples #105

Closed multigrid101 closed 6 years ago

multigrid101 commented 6 years ago

When trying to compile the graph-examples, I get an 'undefined reference' error for some functions in the OpenMesh library.

I can get rid of this error by simply replacing everything OpenMesh-related in ..../examples/external/OpenMesh/ by a version of the library that I compiled on my own computer.

So there must either be an incompatibility of the pre-compiled OpenMesh library with my system or Opt depends on features that don't exist in the pre-compiled libs. (The pre-compiled version is older than the newest available version)

Anyway, it seems to me that this issue might be worth putting in the 'common problems' section since the fix is simple (but took me forever to figure out).

EDIT: I am running Opt under linux EDIT: In my original post, I forgot to mention that the "include" directory for OpenMesh also needs to be replaced. (I initially forgot to do this and only replaced the "lib" directory)

Mx7f commented 6 years ago

Added to the README as suggested. Thanks!

dgrzech commented 6 years ago

i'm running into what i think is a similar issue so i thought i'd comment on this thread instead of opening a new one.

i have an opt solver in my project which makes use of graphs. when i comment out the graph in the energy specification in the terra file, the solver runs but does nothing.

GPU memory usage: used = 245.937500, free = 7868.062500 MB, total = 8114.000000 MB
9609.9443359375
//////////// ITERATION0  (Opt(LM)) ///////////////
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=5000.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=1250.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=156.250000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=9.765625 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.305176 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.004768 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000037 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 
REVERT
 cost=0.000000 
 model_cost=0.000000 
 model_cost_change=0.000000 
 trust_region_radius=0.000000 

Trust_region_radius is less than the min, exiting
final cost=0.000000
--------------------------------------------------------
        Kernel        |   Count  |   Total   | Average 
----------------------+----------+-----------+----------
----------------------+----------+-----------+----------
 overall              |      1   |   78.122ms| 78.1224ms
--------------------------------------------------------
TIMING 78.122429 
Per-iter times ms (nonlinear,linear):  0.0000    0.0000
===warp field optimisation===
**Final Costs**
Opt GN,Opt LM,CERES
,0.00000000000000000000e+00,

when the part that relates to the graph isn't commented out, i get a segfault:

GPU memory usage: used = 245.937500, free = 7868.062500 MB, total = 8114.000000 MB
9645.845703125
//////////// ITERATION0  (Opt(LM)) ///////////////
0   terra (JIT)                         0x00007fa7364b238a $init + 266 
./build/bin/dynfu_test() [0x88c588]
./build/bin/dynfu_test(_ZN9OptSolver5solveERK15NamedParametersS2_bRSt6vectorI15SolverIterationSaIS4_EE+0x202) [0x894026]
./build/bin/dynfu_test(_ZN18CombinedSolverBase11singleSolveENS_10SolverInfoE+0x33a) [0x817a90]
./build/bin/dynfu_test(_ZN18CombinedSolverBase8solveAllEv+0x1a6) [0x8175e0]
./build/bin/dynfu_test(_ZN35SolverTest_SingleVertexTestOpt_Test8TestBodyEv+0xfc9) [0x81130f]
./build/bin/dynfu_test(_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc+0x65) [0x87779f]
./build/bin/dynfu_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc+0x5a) [0x870f99]
./build/bin/dynfu_test(_ZN7testing4Test3RunEv+0xd0) [0x854516]
./build/bin/dynfu_test(_ZN7testing8TestInfo3RunEv+0x108) [0x854efe]
./build/bin/dynfu_test(_ZN7testing8TestCase3RunEv+0x101) [0x8555f1]
./build/bin/dynfu_test(_ZN7testing8internal12UnitTestImpl11RunAllTestsEv+0x2ee) [0x85c86a]
./build/bin/dynfu_test(_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x65) [0x878c47]
./build/bin/dynfu_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x5a) [0x871c61]
./build/bin/dynfu_test(_ZN7testing8UnitTest3RunEv+0xb6) [0x85b22c]
./build/bin/dynfu_test(_Z13RUN_ALL_TESTSv+0x38) [0x7ef462]
./build/bin/dynfu_test(main+0x4b) [0x7ef331]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fa74c7d3830]
[0xa87e258d4c544155]
[1]    1673835 segmentation fault  ./build/bin/dynfu_test

at first i thought that the problem was with copying between ram and gpu memory, but when debugging with gdb i see the following error message:

Thread 1 "dynfu_test" received signal SIGSEGV, Segmentation fault.
0x00007fffdc1b838a in $init () at src/terralib.lua:2073
2073    src/terralib.lua: No such file or directory.

any ideas on how to solve this?

Mx7f commented 6 years ago

In general please open new issues (or at least reopen the issue you are commenting on) so maintainers can quickly see all unresolved issues. It will help your question not be lost to the void!

This is a very different error, as it has to do with Opt, and not OpenMesh. I believe the last message you have posted is not saying there is a segfault because there is no such file or directory, but rather it cannot find such a file or directory to provide more context for the segfault.

Do the normal examples run for you? What is your energy function, and how are you setting up the parameters? Can you send the full output with Opt's verbosity set to 3?

dgrzech commented 6 years ago

@Mx7f my bad for not opening a new issue, sorry and thank you for getting back to me!

the normal examples run for me without problem and when trying to debug the segfault, thinking that the problem might have to do with linking, i made a simple test in Opt, as opposed to calling Opt methods in my project. in the end i ran into the same problem, so after your response i'm certain that the issue has to do with how i'm initialising the graph. i'll get back to you once i've tried to solve this to tell you what the problem was or to ask for more help. thanks again!

dgrzech commented 6 years ago

@Mx7f the segfault was caused by setting the solver parameters in combinedSolveInit in the wrong order.. thank you so much for your help! can be closed

Mx7f commented 6 years ago

I ran into a similar problem last week... Opt should have an optional parameter validation step, I'll open an issue.