Faiss: GPU compilation fails: Tensor.cuh(362): type name is not allowed

Created on 26 Mar 2019  路  7Comments  路  Source: facebookresearch/faiss

Summary

I follow the Install.md instructions from step 1 to step 3. General compilation and Python setup worked fine, but the GPU compilation fails with:

$ make
/usr/local/cuda/bin/nvcc -I /usr/local/cuda/targets/x86_64-linux/include/ -Xcompiler -fPIC -Xcudafe --diag_suppress=unrecognized_attribute -gencode arch=compute_35,code="compute_35" -gencode arch=compute_52,code="compute_52" -lineinfo -ccbin g++ -std=c++11 -DFAISS_USE_FLOAT16 -g -O3 -c impl/BinaryDistance.cu -o impl/BinaryDistance.o
impl/../utils/Tensor.cuh(362): error: type name is not allowed

impl/../utils/Tensor.cuh(362): error: expected an expression

2 errors detected in the compilation of "/tmp/tmpxft_000010e7_00000000-4_BinaryDistance.cpp4.ii".
make: *** [Makefile:71: impl/BinaryDistance.o] Error 2

The same error occurs multiple times if I follow the recommendation to use multiple threads during make.

Platform

OS: Fedora 29

Faiss version: a9959bf63b930da491d3e2bce00ff1a675d3ddcf

GPU install

Most helpful comment

This error happened to me as well, and I fixed it by adding the "template" keyword after arg on the faulty line.

return arg.template canUseIndexType() &&
canUseIndexType(args...);

All 7 comments

Which versions of cuda and g++ are you using ?

g++:

$ g++ --version
g++ (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)

cuda:

$ /usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105

I'm using a Nvidia GeForce GTX 970 which supports compute capability 5.2.

This error happened to me as well, and I fixed it by adding the "template" keyword after arg on the faulty line.

return arg.template canUseIndexType() &&
canUseIndexType(args...);

@beauby can we repro this with the compilers used for Travis?
@redmajor, @Steffen911 would you mind submitting a PR with the suggested change so that we can check if it breaks something else?

@mdouze We won't be able to reproduce this _on_ TravisCI, as they still do not offer GPUs AFAIK, but I'll try to reproduce it locally.

@mdouze I can confirm that the fix by @redmajor fixes the issue on my side. I will prepare a PR with the change.

[Solved] Another method.
I got mine to compile by adding --ccbin=$(which g++-6) to nvcc's commandline.
Background:
I'm using cuda-9.1 and nvcc, to compile a software called SiftGPU.
It also gives the error. This was AFTER I disabled the gcc 6 version test in the include files, which some others have also done, but I guess they didn't get this error from defeating that apparently-honest test. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wwmmqq picture wwmmqq  路  3Comments

ilyakhov picture ilyakhov  路  3Comments

linghuang picture linghuang  路  3Comments

xxllp picture xxllp  路  3Comments

hipitt picture hipitt  路  3Comments