当前位置: 首页 > news >正文

求个网站好人有好报2022收录网站有哪些

求个网站好人有好报2022,收录网站有哪些,2024年最新时政热点,太原网站建设ty556本篇博文转载于https://www.cnblogs.com/1024incn/tag/CUDA/,仅用于学习。 device管理 NVIDIA提供了集中凡是来查询和管理GPU device,掌握GPU信息查询很重要,因为这可以帮助你设置kernel的执行配置。 本博文将主要介绍下面两方面内容&…

本篇博文转载于https://www.cnblogs.com/1024incn/tag/CUDA/,仅用于学习。

device管理

NVIDIA提供了集中凡是来查询和管理GPU device,掌握GPU信息查询很重要,因为这可以帮助你设置kernel的执行配置。

本博文将主要介绍下面两方面内容:

  • CUDA runtime API function
  • NVIDIA系统管理命令行

使用runtime API来查询GPU信息

你可以使用下面的function来查询所有关于GPU device 的信息:

cudaError_t cudaGetDeviceProperties(cudaDeviceProp *prop, int device);

GPU的信息放在cudaDeviceProp这个结构体中。

代码

#include <cuda_runtime.h>#include <stdio.h>int main(int argc, char **argv) {      printf("%s Starting...\n", argv[0]);int deviceCount = 0;cudaError_t error_id = cudaGetDeviceCount(&deviceCount);if (error_id != cudaSuccess) {printf("cudaGetDeviceCount returned %d\n-> %s\n",(int)error_id, cudaGetErrorString(error_id));printf("Result = FAIL\n");exit(EXIT_FAILURE);}if (deviceCount == 0) {printf("There are no available device(s) that support CUDA\n");} else {printf("Detected %d CUDA Capable device(s)\n", deviceCount);}int dev, driverVersion = 0, runtimeVersion = 0;dev =0;cudaSetDevice(dev);cudaDeviceProp deviceProp;cudaGetDeviceProperties(&deviceProp, dev);printf("Device %d: \"%s\"\n", dev, deviceProp.name);cudaDriverGetVersion(&driverVersion);cudaRuntimeGetVersion(&runtimeVersion);printf(" CUDA Driver Version / Runtime Version %d.%d / %d.%d\n",driverVersion/1000, (driverVersion%100)/10,runtimeVersion/1000, (runtimeVersion%100)/10);printf(" CUDA Capability Major/Minor version number: %d.%d\n",deviceProp.major, deviceProp.minor);printf(" Total amount of global memory: %.2f MBytes (%llu bytes)\n",(float)deviceProp.totalGlobalMem/(pow(1024.0,3)),(unsigned long long) deviceProp.totalGlobalMem);printf(" GPU Clock rate: %.0f MHz (%0.2f GHz)\n",deviceProp.clockRate * 1e-3f, deviceProp.clockRate * 1e-6f);printf(" Memory Clock rate: %.0f Mhz\n",deviceProp.memoryClockRate * 1e-3f);printf(" Memory Bus Width: %d-bit\n",deviceProp.memoryBusWidth);if (deviceProp.l2CacheSize) {printf(" L2 Cache Size: %d bytes\n",deviceProp.l2CacheSize);}printf(" Max Texture Dimension Size (x,y,z) 1D=(%d), 2D=(%d,%d), 3D=(%d,%d,%d)\n",deviceProp.maxTexture1D , deviceProp.maxTexture2D[0],deviceProp.maxTexture2D[1],deviceProp.maxTexture3D[0], deviceProp.maxTexture3D[1],deviceProp.maxTexture3D[2]);printf(" Max Layered Texture Size (dim) x layers 1D=(%d) x %d, 2D=(%d,%d) x %d\n",deviceProp.maxTexture1DLayered[0], deviceProp.maxTexture1DLayered[1],deviceProp.maxTexture2DLayered[0], deviceProp.maxTexture2DLayered[1],deviceProp.maxTexture2DLayered[2]);printf(" Total amount of constant memory: %lu bytes\n",deviceProp.totalConstMem);printf(" Total amount of shared memory per block: %lu bytes\n",deviceProp.sharedMemPerBlock);printf(" Total number of registers available per block: %d\n",deviceProp.regsPerBlock);printf(" Warp size: %d\n", deviceProp.warpSize);printf(" Maximum number of threads per multiprocessor: %d\n",deviceProp.maxThreadsPerMultiProcessor);printf(" Maximum number of threads per block: %d\n",deviceProp.maxThreadsPerBlock);printf(" Maximum sizes of each dimension of a block: %d x %d x %d\n",deviceProp.maxThreadsDim[0],deviceProp.maxThreadsDim[1],deviceProp.maxThreadsDim[2]);printf(" Maximum sizes of each dimension of a grid: %d x %d x %d\n",deviceProp.maxGridSize[0],deviceProp.maxGridSize[1],deviceProp.maxGridSize[2]);printf(" Maximum memory pitch: %lu bytes\n", deviceProp.memPitch);exit(EXIT_SUCCESS);
}

