04-30 00:01
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

[CUDA] 자신의 GPU 카드의 Device 정보 출력하기 본문

Scientific Computing/NVIDIA CUDA

[CUDA] 자신의 GPU 카드의 Device 정보 출력하기

cinema4dr12 2014. 12. 22. 23:15

개발환경

  • MS Windows 7 x64

  • MS Visual Studio 2012

  • nVidia CUDA 6.5


1.  FILE > New > Project


2.  New Project > Templates > NVIDIA > CUDA 6.5


3.  CUDA 6.5 Runtime


4.  Project Name: DeviceInfo


5.  kernel.cu 코드 내용 삭제


6.  다음과 같이 코드 입력

#include <stdio.h>

int main()
{
    cudaDeviceProp  prop;

    int count;
    cudaGetDeviceCount( &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( "\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( "\n" );

        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" );
    }

    return 0;
}


7.  결과 : 각자의 Device에 따라 결과는 다르게 나옴

--- General Information for device 0 --- Name: GeForce GTX 750 Ti Compute capability: 5.0 Clock rate: 1110500 Device copy overlap: Enabled Kernel execution timeout : Enabled --- Memory Information for device 0 --- Total global mem: -2147483648 Total constant Mem: 65536 Max mem pitch: 2147483647 Texture Alignment: 512 --- MP Information for device 0 --- Multiprocessor count: 5 Shared mem per mp: 49152 Registers per mp: 65536 Threads in warp: 32 Max threads per block: 1024 Max thread dimensions: (1024, 1024, 64) Max grid dimensions: (2147483647, 65535, 65535)


Comments