#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的数量:" << devProp.multiProcessorCount << endl;
cout << "每个线程块的共享内存大小:" << devProp.sharedMemPerBlock / 1024.0 << " KB" << endl;
cout << "每个线程块的最大线程数:" << devProp.maxThreadsPerBlock << endl;
cout << "每个EM的最大线程数:" << devProp.maxThreadsPerMultiProcessor << endl;
cout << "每个EM的最大线程束数:" << devProp.maxThreadsPerMultiProcessor / 32 << endl;
}
return 0;
}
参考链接:
https://blog.csdn.net/xiaohu2022/article/details/79599947
网友评论