Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Tags in this Discussion

Is this an nvcc preprocessor bug?
  • Hi All,

    I appear to have found a bug in nvcc. I wish to use Boost::ublas for sparse matrices/vectors on Linux (using gcc 4.3.4) with CUDA. Unfortunately, nvcc is unable to compile even the simplest of code incorporating sparse vectors/matrices, eg:

    #include "boost/numeric/ublas/vector_sparse.hpp"
    int main(int argc, char* argv[])
    {
    compressed_vector v(10);
    return 0;
    }

    The compile fails at the final stage of nvcc's toolchain with
    > nvcc --keep -I$HOME/include nvccboostvector.cu
    ...
    #$ gcc -c -x c++ -I"/home/stats/stsiab/include" "-I/hpcwarwick/gpu/cuda/4.0.17/cuda/bin/../include" "-I/hpcwarwick/gpu/cuda/4.0.17/cuda/bin/../include/cudart" -fpreprocessed -m64 -o "nvccboostvector.o" "nvccboostvector.cu.cpp"
    /home/stats/stsiab/include/boost/numeric/ublas/vector_sparse.hpp: In member function ‘const T* boost::numeric::ublas::mapped_vector::find_element(typename A::size_type) const’:
    /home/stats/stsiab/include/boost/numeric/ublas/vector_sparse.hpp:390: error: ‘__T13’ has not been declared

    Many messages about '__T13' appear, and seem related to nvcc's rewriting of the element access and assign methods for compressed_vector. I cannot find any declaration of '__T13' in any of the nvcc intermediate output. Interestingly, I only have this bug on my Linux platform (both CUDA 4.0 and 4.1, with gcc 4.3.4). My installation on Mac OSX 10.7 appears to work fine.

    Is there a workaround? I feel it is quite important to have nvcc working with Boost::ublas as this is turning out to be a useful C++ BLAS library.

    Thanks,

    Chris
  • 2 Comments sorted by
  • Vote Up0Vote Down fwende
    Posts: 19 Accepted Answer
    see here:

    http://stackoverflow.com/questions/8536683/compiling-error-nvcc-and-boost-library

    try to compile the host code using boost with your standard compiler, and give the cuda part to nvcc.
  • Hi,

    Yup, okay. That sorted it -- it's a pain to have to separate out code, though. uBLAS is quite handy for reading data in and getting it into a format suitable for uploading to device memory.

    Thanks!

    Chris