Search code examples
c++templatescudacompiler-errorsthrust

Thrust graph; Native CUDA compilation problem... Linux


I'm trying to compile a simple example from thrust graph.

At the moment I have everything commented out in main(void)

I'm looking for ANY direction someone is willing to give!

My compilation error is this:

mseil@cuda:~/mseil_CUDA/test$ nvcc Example.cu 
/usr/local/cuda/bin/../include/thrust/detail/device/cuda/reduce_by_keyvalue.inl(90): error: name followed by "::" must be a class or namespace name

/usr/local/cuda/bin/../include/thrust/graph/detail/adjacency_list.inl(141): error: name followed by "::" must be a class or namespace name

/usr/local/cuda/bin/../include/thrust/graph/detail/adjacency_list.inl(213): error: name followed by "::" must be a class or namespace name

/usr/local/cuda/bin/../include/thrust/graph/detail/adjacency_list.inl(344): error: name followed by "::" must be a class or namespace name

4 errors detected in the compilation of "/tmp/tmpxft_00007122_00000000-9_Example.cpp4.ii".

I zeroed in on the very first error, line 90 of the include/thrust/detail/device/cuda/reduce_by_keyvalue.inl file and I can't see what the problem is. I'm new to C++ (and I know C at a beginner's level). Everything looks fine in regards to a template file, and I'd be shocked if the guys at NVIDIA don't know what they're doing--so it must be me.

The code around line 90:

  typedef typename thrust::iterator_traits<InputIterator1>::difference_type difference_type;

  difference_type n =key_last - key_first;
  difference_type N =result_last - result_first;

  const std::size_t BLOCK_SIZE =512; // number of threads per block
  const std::size_t MAX_BLOCKS =thrust::experimental::arch::max_active_threads() / BLOCK_SIZE;
  const std::size_t NUM_BLOCKS =std::min( MAX_BLOCKS, n + (BLOCK_SIZE - 1) / BLOCK_SIZE);  //offending line.

And currently the only code in my main: (Everything else is commented.)

#include <thrust/graph/adjacency_list.hpp>
using namespace thrust;

int main(void){
    typedef adjacency_list<undirectedS, disallow_parallelS> graph_t;

    return 0;
}

Solution

  • I am thrust graph lib developer, drkkojima. I updated to 0.2RC03 and solved the problems.