-
Notifications
You must be signed in to change notification settings - Fork 0
/
prop.cu
31 lines (27 loc) · 1.11 KB
/
prop.cu
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
#include <iostream>
#include <cuda_runtime.h>
int main(){
int dev_count;
cudaGetDeviceCount(&dev_count);
if(dev_count==0){
std::cout <<"No cuda devices found!" << std::endl;
return 1;
}
cudaDeviceProp dev_prop;
for(int i=0;i<dev_count;i++){
cudaGetDeviceProperties(&dev_prop, i);
std::cout << "device" << i << ":" << dev_prop.name << std::endl;
std::cout << "total global memory:" << dev_prop.totalGlobalMem << "bytes" << std::endl;
std::cout << "shared memory per block:" << dev_prop.sharedMemPerBlock << "bytes" << std::endl;
std::cout << "registers per block:" << dev_prop.regsPerBlock << std::endl;
std::cout << "Warp size:" << dev_prop.warpSize << std::endl;
std::cout << "max threads per block:" << dev_prop.maxThreadsPerBlock << std::endl;
std::cout << "max threads dim: {" << dev_prop.maxThreadsDim[0] << ","
<< dev_prop.maxThreadsDim[1] << ","
<< dev_prop.maxThreadsDim[2] << "}" << std::endl;
std::cout << " max grid size: {" << dev_prop.maxGridSize[0] << ","
<< dev_prop.maxGridSize[1] << ","
<< dev_prop.maxGridSize[2] << "}" << std::endl;
}
return 0;
}