设备的内存分配在nsight Eclipse和Netbeans中有所不同

时间:2019-04-04 12:37:42

标签: c++ c netbeans cuda nsight

下面是我在nsight eclipseNetbeans中执行的书面代码。我获得了不同的内存分配大小。我不明白为什么会这样。如果有人有任何线索,请帮助。

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

0 个答案:

没有答案