'info'에 해당되는 글 1건

  1. 2026.04.29 [CUDA] Device Properties 디바이스 정보 확인
반응형

CUDA 디바이스 정보를 확인해 보자.

 

helper_cuda.h
0.03MB
helper_string.h
0.01MB

 

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "helper_cuda.h"

#define _1MB (1024 * 1024)

int main()
{
	int ngpus;
	cudaGetDeviceCount(&ngpus);

	for (int i = 0; i < ngpus; i++) {
		cudaDeviceProp prop;
		cudaGetDeviceProperties(&prop, i);
		size_t a;
		printf("GPU %d: %s\n", i, prop.name);
		printf("\tCompute capability: %d.%d\n", prop.major, prop.minor);
		printf("\tNumber of multiprocessors: %d\n", prop.multiProcessorCount);
		printf("\tNumber of CUDA cores: %d\n", prop.multiProcessorCount * _ConvertSMVer2Cores(prop.major, prop.minor));
		printf("\tGlobal memory: %llu MB\n", prop.totalGlobalMem / _1MB);
		printf("\tShared memory per block: %llu KB\n", prop.sharedMemPerBlock / 1024);
		printf("\tRegisters per block: %d\n", prop.regsPerBlock);
		printf("\tWarp size: %d\n", prop.warpSize);
		printf("\tMax threads per block: %d\n", prop.maxThreadsPerBlock);
		printf("\tMax threads per multiprocessor: %d\n", prop.maxThreadsPerMultiProcessor);
	}

	return 0;
}

 

 

반응형
Posted by J-sean
: