2014-03-18 12 views
3

我有以下CUDA C代码。当试图编译它时,出现以下错误:CUDA C编译错误:全局函数中不允许有新运算符

function new/delete operator is not allowed in global function.

我已经能够在过去无错地编译此代码。可能是什么问题呢?

__global__ void kern(float *P, ... a bunch of other variables) 
{ 
    ... 
    W = new float[M]; 
    ... 
    delete[] W; 
} 

回答

3

刚才我想通了:在编译,需要添加

-arch sm_30 

搭建compuite能力3.0的代码。