#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
using namespace std;
cudaError_t cudaStatus;
int main() {
int dev = 0;
cudaDeviceProp devProp;
cudaStatus = cudaGetDeviceCount(&dev);
for (int i = 0; i < dev; i++) {
cudaGetDeviceProperties(&devProp, i);
cout << "使用GPU device " << dev << ": " << devProp.name << endl;
cout << "SM的數(shù)量:" << devProp.multiProcessorCount << endl;
cout << "每個線程塊的共享內(nèi)存大小:" << devProp.sharedMemPerBlock / 1024.0 << " KB" << endl;
cout << "每個線程塊的最大線程數(shù):" << devProp.maxThreadsPerBlock << endl;
cout << "每個EM的最大線程數(shù):" << devProp.maxThreadsPerMultiProcessor << endl;
cout << "每個EM的最大線程束數(shù):" << devProp.maxThreadsPerMultiProcessor / 32 << endl;
}
return 0;
}
參考鏈接:
https://blog.csdn.net/xiaohu2022/article/details/79599947