2016-11-22 34 views
0
__global__ void addKernel(int *c, const int *a, const int *b) 
{ 
    int i = threadIdx.x; 
    auto lamb = [](int x) {return x + 1; }; // Works. 
    auto t = std::make_tuple(1, 2, 3); // Does not work. 
    c[i] = a[i] + b[i]; 
} 

NVCC至少有lambda,但std::make_tuple無法編譯。在當前版本的Cuda中元組不允許使用元組嗎?Cuda C++在設備代碼中沒有元組嗎?

+1

cuda沒有正式提供對設備代碼中的'std :: * anything *'的支持 –

+0

^^問題仍然存在,CUDA仍然不支持std :: make_tuple或std :: forward_tuple(即使在主機代碼中) –

回答

1
#include <thrust/tuple.h> 

__global__ void addKernel(int *c, const int *a, const int *b) 
{ 
    int i = threadIdx.x; 
    auto lamb = [](int x) {return x + 1; }; // Works. 
    auto t = thrust::make_tuple(1, 2, 3); 
    c[i] = a[i] + b[i]; 
} 

我需要從Thrust庫中取得那些,而不是讓它們看起來像它一樣工作。上面的編譯。