If I attempt to compile this code:
#include <iostream>
#include <utility>
#include <thrust/tuple.h>
#include <thrust/device_vector.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/iterator/counting_iterator.h>
namespace T = thrust;
template <typname ...Ts>
auto reduce_vectors(Ts&&... vectors) -> T::tuple<Ts...>
{
auto const zip_begin = T::make_zip_iterator(
T::make_tuple(std::forward<Ts>(vectors).begin()...));
return T::reduce();
}
int main(void)
{
auto const num_vals = size_t{3000};
using T::device_vector;
auto const count_begin = T::make_counting_iterator(0);
auto const count_end = count_begin + num_vals;
auto const vec_a = device_vector<int>{count_begin, count_end};
auto const vec_b = device_vector<int>{count_begin, count_end};
auto const vec_c = device_vector<int>{count_begin, count_end};
auto const vec_d = device_vector<int>{count_begin, count_end};
auto const vec_e = device_vector<int>{count_begin, count_end};
auto const zip_begin = T::make_zip_iterator(
T::make_tuple(
T::make_counting_iterator(0),
T::make_counting_iterator(10)));
using tuple_t = decltype(*zip_begin);
auto const zip_end = zip_begin + num_vals;
auto const tuple_sum = T::reduce(
T::host,
zip_begin, zip_end,
T::make_tuple(0, 0),
[] __host__ __device__ (tuple_t const& a, tuple_t const& b) -> tuple_t
{
return T::make_tuple(
T::get<0>(a) + T::get<0>(b),
T::get<1>(a) + T::get<1>(b));
});
std::cout << T::get<0>(tuple_sum) << ", " << T::get<1>(tuple_sum) << "\n";
return 0;
}
I receive this in the console:
C:\Some\Path>nvcc --expt-extended-lambda -O3 -gencode arch=compute_61,code=sm_61 -o zip-reduce zip-reduce.cu
zip-reduce.cu
zip-reduce.cu(12): error: identifier "typname" is undefined
zip-reduce.cu(13): error: cannot deduce "auto" type (initializer required)
At end of source: internal error: assertion failed: check_use_of_auto_type: bad symbol (C:/dvs/p4/build/sw/rel/gpu_drv/r361/r361_00/drivers/compiler/edg/EDG_4.10/src/decls.c, line 18644)
2 errors and 1 catastrophic error detected in the compilation of "C:/Some/PATH~1/AppData/Local/Temp/tmpxft_000038dc_00000000-13_zip-reduce.cpp1.ii".
Compilation aborted.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I’ve never seen nvcc hit a “catastrophic” error before so I figured I’d post it here and see if other people can replicated it. I’m using CUDA 8 on Windows 10 with a gtx 1060, using MSVC 2015 specifically.