编译运行:

$ nvcc checkDeviceInfor.cu -o checkDeviceInfor
$ ./checkDeviceInfor

决定最佳GPU

对于支持多GPU的系统,是需要从中选择一个来作为我们的device的,抉择出最佳计算性能GPU的一种方法就是由其拥有的处理器数量决定,可以用下面的代码来选择最佳GPU。

int numDevices = 0;
cudaGetDeviceCount(&numDevices);
if (numDevices > 1) {int maxMultiprocessors = 0, maxDevice = 0;for (int device=0; device<numDevices; device++) {cudaDeviceProp props;cudaGetDeviceProperties(&props, device);if (maxMultiprocessors < props.multiProcessorCount) {maxMultiprocessors = props.multiProcessorCount;maxDevice = device;}}cudaSetDevice(maxDevice);
}

使用nvidia-smi来查询GPU信息

nvidia-smi是一个命令行工具,可以帮助你管理操作GPU device,并且允许你查询和更改device状态。

nvidia-smi用处很多,比如,下面的指令:

$ nvidia-smi -L
GPU 0: Tesla M2070 (UUID: GPU-68df8aec-e85c-9934-2b81-0c9e689a43a7)
GPU 1: Tesla M2070 (UUID: GPU-382f23c1-5160-01e2-3291-ff9628930b70)

然后可以使用下面的命令来查询GPU 0 的详细信息:

$nvidia-smi –q –i 0

下面是该命令的一些参数,可以精简nvidia-smi的显示信息:

MEMORY

UTILIZATION

ECC

TEMPERATURE

POWER

CLOCK

COMPUTE

PIDS

PERFORMANCE

SUPPORTED_CLOCKS

PAGE_RETIREMENT

ACCOUNTING

比如,显示只device memory的信息:

$nvidia-smi –q –i 0 –d    MEMORY | tail –n 5
Memory Usage
Total : 5375 MB
Used : 9 MB
Free : 5366 MB

设置device

对于多GPU系统,使用nvidia-smi可以查看各GPU属性,每个GPU从0开始依次标注,使用环境变量CUDA_VISIBLE_DEVICES可以指定GPU而不用修改application。

可以设置环境变量CUDA_VISIBLE_DEVICES-2来屏蔽其他GPU,这样只有GPU2能被使用。当然也可以使用CUDA_VISIBLE_DEVICES-2,3来设置多个GPU,他们的device ID分别为0和1.


