This commit is contained in:
Hendrik Groove 2024-10-21 00:39:06 +02:00
parent a135895f3a
commit 807ee5da88

View File

@ -1000,19 +1000,6 @@ auto Reduce(Policy policy, InputIt first, InputIt second, Init init, Func reduce
std::cerr << "Iterator types - begin: " << typeid(begin_it).name()
<< ", end: " << typeid(end_it).name() << std::endl;
// If we need to check pointer validity, we can do it like this:
if (batch_size > 0) {
// Use thrust::raw_pointer_cast to get the underlying device pointer
auto raw_ptr = thrust::raw_pointer_cast(&(*begin_it));
hipPointerAttribute_t attrs;
hipError_t ptr_err = hipPointerGetAttributes(&attrs, raw_ptr);
if (ptr_err != hipSuccess) {
std::cerr << "Invalid pointer for first element: " << hipGetErrorString(ptr_err) << std::endl;
} else {
std::cerr << "Valid pointer for first element, memory type: " << attrs.type << std::endl;
}
}
auto ret = thrust::reduce(policy, begin_it, end_it, init, reduce_op);
aggregate = reduce_op(aggregate, ret);