美文网首页
CUDA 检查硬件配置

CUDA 检查硬件配置

作者: _酒酿芋圆 | 来源:发表于2019-03-12 10:23 被阅读0次
    #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

    相关文章

      网友评论

          本文标题:CUDA 检查硬件配置

          本文链接:https://www.haomeiwen.com/subject/bfhgpqtx.html