which function can replace the deprecated function thrust::detail::backend::dereference In thrust 1.7

StackOverflow https://stackoverflow.com/questions/20277104

  •  06-08-2022
  •  | 
  •  

I'm a newbie to CUDA and thrust, I downloaded a GPU BVH building code from google code. But the code is written under older version of CUDA and thrust. Now, I'm using the latest CUDA 5.5 with thrust 1.7. It seems that the derefrence function has been deprecated, so I wonder how can I rewrite the following code in the latest CUDA and thrust

typename std::iterator_traits<Output_iterator>::value_type value = def_value;
for (uint32 i = begin; i < end; ++i)
  value = op( value, thrust::detail::backend::dereference( in_values + i ) );
thrust::detail::backend::dereference( out_values, leaf_id ) = value;

Thanks in advance!

有帮助吗?

解决方案

You should be able to just dereference the iterators directly with a more recent version of Thrust:

typename std::iterator_traits<Output_iterator>::value_type value = def_value; for (uint32 i = begin; i < end; ++i) value = op( value, in_values[i] ); out_values[leaf_id] = value;

其他提示

Probably the simplest solution is to download the version of Thrust you need from GitHub and compile directly.

Using Thrust's internal functions is not a good idea. The API shouldn't change without good reason, but the internals could change at any time.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top