CUDA toolkit 5.0 v.5.5,没有更多的虚函数支持?

时间:2014-09-25 19:04:32

标签: c++ cuda thrust

给出以下代码:

#define DEVICE __device__
#define HOST __host__

#include <thrust/host_vector.h>
#include <thrust/device_vector.h>

template <typename T, std::size_t N>
class Container {
public:

    DEVICE HOST
    Container() {

    }

private:
    T data[N];
};

typedef Container<double, 7> double7;

template <std::size_t N = 10 >
class History {
public:

    DEVICE HOST
    History() {

    }

    DEVICE HOST
    virtual ~History() {

    }

private:

    double7 history[N];
};

int main() {

    try {

        thrust::host_vector<History<> > histories(1);
        thrust::device_vector<History<> > d_histories = histories;
    } catch (const thrust::system_error &) {
        std::cerr << "boo boo" << std::endl;
    }

    return 0;
}

以上运行工具包版本nvcc 5.0, v 0.2.1221没有错误,nvcc 5.5 v5.5.0失败。我意识到__global__中的虚函数不受支持,因为文档清楚地说明了这一点。

我的问题是:两个版本之间的变化是什么?#34; break&#34;虚函数?这是5.0中的5.5中的意外遗漏,已在{{1}}中得到纠正吗?

0 个答案:

没有答案