ScaViSLAM icon indicating copy to clipboard operation
ScaViSLAM copied to clipboard

CMake bugs and CUDA issues in Ubuntu 12.04

Open kevinmpeterson opened this issue 11 years ago • 4 comments

I ran into a couple of issues when building under Ubuntu 12.04 LTS. I'm running an essentially stock setup. I'm using CUDA 5.0. I followed the install directions exactly (copy-paste into terminal).

Two problems:

  1. Build failed with complaints about errors finding cu_di_* (e.g., cu_di_sfree, cu_di_add, etc). Also complained about inability to link gluSphere and gluDisk.

Resolution: I added GLU and cxsparse to line 67 in ScaViSLAM/CMakeLists.txt. The line now reads:

SET (LIB_NAMES GL GLU pangolin glut g2o_stuff g2o_core g2o_solver_csparse csparse cxsparse
  1. CUDA 5 does not include cutil_inline.h. Since this is missing, stereo_slam.cpp is broken.

I commented out the include for cutil_inline.h in stereo_slam.cpp and added an include for cuda_runtime_api.h for cudaGetDeviceProperties.

CUDA_SAFE_CALL is a macro and needs to be replaced. If I had lots of time, I would fix this a nice way (e.g., write a nice macro and put it in a .h), but instead I just replaced the call to around CUDA_SAFE_CALL (line 664ish in stereo_slam.cpp) with the following code:

#ifdef SCAVISLAM_CUDA_SUPPORT
  cudaDeviceProp prop;

  {
      cudaError err = cudaGetDeviceProperties(&prop, 0);
      if(err != cudaSuccess) {
          std::cerr << "Cuda error in file '" << __FILE__
              << "' in line " << __LINE__
              << " : " << cudaGetErrorString( err )
              << "." << std::endl;
            exit(EXIT_FAILURE);
        }
  }

  {
      cudaError err = cudaThreadSynchronize();
      if(err != cudaSuccess) {
          std::cerr << "Cuda error in file '" << __FILE__
              << "' in line " << __LINE__
              << " : " << cudaGetErrorString( err )
              << "." << std::endl;
          exit(EXIT_FAILURE);
      }
  }

  std::cout << "Multiprocessors: " << prop.multiProcessorCount << std::endl;
#endif

Google tells me that this macro has been moved into some other file (helper_cuda.h), but for whatever reason my install of CUDA doesn't seem to have that file.

Now everything builds. Hope this helps someone else.

kevinmpeterson avatar Jun 22 '13 19:06 kevinmpeterson

It works for me. Thank you!

romulogcerqueira avatar Sep 10 '14 13:09 romulogcerqueira

my opencv cannot compile through under having CUDA environment... why?

asimay avatar Sep 29 '14 09:09 asimay

I solved the problem, opencv is not work with CUDA 6.5, this is opencv bug, it is already resolved. please see detail info belows. http://code.opencv.org/projects/opencv/repository/revisions/feb74b125d7923c0bc11054b66863e1e9f753141

asimay avatar Sep 30 '14 02:09 asimay

hi, dear kevinmpeterson, I have CUDA setup successfully, and with GeForce GT730 Nvidia card, but the frame rate is still very low, like above. what's the reason of it? can you help me? thanks. my computer status: ubuntu 14.04 LTS GeForce GT730 Nvidia card; CUDA 6.5 opencv 2.4.9

2014-09-30 21 10 25

asimay avatar Sep 30 '14 13:09 asimay