I create a VS project using CUDA VS Wizard, and I try to build a cuda program using Thrust, the test program is quite simple:
// ignore headers
int main(void)
{
thrust::device_vector<double> X;
X.resize(100);
}
I will got some compile error like:
1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2039: 'vectorize_from_shared_kernel__entry' : is not a member of 'thrust::detail::device::cuda' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2039: 'vectorize_from_shared_kernel__entry' : is not a member of 'thrust::detail::device::cuda' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2065: 'vectorize_from_shared_kernel__entry' : undeclared identifier 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2062: type 'int' unexpected 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2039: 'vectorize_from_shared_kernel__entry' : is not a member of 'thrust::detail::device::cuda' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2039: 'vectorize_from_s开发者_运维知识库hared_kernel__entry' : is not a member of 'thrust::detail::device::cuda' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2065: 'vectorize_from_shared_kernel__entry' : undeclared identifier 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(29) : error C2062: type 'int' unexpected 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(36) : error C2143: syntax error : missing ';' before '<' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(36) : error C2182: '__wrapper__device_stub_vectorize_from_shared_kernel' : illegal use of type 'void' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(36) : error C2988: unrecognizable template declaration/definition 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(36) : error C2059: syntax error : '<' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(38) : error C2143: syntax error : missing ';' before '}' 1>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/tmpxft_00003cc0_00000000-3_sample.cudafe1.stub.c(38) : fatal error C1506: unrecoverable block scoping error
However, if I comment out the second statement "X.resize(100);", it can build successfully. So I guess the thrust setting, build rule setting and CUDA settings are correct. Do you have any idea about why these compile error appear?
I am using VS 2008, CUDA 2.3 and Thrust 1.1.
Is this in a .cu file (compiled with nvcc)? Thrust code should be put in .cu files.
Incidentally, personally I avoid the CUDA VS Wizard (partly because it is not provided/supported by NVIDIA) and use the strategy described in this other post.
精彩评论