在cuda核函数中可以new多大的显存?

最近我在写cuda程序的时候,发现一个问题,我的GPU是4G的显存.我在核函数中动态申请显存的时候发现申请的太大了就会出现错误.没有申请到.
比如:
double* dVectorEx = new doublerow * T_power(DBN_N) * decExLen;
double* dVectorEx = new double100;
第一行代码是动态申请的显存,第一次大概是7000多.会出现申请失败,代码会直接退出,不会执行以后的代码.7000个double类型的显存应该不会超过4G显存大小.我想问一下怎么可以申请大的显存.在核函数中.

read this entire section:

https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dynamic-global-memory-allocation-and-operations

remember that when you do this:

double* dVectorEx = new double[row * T_power(DBN_N) * decExLen]();

each thread is doing it.

If you end up needing more than 8 Megabytes (in total, across all threads), you have to raise the limit. Read the entire section I already linked.

我怎么做可以超过8MB的大小,我用的是Nsight编译器.在Ubuntu18操作系统.

Read the documentation I linked.