-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice.cu
More file actions
42 lines (37 loc) · 1.57 KB
/
device.cu
File metadata and controls
42 lines (37 loc) · 1.57 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
// run this to check your device specifications
#include <cuda_runtime.h>
#include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int deviceCount = 0, device = 0;
cudaDeviceProp deviceProp;
cudaGetDeviceCount(&deviceCount);
cudaGetDeviceProperties(&deviceProp, device);
cout << "total CUDA device: " << deviceCount << endl;
cout << "card: " << deviceProp.name << endl;
cout << "CUDA compute capability: "
<< deviceProp.major << "." << deviceProp.minor << endl;
cout << "SM count: "
<< deviceProp.multiProcessorCount << endl;
cout << "total global memory: "
<< (float)deviceProp.totalGlobalMem / pow(1024.0, 3) << " GB" << endl;
cout << "clock rate: " << deviceProp.clockRate * 1e-3f << " MHz" << endl;
cout << "l2 cache size: " << deviceProp.l2CacheSize << endl;
cout << "total constant memory: " << deviceProp.totalConstMem << endl;
cout << "total shared memory per block: "
<< deviceProp.sharedMemPerBlock << endl;
cout << "total registers per block: " << deviceProp.regsPerBlock << endl;
cout << "warp size: " << deviceProp.warpSize << endl;
cout << "max threads per SM: "
<< deviceProp.maxThreadsPerMultiProcessor << endl;
cout << "max size of each dimension in a block: "
<< deviceProp.maxThreadsDim[0] << " x "
<< deviceProp.maxThreadsDim[1] << " x "
<< deviceProp.maxThreadsDim[2] << endl;
cout << "max size of each dimension in a grid: "
<< deviceProp.maxGridSize[0] << " x "
<< deviceProp.maxGridSize[1] << " x "
<< deviceProp.maxGridSize[2] << endl;
}