Skip to content

CMake bugs and CUDA issues in Ubuntu 12.04 #37

@kevinmpeterson

Description

@kevinmpeterson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions