CUDA版本:11.1
VS2019 x64 Debug模式下(Release 模式下没问题)
对device vector赋值失败,报错:Run-time Check Failure #3 - The variable ‘result’ is being used without being initialized
解决方法:
文件 …\CUDA\v11.1\include\thrust\detail\allocator\allocator_traits.inl中,将
template<typename Alloc>
__host__ __device__
typename disable_if<
has_member_system<Alloc>::value,
typename allocator_system<Alloc>::type
>::type
system(Alloc &)
{
// return a copy of a default-constructed system
typename allocator_system<Alloc>::type result;
return result;
}
替换为
template<typename Alloc>
__host__ __device__
typename disable_if<
has_member_system<Alloc>::value,
typename allocator_system<Alloc>::type
>::type
system(Alloc &)
{
// return a copy of a default-constructed system
return typename allocator_system<Alloc>::type();
}