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

服务器租用多少钱免费seo网站推荐一下

服务器租用多少钱,免费seo网站推荐一下,免费下载网站设计方案,服装商店的网站建设要求为了测试GPU函数的耗时,可以使用 CUDA 提供的计时功能:cudaEventCreate, cudaEventRecord, 和 cudaEventElapsedTime。这些函数可以帮助你测量某个 CUDA 操作(如设置设备)所花费的时间。 一、记录耗时案例 以下是一个示例程序&a…

为了测试GPU函数的耗时,可以使用 CUDA 提供的计时功能:cudaEventCreate, cudaEventRecord, 和 cudaEventElapsedTime。这些函数可以帮助你测量某个 CUDA 操作(如设置设备)所花费的时间。

一、记录耗时案例

以下是一个示例程序,它测量调用 cudaSetDevice 所花费的时间:

#include <iostream>
#include <vector>
#include <cuda_runtime.h>__global__ void dummyKernel() {// Dummy kernel to ensure CUDA context is initialized
}int main() {// CUDA device IDsint device1 = 0;int numIterations = 10; // Number of times to call cudaSetDevice// Create CUDA eventscudaEvent_t start, stop;cudaEventCreate(&start);cudaEventCreate(&stop);// Vector to store elapsed timesstd::vector<float> elapsedTimes(numIterations);// Set initial device (optional, but ensures a known starting state)cudaSetDevice(device1);// Measure time for multiple cudaSetDevice callsfor (int i = 0; i < numIterations; ++i) {// Record the start eventcudaEventRecord(start, 0);// Set the device (this is the operation we are timing)cudaSetDevice(device1);// Record the stop eventcudaEventRecord(stop, 0);// Measure the elapsed time between the start and stop eventscudaEventElapsedTime(&elapsedTimes[i], start, stop);// Output resultsstd::cout << "Number of iterations: i " << i << std::endl;std::cout << " time to set device " << device1 << ": " << elapsedTimes[i] << " ms" << std::endl;}// Calculate statistics (e.g., average time)float totalTime = 0.0f;for (float time : elapsedTimes) {totalTime += time;}float averageTime = totalTime / numIterations;// Output resultsstd::cout << "Number of iterations: " << numIterations << std::endl;std::cout << "Average time to set device " << device1 << ": " << averageTime << " ms" << std::endl;// Optionally, run a dummy kernel to ensure CUDA is initialized and readydummyKernel<<<1, 1>>>();cudaDeviceSynchronize();// Clean upcudaEventDestroy(start);cudaEventDestroy(stop);return 0;
}

二、编译和运行

         2.1 编译: 使用 nvcc 编译这个 CUDA 程序。(上面程序文件铭为test_cudaSetDevice_multiple.cu)

nvcc -o test_cudaSetDevice_multiple test_cudaSetDevice_multiple.cu

        2.2 运行: ,然后运行生成的可执行文件。

./test_cudaSetDevice_multiple

哈哈哈,就得到运行结果啦! 

http://www.yayakq.cn/news/988980/

相关文章:

  • 辽宁省建设监理协会网站网站销户说明
  • 响应式网站怎么改做网站笔记本
  • 西安房产网站建设个人网站每年要多少钱
  • 英文网站建设解决方案电子杂志制作app
  • 增城商城网站建设网页关键词优化难度
  • 电子商务网页设计与网站建设论文网站开发企业开发
  • 企业品牌网站开发制作合同北京十大装饰公司排名有哪些
  • 网站建设后期出现的问题优质网站有哪些
  • 做二手货车网站网站名 注册
  • 企业自助建站程序前端素材网站
  • 外贸管理网站模板教务管理系统论文
  • 做文化建设的网站响应式高端网站
  • 本溪网站开发公司电话iis配置网站开发环境
  • 货运网站建设公司企业公示信息
  • 微信小程序可以做电影网站吗黄村网站建设费用
  • 手机链接ppt在哪个网站做icp备案查询系统官网
  • 长沙影楼网站建设合肥网站建设创优
  • 建设网站制作汉狮团队商城网站建设软件
  • 交互网站怎么做的站群网站程序
  • 有没有专门做商铺招商的网站天宁网站建设
  • 卫生局网站建设wifi小程序源码
  • 长沙企业建网站费用北京专业网站的建设
  • 室内设计自学网站网站建设电话咨询
  • 电子商务网站进度的基本流程wordpress 腾讯云
  • 网站转化率是什么意思做球迷网站
  • 腾讯云服务器怎么搭建网站炫酷的网页特效
  • 做产品网站营销推广广告营销公司
  • 互联网网站开发有哪些职位网站的页面布局
  • 五核网站建设基础建设基金有哪些
  • 西三旗网站建设qq邮箱在线登录网页版