Skip to content

Commit 7f9532d

Browse files
committed
Add 6_2
1 parent 3f3a3c6 commit 7f9532d

File tree

5 files changed

+1536
-0
lines changed

5 files changed

+1536
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "cuda_runtime.h"
2+
#include "device_launch_parameters.h"
3+
#include "helper_cuda.h"
4+
5+
#include <stdio.h>
6+
7+
#define _1MB (1024*1024)
8+
9+
void main(void) {
10+
int ngpus;
11+
cudaGetDeviceCount(&ngpus);
12+
13+
for (int i = 0; i < ngpus; i++) {
14+
cudaDeviceProp devProp;
15+
16+
cudaGetDeviceProperties(&devProp, i);
17+
18+
printf("Device %d: %s\n"
19+
, i, devProp.name);
20+
printf("\tCompute capability: %d.%d\n"
21+
, devProp.major, devProp.minor);
22+
printf("\tThe number of steraming multiprocesors: %d\n"
23+
, devProp.multiProcessorCount);
24+
printf("\tThe number of CUDA cores: %d\n"
25+
, _ConvertSMVer2Cores(devProp.major, devProp.minor)
26+
* devProp.multiProcessorCount);
27+
printf("\tGlobal memory size: %.2f MB"
28+
, (float)devProp.totalGlobalMem / _1MB);
29+
}
30+
}

0 commit comments

Comments
 (0)