unable to include cub

Unable to include cub

#include <cub/block/block_reduce.cuh>
#include <cub/cub.cuh>

when compiling with nvcc in cuda8

/usr/local/cuda/include/thrust/system/cuda/detail/cub/block/specializations/../../block/block_raking_layout.cuh(112): error: Uninitialized is not a template
/usr/local/cuda/include/thrust/system/cuda/detail/cub/block/specializations/../../block/block_raking_layout.cuh(112): error: not a class or struct name

Any idea?

thank you

You don’t mention which version of cub you are using. Make sure to use a version of cub that has been tested with cuda 8. You can discover this from the release notes:

the latest version of cub should be ok.

Are you also including thrust headers?

only these two headers were included.

// test.cu
#include <cub/block/block_reduce.cuh>
#include <cub/cub.cuh>

How to check the version of cub? it’s bundled with cuda8.0.

Compiled by

/usr/local/cuda/bin/nvcc test.cu -I"/usr/local/cuda/include/thrust/system/cuda/detail"

cub is not bundled with CUDA 8.0. It is not bundled with any version of CUDA.

Portions of CUB are contained within the version of thrust that is included with recent versions of CUDA. However this is not a standalone version of CUB that can be used by:

#include <cub/block/block_reduce.cuh>
#include <cub/cub.cuh>

The portions of cub included are only intended to be used via thrust. Not by themselves.

If you want to use cub, you need to install it first.

https://github.com/NVlabs/cub

The use of

-I"/usr/local/cuda/include/thrust/system/cuda/detail"

is not documented anywhere and is not a workable attempt to get access to cub.
In fact, you should never include something via such a path in thrust. header files at that level of depth/nesting in thrust are not designed to be used directly in user code. User code that attempts to do so may break from one CUDA version to the next, due to changes in thrust implementation.