-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcuda_device.cpp
More file actions
73 lines (65 loc) · 1.63 KB
/
cuda_device.cpp
File metadata and controls
73 lines (65 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include "cuda_device.h"
#include <cuda_runtime.h>
using namespace std;
__host__ struct cudaDeviceProp
deviceProperties (int deviceId)
{
struct cudaDeviceProp props;
cudaGetDeviceProperties (&props, deviceId);
const char *archName;
int cudaCores = 0;
switch (props.major)
{
case 1:
archName = "Tesla";
cudaCores = 8;
break;
case 2:
archName = "Fermi";
if (props.minor == 0)
cudaCores = 32;
else
cudaCores = 48;
break;
case 3:
archName = "Kepler";
cudaCores = 192;
break;
case 4:
archName = "Maxwell";
cudaCores = 128;
break;
case 5:
archName = "Pascal";
cudaCores = 64;
break;
case 6:
archName = "Volta";
cudaCores = 64;
break;
case 7:
archName = "Turing";
cudaCores = 64;
break;
case 8:
archName = "Ampere";
cudaCores = 64;
break;
default:
archName = "DESCONOCIDA";
}
cout << "DEVICE" << deviceId << " : " << props.name << endl;
cout << "****************************************************" << endl;
cout << "> Arquitectura CUDA : " << archName << endl;
cout << "> Capacidad de Computo : " << props.major << "." << props.
minor << endl;
cout << "> No. MultiProcesadores : " << props.
multiProcessorCount << endl;
cout << "> No. Nucleos CUDA (" << cudaCores << "x" << props.
multiProcessorCount << ") : " << cudaCores *
props.multiProcessorCount << endl;
cout << "> Memoria Global (total) : " << props.totalGlobalMem / 1048576 << " MiB" << endl; // to convert bytes to Mebibyte (MiB)
cout << endl;
return props;
}