Repository navigation
Description
Running the command line tools sequential_matcher, or vocab_tree_matcher, and I presume the other matchers too, fails with a seqmentation fault.
*** Aborted at 1462060976 (unix time) try "date -d @1462060976" if you are using GNU date ***
PC: @ 0x7fff9aee3c30 glGetString
*** SIGSEGV (@0x3b0) received by PID 61514 (TID 0x700000081000) stack trace: ***
@ 0x7fff9164c52a _sigtramp
@ 0x106656010 glewIsSupported
@ 0x1066289b1 glewInit
@ 0x1059b1e2d GlobalUtil::InitGLParam()
@ 0x1059ce339 SiftMatchGL::InitSiftMatch()
@ 0x1059d0022 SiftMatchGPU::_VerifyContextGL()
@ 0x10573202f colmap::FeatureMatcher::SetupWorkers()
@ 0x1057319c6 colmap::FeatureMatcher::run()
@ 0x1074e857a QThreadPrivate::start()
@ 0x7fff90e1c99d _pthread_body
@ 0x7fff90e1c91a _pthread_start
@ 0x7fff90e1a351 thread_start
Some notes about the build and system:
- This is on my mac osx 10.11
- Using the latest source.
- The GUI version runs fine without fault.
- CUDA is version 7.5.
- CUDA was successfully detected by cmake, and enabled.
I did some digging and got it working for me, but I wonder if I missed something, that lets me avoid all this.
The following is my digging, I hope it is useful:
This seems to be caused by line 388 in src/ext/SiftGPU/GlobalUtil.cpp
const char * vendor = (const char * )glGetString(GL_VENDOR);
It seems that a glContext is not initialised.
If I initialise a glContext using SiftGPU's own methods:
sift_gpu_->CreateContextGL();
sift_match_gpu_->CreateContextGL();
Just after line 153 of src/base/feature_matching.cc
The code then runs from the command line without fault. It does briefly produce a window, which may fail on servers but this was the only way I could get any data.
I should note that although cmake enabled CUDA, SiftGPU may be disabling it for macs, given that SiftGPU's cmake contains the following on line 52 of src/ext/SiftGPU/CMakeLists.txt.
if(CUDA_ENABLED AND NOT APPLE)
Activity
ahojnnes commentedon May 1, 2016
Hi Andrew,
Thanks for reporting!
Unfortunately, I upgraded to the latest Macbook Pro series some time ago which ships without an Nvidia card, so I cannot check CUDA support on OSX anymore. I will try to find a suitable machine over the next days to fix this and will follow up with you here.
Thanks again.
Cheers,
Johannes
ahojnnes commentedon May 21, 2016
I could not reproduce this issue here. Can you share your specific Hardware?
QuantumEntangledAndy commentedon May 21, 2016
Hmm that's interesting, an un-reproducable one.
Anyways here are my details not sure which part you would be interested in
I will recompile with the latest code and see if its been squashed since then by another commit.
Hope all goes well, let me know if you'd like anything else from me.
QuantumEntangledAndy commentedon May 21, 2016
Ok here the the retest results:
Summary
Details
I will layout all of my steps so this may be a long one
With CUDA enabled
set up LocalConfig.cmake to include
Build succeeds and cmake detects CUDA, cu files are built with
nvccNow to test:
images come from http://zhuoliang.me/gargoyle.zip which is from this page http://zhuoliang.me/meshrecon.html
The following segfault occurs when running sequential_matcher
With CUDA disabled
Same set up as above except now cloned to a fresh directory:
and the cmake command is
Testing:
Same images etc
Succeeds printing out
Debuging
To debug further I put the code (with CUDA enabled) into Xcode using
Opening in xcode and running with the debugger attached catches the segfault at:
01_Test/src/ext/SiftGPU/GlobalUtil.cpp: Line 384
which reads:
throwing a
EXC_BAD_ACCESSI believe this is occurring because there is no active GLContex at this point and the Mac CUDA version must be relying on it. Which is hinted at in the siftGPU manual, albeit for all GPU implementations not just mac, http://www.cs.unc.edu/~ccwu/siftgpu/manual.pdf on page 6.
When you tested this on a mac with CUDA, was CUDA successfully detected by cmake i.e. is CUDA in the PATH and DYLD_LIBRARY_PATH, like this:
Sorry I just find it surprising that you didn't observe this, and thought I should ask just in case.
A fix that works for me
Again if I explicitly initialise the GLContext then the program works fine, which I tested by making this alteration to call
SiftGPU::CreateContextGL.in FeatureMatching.cc line on 155If you'd like I could create a pull request with the changes I made that got the program working for me. I just don't have another build machine to test the changes on and see if it breaks other OS's.
Anyway hope all this helps, sorry if it's a bit too much info
Best Regards
Andy
ahojnnes commentedon May 23, 2016
Thanks for the detailed traceback!
Can you try to change L52 in
src/ext/SiftGPU/CMakeLists.txtfrom:to
and check if that solves the problem?
QuantumEntangledAndy commentedon May 25, 2016
I pulled your latest version, with the changed
After which the program successfully compiled and ran without any further changes.
I will let you know if I find anything else but you can probably close :).
ahojnnes commentedon May 25, 2016
Thanks Andrew for your efforts!
review fixes: docstrings, fail-loud emplace, dead-code notes
Retire glomap_ra GP+RA; route through colmap4-native (#5)