flann-lib / flann

Fast Library for Approximate Nearest Neighbors
http://people.cs.ubc.ca/~mariusm/flann
Other
2.25k stars 648 forks source link

Error in compile Flann1.9.1 with CUDA in Win7 #352

Closed Roy0515 closed 7 years ago

Roy0515 commented 7 years ago

Hi, I am compiling Flann1.9.1 with CUDA 8.0 in VS2010 on Win7 system and getting:

1>E:/Flann/Flann-1.9.1/src/cpp\flann/util/cuda/result_set.h(59): error : calling a device function("infinity") from a host device function("SingleResultSet") is not allowed 1>
1>E:/Flann/Flann-1.9.1/src/cpp\flann/util/cuda/result_set.h(134): error : calling a device function("infinity") from a host device function("KnnResultSet") is not allowed 1>

1> 2 errors detected in the compilation of "C:/Users/CHENWE~1/AppData/Local/Temp/tmpxft_000012f0_00000000-6_kdtree_cuda_3d_index.cpp4.ii". 1>CUSTOMBUILD : nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). 1>CUSTOMBUILD : nvcc warning : nvcc support for Microsoft Visual Studio 2010 and earlier has been deprecated and is no longer being maintained 1> kdtree_cuda_3d_index.cu 1> CMake Error at flann_cuda_s_generated_kdtree_cuda_3d_index.cu.obj.Release.cmake:282 (message): 1> Error generating file 1> E:/Flann/Flann-1.9.1/build/src/cpp/CMakeFiles/flann_cuda_s.dir/flann/algorithms/Release/flann_cuda_s_generated_kdtree_cuda_3d_index.cu.obj

How can I figure out this problem? Any help? Thank in advance!

Roy0515 commented 7 years ago

This problem can be remove by change the function infinity() from (device forceinline) into (device host forceinline)

device host forceinline float infinity() { //return __int_as_float(0x7f800000); return 2139095040.f; // This seems either way to be a better solution, because infinity is a constant }

More detailes at here

133