NVIDIA / cccl

CUDA C++ Core Libraries
Other
940 stars 116 forks source link

Compile error: cannot find cuda_bf16.h #930

Open peizhang-cn opened 1 year ago

peizhang-cn commented 1 year ago

Dear all,

I'm new to CUDA and trying to learn CUB for my applications. I try to compile examples (example_block_radix_sort.cu) with: nvcc -arch=sm_75 example_block_radix_sort.cu -I../.. -lcudart -O3, somehow, get a error: cuda_bf16.h: No such file or directory. After searching, seems issues NVIDIA/cub#478 is related, but I cannot find a solution as a beginner. Thanks for your help!

I use WSL2 (ubuntu20.04) and cub1.16.0 with an RTX 3060 ti.

gevtushenko commented 1 year ago

Hello @peizhang-cn and thank you for the interest to our project!

I was unable to reproduce your issue with CUB 1.16.0. Is there any chance you could try more recent version? Also, which version of CUDA are you using (nvcc --version)? In general, it's better to reuse our CMake infrastructure to build examples:

cmake -DThrust_DIR=/src/thrust/thrust/cmake \
      -DCUB_DISABLE_ARCH_BY_DEFAULT=YES \
      -DCUB_ENABLUE_COMPUTE_75=YES \
      -GNinja \
      ..
ninja cub.cpp14.example.block.radix_sort
peizhang-cn commented 1 year ago

Hi @senior-zero many thanks for the reply, I reinstalled Thrust and updated Cub to the newest version, and compiled Thrust with cmake -DTHRUST_INCLUDE_CUB_CMAKE=ON .. , it seems to work, but got the following errors after make:

nvcc fatal   : Unknown option 'include/home/pzhang/thrust/testing/fix_clang_nvcc_11.5.h'
make[2]: *** [CMakeFiles/thrust.headers.dir/build.make:76: CMakeFiles/thrust.headers.dir/headers/thrust/addressof.h.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1846: CMakeFiles/thrust.headers.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

the cuda version is 10.1.243.

gevtushenko commented 1 year ago

@peizhang-cn the minimal required CUDA version for Thrust/CUB is 11.1. I'd suggest installing the latest CUDA, which is 12.1 at the moment.