You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
In the newer version of the CUDA 12.1 SDK with the newer thrust library (> 2.0), the thrust::reduce function can emit a compile-time error when querying the return type of a device-only lambda from host code. The compiler error suggests using cuda::proclaim_return_type if you don't want to change the lambda to a host device lambda or named function object.
However, despite applying cuda::proclaim_return_type(), I still encountered compilation failure. I have provided a standalone bug reproducer at https://cuda.godbolt.org/z/ad8aTzKfT.
I am wondering if this is an expected result or if I missed something.
#include<cuda/functional>
#include<thrust/device_vector.h>
#include<thrust/execution_policy.h>
#include<thrust/reduce.h>
#include<iostream>intmain() {
thrust::device_vector<uint64_t> v(1024, 1);
#defineUSE_PROCLIAM_RETURN_TYPE
#ifdef USE_PROCLIAM_RETURN_TYPE
std::cout << thrust::reduce(thrust::device,
v.begin(), v.end(), static_cast<uint64_t>(0),
cuda::proclaim_return_type<uint64_t>(
[] __device__(uint64_t a, uint64_t b) -> uint64_t {
return a + b;
})) << std::endl;
#else
std::cout << thrust::reduce(thrust::device,
v.begin(), v.end(), static_cast<uint64_t>(0),
[] __host____device__(uint64_t a, uint64_t b) -> uint64_t {
return a + b;
}) << std::endl;
#endifreturn0;
}
Thank you so much,
Lilo
The text was updated successfully, but these errors were encountered:
Your code is absolutely fine. The issue is in the initial version of the proclaim_return_type. It was addressed in the following PR. Your reproducer seems to work fine with the trunk version of libcu++.
Hi @allisonvacanti @senior-zero @jrhemstad,
In the newer version of the CUDA 12.1 SDK with the newer thrust library (> 2.0), the thrust::reduce function can emit a compile-time error when querying the return type of a device-only lambda from host code. The compiler error suggests using cuda::proclaim_return_type if you don't want to change the lambda to a host device lambda or named function object.
However, despite applying cuda::proclaim_return_type(), I still encountered compilation failure. I have provided a standalone bug reproducer at https://cuda.godbolt.org/z/ad8aTzKfT.
I am wondering if this is an expected result or if I missed something.
Thank you so much,
Lilo
The text was updated successfully, but these errors were encountered: