在官方看到
CUDA 3.2RC2中有一项"Miscellaneous
Support for malloc() and free() in CUDA C compute kernels
NVIDIA System Management Interface (nvidia-smi) support for reporting % GPU busy, and several GPU performance counters
"
于是写了个内核如下
global
void hello(char *a, int *b)
{
a[threadIdx.x] += b[threadIdx.x];
Point p=(Point)malloc(sizeof(Point));
free(p);
}
结果就是error: calling a host function from a device/global function is not allowed
不是说明在内核中支持了嘛?!