1
votes

I'm very new to all this (started this week), so be kind :) I need to find out how my memory is distributed on my GPU card. I'm running a Intel Xeon CPU with 6 cores and a Tesla C2050 GPU card. How do i find out the size of the global, shared, local, constant, and texture memory? I've tried to use the deviceQuery code some have uploaded, but at this point i'm unable to compile any cuda code.

thanks in advance

1
Forget anything to do with the card itself - if you can't compile CUDA code, that needs to be your step 1. Are you running Linux or Windows? - pg1989

1 Answers

2
votes
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>


int main( void ) {
cudaDeviceProp  prop;

int count;

cudaGetDeviceCount( &count );
printf("This machine has %d CUDA devices availiable for harvesting \n\n", count);
for (int i=0; i< count; i++) {

    cudaGetDeviceProperties( &prop, i );
    printf( "   --- General Information for device %d ---\n", i );
    printf( "Name:  %s\n", prop.name );
    printf( "Compute capability:  %d.%d\n", prop.major, prop.minor );
    printf( "Clock rate:  %d\n", prop.clockRate );
    printf( "Device copy overlap:  " );
    if (prop.deviceOverlap)
        printf( "Enabled\n" );
    else
        printf( "Disabled\n");
    printf( "Kernel execution timeout :  " );
    if (prop.kernelExecTimeoutEnabled)
        printf( "Enabled\n" );
    else
        printf( "Disabled\n" );

    printf( "   --- Memory Information for device %d ---\n", i );
    printf( "Total global mem:  %ld\n", prop.totalGlobalMem );
    printf( "Total constant Mem:  %ld\n", prop.totalConstMem );
    printf( "Max mem pitch:  %ld\n", prop.memPitch );
    printf( "Texture Alignment:  %ld\n", prop.textureAlignment );

    printf( "   --- MP Information for device %d ---\n", i );
    printf( "Multiprocessor count:  %d\n",
        prop.multiProcessorCount );
    printf( "Shared mem per mp:  %ld\n", prop.sharedMemPerBlock );
    printf( "Registers per mp:  %d\n", prop.regsPerBlock );
    printf( "Threads in warp:  %d\n", prop.warpSize );
    printf( "Max threads per block:  %d\n",
        prop.maxThreadsPerBlock );
    printf( "Max thread dimensions:  (%d, %d, %d)\n",
        prop.maxThreadsDim[0], prop.maxThreadsDim[1],
        prop.maxThreadsDim[2] );
    printf( "Max grid dimensions:  (%d, %d, %d)\n",
        prop.maxGridSize[0], prop.maxGridSize[1],
        prop.maxGridSize[2] );
    printf( "\n" );
   }
}

The code is taken (and slightly modified) from Cuda by Example. It works for me. What error messages do you get when you try to compile ?