Closed LingyuMa closed 8 years ago
The error looks like the following:
Scanning dependencies of target openMVG_multiview In file included from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/latch/LatchClassifierOpenMVG.hpp:9:0, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/image_describer_latch.hpp:15, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/features.hpp:20, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/indMatchDecoratorXY.hpp:13, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/regions_matcher.hpp:12, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/regions_matcher.cpp:8: /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/latch/LatchClassifier.hpp:7:18: fatal error: cuda.h: No such file or directory
^
compilation terminated. loading pickled environment... done
@LingyuMa , did you try this:
export CFLAGS=$CFLAGS -I/usr/local/cuda/include ; export CPPFLAGS=$CPPFLAGS -I/usr/local/cuda/include
before cmake-ing and compiling? I know this is a bug, and I'm planning on pushing a change soon.
@mdaiter I tried, but it still gave me the same error, Any other suggestions?
@mdaiter I tried, but it still gave me the same error, Any other suggestions?
Also, it shows me other erros like:
/usr/local/include/opencv2/core/cuda.hpp(158): error: identifier "Stream" is undefined
/usr/local/include/opencv2/core/cuda.hpp(164): error: identifier "Stream" is undefined
@LingyuMa what version of OpenCV are you running, and did you compile in the extra modules package along with the CUDA bindings?
I am using git from this repository: git clone https://github.com/Itseez/opencv.git
I think I have compiled it with CUDA
@mdaiter What version of OpenCV are you using?
@LingyuMa I'm using OpenCV 3.1.0 with EXTRA_MODULES (https://github.com/opencv/opencv_contrib) included
@mdaiter so maybe I should download v3.1 from http://opencv.org/downloads.html and compile it with EXTRA_MODULES?
@LingyuMa yep!
@mdaiter Hi, the error related to openCV has resolved. Now the error remains to be:
In file included from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/latch/LatchClassifierOpenMVG.hpp:9:0, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/image_describer_latch.hpp:15, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/features.hpp:20, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/indMatchDecoratorXY.hpp:13, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/regions_matcher.hpp:12, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/regions_matcher.cpp:8: /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/latch/LatchClassifier.hpp:7:18: fatal error: cuda.h: No such file or directory
^
compilation terminated.
@mdaiter I have tried export CFLAGS=$CFLAGS -I/usr/local/cuda/include ; export CPPFLAGS=$CPPFLAGS -I/usr/local/cuda/include but it does not work
@LingyuMa give me about 2 hours. I'm merging my deep descriptor code with my LATCH code within this repo. Afterwards, I'll modify the CMake files to directly include the header files it finds from CUDA
@LingyuMa I'm also about to update the dependencies to require Torch and CUDA torch, if that's alright with you
@mdaiter Does it mean that I need to reinstall cuda in order to have Torch? If so, can you do two seperate commit so that I can get the version without the dependency to Torch and CUDA torch? Thanks!
@LingyuMa you don't need to reinstall CUDA to run CUDA Torch.
@mdaiter Another thing I want you to know is when I add a line to CMakeList under src/ folder (include_directories("/usr/local/cuda/include")), it is able to find "cuda.h", but gave me the following error:
Scanning dependencies of target openMVG_multiview
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::cuda::ORB::create(int, float, int, int, int, int, int, int, int, bool)' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::cuda::Stream::Stream()'
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::cuda::Stream::waitForCompletion()' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::cuda::GpuMat::defaultAllocator()'
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::xfeatures2d::LATCH::create(int, bool, int)' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::cuda::StreamAccessor::getStream(cv::cuda::Stream const&)'
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::cuda::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int, cv::cuda::Stream&)' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::cuda::GpuMat::release()'
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::String::deallocate()' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::error(int, cv::String const&, char const, char const, int)'
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::cuda::GpuMat::download(cv::_OutputArray const&) const' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::String::allocate(unsigned long)'
../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to cv::ORB::create(int, float, int, int, int, int, int, int, int)' ../../Linux-x86_64-RELEASE/liblatch_cuda.so: undefined reference to
cv::cuda::GpuMat::upload(cv::_InputArray const&, cv::cuda::Stream&)'
../../Linux-x86_64-RELEASE/liblatchcuda.so: undefined reference to `cv::cuda::Stream::enqueueHostCallback(void ()(int, void), void)'
collect2: error: ld returned 1 exit status
make[2]: _\ [Linux-x86_64-RELEASE/openMVG_sample_features_affine] Error 1
make[1]: * [openMVG_Samples/features_affine_demo/CMakeFiles/openMVG_sample_features_affine.dir/all] Error 2
make[1]: * Waiting for unfinished jobs....
loading pickled environment... done
@LingyuMa are you sure you're pulling in OpenCV 3.1.0? If so, that linker error shouldn't be happening. When you run pkg-config --libs --cflags opencv
, what comes out?
I am sure I am using 3.1. But before that, I uninstalled the old version. Maybe I did not remove the whole thing? What is the decent way to uninstall openCV?
Sent from my iPhone
On Jul 21, 2016, at 11:32 AM, Matthew Daiter notifications@github.com wrote:
@LingyuMa are you sure you're pulling in OpenCV 3.1.0? If so, that linker error shouldn't be happening. When you run pkg-config --libs --cflags opencv, what comes out?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@LingyuMa that should be enough. Hm, strange. It seems like there's a linker error. Let me solve this now. Also, I just updated the branch.
@LingyuMa updated the branch again. All CUDA linkers and include dirs should automatically be added. Let me deal with those linker errors. I am explicitly calling a link to OpenCV and requiring OpenCV 3 in CMake, but there might be a linker issue in later stages.
@mdaiter have you solved the linker error related to opencv3.1?
@LingyuMa it should be solved through this line: https://github.com/mdaiter/cudaLATCH/blob/695ffdcb68dd8214aafdc368593fc67749a3645c/CMakeLists.txt#L30 , along with the automatic include of cuda.h
@LingyuMa I'm curious to see if an OpenCV_GPU_Libs needs to be manually specified or not. It seems as though you're able to link with OpenCV's CPU-bound libraries, but not GPU-bound libraries.
@mdaiter I've got this error very early this time:
nvcc fatal : Value 'sm_60' is not defined for option 'gpu-architecture' CMake Error at cunn_generated_ReLU.cu.o.cmake:204 (message): Error generating /home/hduser/openMVG_Latch_Build/openMVG/features/deep/cunnproduction/CMakeFiles/cunn.dir//./cunn_generated_ReLU.cu.o
[ 3%] make[2]: * [openMVG/features/deep/cunnproduction/CMakeFiles/cunn.dir/./cunn_generated_ReLU.cu.o] Error 1 make[1]: * [openMVG/features/deep/cunnproduction/CMakeFiles/cunn.dir/all] Error 2
@LingyuMa that's because you don't have sm_60 (pascal architecture). If you go into this file: https://github.com/mdaiter/cudaLATCH/blob/695ffdcb68dd8214aafdc368593fc67749a3645c/CMakeLists.txt#L18 and remove the '-gencode arch=compute_60,code=sm_60' from it, as well as from this one: https://github.com/mdaiter/openMVG/blob/custom/src/openMVG/features/deep/cunnproduction/CMakeLists.txt#L10 and remove the string '-arch=sm_60' , then you should be fine.
@mdaiter I have got this weird error:
/home/hduser/openMVG_Latch/openMVG/src/openMVG/matching_image_collection/gpu/bitMatcher.cu(121): error: identifier "__shfl_xor" is undefined
[ 22%] Building CXX object dependencies/osi_clp/CoinUtils/src/CMakeFiles/lib_CoinUtils.dir/CoinOslFactorization2.cpp.o 1 error detected in the compilation of "/tmp/tmpxft_00002866_00000000-7_bitMatcher.cpp1.ii". CMake Error at bitMatcher_cuda_generated_bitMatcher.cu.o.cmake:264 (message): Error generating file /home/hduser/openMVG_Latch_Build/openMVG/matching_image_collection/gpu/CMakeFiles/bitMatcher_cuda.dir//./bitMatcher_cuda_generated_bitMatcher.cu.o
make[2]: * [openMVG/matching_image_collection/gpu/CMakeFiles/bitMatcher_cuda.dir/./bitMatcher_cuda_generated_bitMatcher.cu.o] Error 1 make[1]: * [openMVG/matching_image_collection/gpu/CMakeFiles/bitMatcher_cuda.dir/all] Error 2 make[1]: *\ Waiting for unfinished jobs....
@LingyuMa Ah! So you still need to define an sm. If you go to those same positions, but replace that sm_60 with sm_30 and code_60 with code_30, it should compile.
@mdaiter Hi, I get the following error agiain: Built target latch_cuda In file included from /home/hduser/torch/install/include/THC/THC.h:4:0, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/deep/src/../cunnproduction/cunn.h:4, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/deep/src/loader.h:10, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/deep/src/DeepClassifierTorch.hpp:5, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/image_describer_deep.hpp:16, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/features/features.hpp:20, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/indMatchDecoratorXY.hpp:13, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/regions_matcher.hpp:12, from /home/hduser/openMVG_Latch/openMVG/src/openMVG/matching/regions_matcher.cpp:8: /home/hduser/torch/install/include/THC/THCGeneral.h:8:18: fatal error: cuda.h: No such file or directory
^
compilation terminated.
@mdaiter I have added include_directories("/usr/local/cuda/include") in CMakeLists and it works (At least for compiling), I'll test if there is any runtime error. Thank you for your help!
@mdaiter I have added include_directories("/usr/local/cuda/include") in CMakeLists and it works (At least for compiling), I'll test if there is any runtime error. Thank you for your help!
I have found a small problem when running the code:
@LingyuMa yeah, those are debug statements. Meant to take those out sooner :P
@mdaiter Another question? which descriptor should I use for feature detection: LATCH_UNSIGNED or LATCH_BINARY? Also which matching algorithm should I use corresponding to them?
@mdaiter Sadly, I got the runtime error this time:
Aborted (core dumped)
@LingyuMa LATCH_UNSIGNED will create a Scalar feature. You can use GPU_LATCH matcher. LATCH_BINARY will create a (you guessed it!) binary feature. You can use the BruteForceHamming matcher. I usually set the ratio parameter at 0.99
@LingyuMa weird that you get that error. It happens occasionally. Still trying to debug exactly what triggers that, but I fear that's an OpenCV error, because of the debug statements I've wrapped around CUDA ORB within the LATCH detection class (just tested it today on the latest build of OpenCV 3.1.0). For now, I'd stick with the LATCH_BINARY detection format and the BRUTE_FORCE_HAMMING matcher with a ratio parameter of 0.99. Tends to work most of the time. I don't know what's up with the CUDA ORB stuff from OpenCV. I do know, however, that I can print out right before the invocation of the CUDA ORB call and cannot print out right after that call. Therefore, I fear it's something with the CUDA ORB implementation in OpenCV.
@mdaiter Do you have any suggestions to fix this error? Have you met such runtime errors? I am afraid this is related to my graphic card (I am using Quadro K2200) and it is Maxwell.
I have changed sm_30 to sm_50 and it works! It is just the wrong architecture selection.
@mdaiter Compared with LATCH_UNSIGNED + GPU_LATCH and LATCH_BINARY+ BruteForceHamming Which do you recommend? It seems in the binary descriptor, the matching process does not speed up.
@LingyuMa I'd recommend LATCH_UNSIGNED + GPU_LATCH. GPU_LATCH is a GPU-based Hamming matcher. The reason you can't use GPU_LATCH with LATCH_BINARY is due to the allocations/positioning of each descriptor. Each descriptor is stored within 2048 bits, but the descriptor itself is only 512 bits. Therefore, the GPU_LATCH matcher is tailored to work with this mis-aligned block of memory. The LATCH_BINARY format aligns this memory, and it breaks the GPU_LATCH matcher.
If you're going for speed, GPU_LATCH would be the way to go.
@LingyuMa can I close this? Do you have any more problems?
For now, I don't have any further questions. Thank you for your help.
On Jul 22, 2016, at 6:38 AM, Matthew Daiter notifications@github.com wrote:
@LingyuMa can I close this? Do you have any more problems?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@LingyuMa glad to help!
I am using Linux 64 and cuda 7.5, in the cmake stage, it shows CUDA FOUND, however, when I did the compiling. it shows me the following error:
fatal error: cuda.h: No such file or directory
include