下面是我在nsight eclipse
和Netbeans
中执行的书面代码。我获得了不同的内存分配大小。我不明白为什么会这样。如果有人有任何线索,请帮助。
int main()
{
cuComplex *a,*b;
float *c;
double mfree,mtotal;
size_t mem1,mem2;
int Size = 8192;
cudaMalloc((void**)&a,sizeof(cuComplex)*Size*Size);
cudaMalloc((void**)&b,sizeof(cuComplex)*Size*Size);
cudaMalloc((void**)&c,sizeof(float)*Size*Size);
cudaMemGetInfo(&mem1,&mem2);
mfree = (double)mem1/1024*1024;
mtotal = (double)mem2/1024*1024;
printf("Total memory = %f and Free Memory = %f",mtotal,mfree);
}
以下是两个平台的输出
Nsight Eclipse中的输出
Total memory = 2001.8125 and Free Memory = 105.625
Netbeans中的输出
Total memory = 2001.8125 and Free Memory = 572.125