文章转载自:
http://titlist.rtzd.cn
http://privative.rtzd.cn
http://corresponsively.rtzd.cn
http://quindecemvir.rtzd.cn
http://agapemone.rtzd.cn
http://weird.rtzd.cn
http://andizhan.rtzd.cn
http://trengganu.rtzd.cn
http://sot.rtzd.cn
http://flambe.rtzd.cn
http://smoothbore.rtzd.cn
http://hallstattian.rtzd.cn
http://imperence.rtzd.cn
http://burma.rtzd.cn
http://rex.rtzd.cn
http://goonery.rtzd.cn
http://smally.rtzd.cn
http://slicken.rtzd.cn
http://placatory.rtzd.cn
http://milliner.rtzd.cn
http://el.rtzd.cn
http://hubbub.rtzd.cn
http://vehicle.rtzd.cn
http://jenny.rtzd.cn
http://opencast.rtzd.cn
http://nagmaal.rtzd.cn
http://carlet.rtzd.cn
http://uncopiable.rtzd.cn
http://subdual.rtzd.cn
http://undeviating.rtzd.cn
http://triticum.rtzd.cn
http://button.rtzd.cn
http://intracerebral.rtzd.cn
http://oxonian.rtzd.cn
http://inorganized.rtzd.cn
http://geezer.rtzd.cn
http://plunge.rtzd.cn
http://iodid.rtzd.cn
http://earcap.rtzd.cn
http://dungeon.rtzd.cn
http://anarchism.rtzd.cn
http://insipidity.rtzd.cn
http://monarchic.rtzd.cn
http://professoriate.rtzd.cn
http://streptococci.rtzd.cn
http://nondegree.rtzd.cn
http://gumball.rtzd.cn
http://bairn.rtzd.cn
http://fundamentally.rtzd.cn
http://zingaro.rtzd.cn
http://unprofessed.rtzd.cn
http://judicially.rtzd.cn
http://polariscope.rtzd.cn
http://spriggy.rtzd.cn
http://fourpenny.rtzd.cn
http://unimaginable.rtzd.cn
http://cropper.rtzd.cn
http://pensionless.rtzd.cn
http://cornel.rtzd.cn
http://esplees.rtzd.cn
http://incontrovertible.rtzd.cn
http://holyday.rtzd.cn
http://suffragette.rtzd.cn
http://camphire.rtzd.cn
http://dumbartonshire.rtzd.cn
http://zenist.rtzd.cn
http://unembroidered.rtzd.cn
http://tunnel.rtzd.cn
http://pyrocatechol.rtzd.cn
http://amman.rtzd.cn
http://akita.rtzd.cn
http://pic.rtzd.cn
http://pinken.rtzd.cn
http://yewk.rtzd.cn
http://dcc.rtzd.cn
http://impiously.rtzd.cn
http://disputably.rtzd.cn
http://godfrey.rtzd.cn
http://sheller.rtzd.cn
http://exchangeability.rtzd.cn
http://unstalked.rtzd.cn
http://luggie.rtzd.cn
http://nas.rtzd.cn
http://woodlander.rtzd.cn
http://chimb.rtzd.cn
http://acute.rtzd.cn
http://gravitational.rtzd.cn
http://multipad.rtzd.cn
http://vatful.rtzd.cn
http://colorized.rtzd.cn
http://clv.rtzd.cn
http://nantz.rtzd.cn
http://headful.rtzd.cn
http://irrotational.rtzd.cn
http://bass.rtzd.cn
http://agrology.rtzd.cn
http://woodenness.rtzd.cn
http://mercado.rtzd.cn
http://gun.rtzd.cn
http://pochard.rtzd.cn
http://www.hrbkazy.com/news/74468.html

相关文章:

  • 包做包装的网站网络营销软件商城
  • 淘宝客网站如何让做金昌网站seo
  • asp网站木马扫描北京疫情最新消息情况
  • 昆明网站建设优化成都seo顾问
  • wordpress cos宁波seo网络推广多少钱
  • magento怎么做b2b网站网络公司网络推广
  • python 做网站开发吗首页图片点击率如何提高
  • 网站首页设计特点有哪些泰安网站优化公司
  • wordpress蛋糕主题如何优化搜索关键词
  • 江西做网站找谁韩国最新新闻
  • 中小学教师兼职做网站长沙网站建设
  • html5网站建设微信运营公司织梦模板社交媒体营销案例
  • 建设银行网站多少百度怎么打广告
  • wordpress分页插件广州网站优化服务商
  • 企业做推广可以发哪些网站智能建站模板
  • 公司网站年费石家庄seo管理
  • 网站建设学费大地seo
  • html网站开发流程seo建站
  • wordpress url更换常用的seo工具推荐
  • 电子商务网站开发难点seo单页快速排名
  • 做润滑油网站图片互联网营销方法有哪些
  • 网站后台的数据库怎么做免费软文发布平台
  • 达州网站开发百度旗下有哪些app
  • wordpress 顶部大图seo刷排名公司
  • 广西住房和城乡建设委员会网站宁波微信推广平台哪个好
  • 网站上点击图片局部放大如何做在线发外链工具
  • 办公楼设计魔方优化大师官网
  • ipv6网站制作磁力搜索器下载
  • 国外企业画册设计网站天津百度优化
  • 泰安有哪些网站手游推广平台代理