Boost logo

Boost Users :

Subject: Re: [Boost-users] [uBLAS] Strange bug with nvcc
From: Chris Jewell (chris.jewell_at_[hidden])
Date: 2012-02-12 03:52:31

On 11 Feb 2012, at 00:26, Lars Viklund wrote:

> On Fri, Feb 10, 2012 at 02:57:54PM +0000, Chris Jewell wrote:
>> /home/stats/stsiab/include/boost/numeric/ublas/vector_sparse.hpp:390: error: ‘__T13’ has not been declared
>> What is "__T13"? grep on the Boost source doesn't find it, so I assume that I'm missing a header from somewhere else? The other odd thing is that there is no reference to my CUDA file. Furthermore, everything works well on my MacBook Pro with GCC 4.2.1 and nvcc 4.1.
> When you get mysterious token errors appearing in source code, the
> culprit is almost always a rogue macro defined by the compiler or by
> some header earlier in the build process.
> Look at the untainted source line, see what originally is there and look
> for what could make it expand in a way you don't expect it to.
> Single-letter macros tend to be more common than you think, it could be
> as simple as a
> #define M __T13
> sneaking in from the toolchain you use.

So this looks like an inability (bug?) of nvcc to compile the sparse vector (and matrix) template classes. I can reproduce the bug with a piece of code as simple as

#include <boost/numeric/ublas/vector_sparse.hpp>

int main(int argc, char* argv[])
        compressed_vector<int> v(10);
        return 0;

It appears to be something to do with the nvcc preprocessor, as the bug appears in the last stage of compilation:

#$ 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" ""
/home/stats/stsiab/include/boost/numeric/ublas/vector_sparse.hpp: In member function ‘const T* boost::numeric::ublas::mapped_vector<T, A>::find_element(typename A::size_type) const’:
/home/stats/stsiab/include/boost/numeric/ublas/vector_sparse.hpp:390: error: ‘__T13’ has not been declared

etc etc

The problem seems associated with the return statements at the end of the element access and assignment methods in vector_sparse.cpp (lines 390, 401, 4008, 437, 562 ,617, 690) where, for example, the nvcc preprocessor rewrites them as:

# 390 "/home/stats/stsiab/include/boost/numeric/ublas/vector_sparse.hpp"
return &((*it).__T13::second);

It appears that __T13 is never declaredd, or at least I can't find any declaration in any of the intermediate files nvcc spits out.

Anyway, this looks like an nvcc Linux problem for now (Mac OSX appears to work), so I'll raise it with NVIDIA.



Dr Chris Jewell
Department of Statistics
University of Warwick
Tel: +44 (0)24 7615 0778

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at