Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake bugs and CUDA issues in Ubuntu 12.04 #37

Open
kevinmpeterson opened this issue Jun 22, 2013 · 4 comments
Open

CMake bugs and CUDA issues in Ubuntu 12.04 #37

kevinmpeterson opened this issue Jun 22, 2013 · 4 comments

Comments

@kevinmpeterson
Copy link

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.

@romulogcerqueira
Copy link

It works for me. Thank you!

@asimay
Copy link

asimay commented Sep 29, 2014

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

@asimay
Copy link

asimay commented Sep 30, 2014

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
Copy link

asimay commented Sep 30, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants