jiexiong2016 / GCNv2_SLAM

Real-time SLAM system with deep features
Other
769 stars 194 forks source link

building error possibly due to Cuda version #62

Closed Gpetrak closed 2 years ago

Gpetrak commented 2 years ago

I'm trying to build GCNv2_SLAM with Cuda 10.2 and Cudnn 8.2.2 with Pytorch 1.9.0. Unfortunately, although Pytorch is built with success, when I'm trying to build GCNv2_SLAM, it raises too many errors. I think that it is a mismatch in Cuda versions / Pytorch / GCNv2_SLAM because when I compile GCNv2_SLAM with Pytorch 1.0.1 without CUDA, it is built successfully.

Some text from the errors is the following: /home/gpetr/gcn2/pytorch/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:89:59: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional’ bias = this->register_parameter("bias", torch::empty({options.out_channels()}));


/home/gpetr/gcn2/pytorch/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 1; Derived = torch::nn::Conv1dImpl]’:
/home/gpetr/gcn2/Pangolin/include/pangolin/handler/handler.h:65:24:   required from here
/home/gpetr/gcn2/pytorch/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:77:21: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
         torch::empty(weight_sizes));
         ~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/gpetr/gcn2/pytorch/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:85:21: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
         torch::empty(weight_sizes));
         ~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/gpetr/gcn2/pytorch/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:89:59: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
       bias = this->register_parameter("bias", torch::empty({options.out_channels()}));
                                               ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/ORB_SLAM2.dir/build.make:107: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/ORB_SLAM2.dir/build.make:94: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:120: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:81: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/System.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/System.cc.o] Error 1
CMakeFiles/Makefile2:123: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2

Any ideas ? 
Gpetrak commented 2 years ago

Finally I managed to solve the issue. It was an error related with the C++ version. At first, I added the following lines in the beginning of the CMakeLists.txt file: set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON)

and then from the same file, I replaced the line: set_property(TARGET rgbd_gcn PROPERTY CXX_STANDARD 11) to set_property(TARGET rgbd_gcn PROPERTY CXX_STANDARD 14)

The answer of @JohnsonLC from https://github.com/jiexiong2016/GCNv2_SLAM/issues/47 was quite helpful.

My setup: Pytorch: 1.9.0 Cuda 10.2 Cudnn 8.2.2