분리 가능한 컴파일을 사용하는 CUDA C++ 프로젝트에서 작업하고 있으며 컴파일 할 추력 함수를 얻는데 문제가 있습니다.thrust :: max_element를 사용할 때 정의되지 않은 기호 오류
프로젝트는 다음 함수 호출이 추가 될 때까지 아무 문제없이 빌드됩니다.
이Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol __fatbinwrap_66_tmpxft_00006db0_00000000_18_cuda_device_runtime_compute_61_cpp1_ii_8b1a5d37 referenced in function __cudaRegisterLinkedBinary_66_tmpxft_00006db0_00000000_18_cuda_device_runtime_compute_61_cpp1_ii_8b1a5d37 visualize C:\Users\13\Google Drive\WireMeshOT Rafael\CUDA\simulator\build\src\visualize_intermediate_link.obj 1
재미있는 것은이 다른 추력 함수 호출이 잘 컴파일한다는 것입니다 : dev_temp_intensity_buffer
는 부동입니다 :
thrust::exclusive_scan(thrust::device_ptr<unsigned int>(dev_ray_alive),
thrust::device_ptr<unsigned int>(dev_ray_alive + NRAYS),
thrust::device_ptr<unsigned int>(dev_scanned_alive_rays));
Obs1
thrust::device_ptr<float> max_int = thrust::max_element(
thrust::device_ptr<float>(dev_temp_intensity_buffer),
thrust::device_ptr<float>(dev_temp_intensity_buffer + INT_BUF_SIZE);
으로 내가 빌드 오류가 발생했다 장치 포인터가 포함되어 있으며 thrust/extrema.h
및 thrust/device_ptr.h
이 포함되어 있습니다.
Obs2 : CMake를 사용하여 빌드를 구성하고 있습니다. 관련 CMake 코드 발췌 내용은 아래와 같습니다.
SET(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -rdc=true -D_FORCE_INLINES)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -arch=compute_52 -code=sm_52 -lcudart -lcudadevrt -lcuda)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xptxas -v)
cuda_add_executable(
project
file1.cu
...)
target_link_libraries (project glut glew)
이 문제 유사하게 나타납니다 http://stackoverflow.com/questions/35704204/linking-cuda-plain-c-code-undefined-reference-to-fatbinwrap-66-tmpxft-e –
@JaredHoberock 예. nvcc 플래그에 -lcudadevrt를 추가했습니다. 그리고 성공없이'target_link_libraries (visualize utils cuda_utils glut glew $ {CUDA_LIBRARIES}) '를 사용해 보았습니다. 댓글 주셔서 감사합니다. –
문제가 CMake 빌드와 독립적으로 발생합니까? 명령 줄에서 수동으로 프로그램을 연결할 수 있습니까? 다른 사람들이 시스템에서 시도 할 수 있도록 문제를 나타내는 작은 재생 프로그램을 게시 할 수 있습니까? –