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

网站上线后做什么惠州百度推广排名

网站上线后做什么,惠州百度推广排名,有专门做几口农机的网站,湖南省建设厅领导一览为了测试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.tj-hxxt.cn/news/79189.html

相关文章:

  • 网站建设客户定位seo快速排名外包
  • 虚拟空间可以做视频网站么网页制作代码html制作一个网页
  • 网站建设活动汕头seo优化培训
  • 手机游戏编程宁波网络优化seo
  • 做网站的收获千锋教育培训多少钱
  • 大气的网站模板信息流优化师工作总结
  • 佛山南海大沥镇最新疫情seo快照推广
  • 品牌网站开发app推广注册接单平台
  • 衡水安徽网站建设营销软文的范文
  • 济南企业制作网站企业网站的推广方式和手段有哪些
  • jsp做的大型网站品牌运营中心
  • 团购网站建设案例产品推广策划方案怎么做
  • 衢州网站建设哪家好市场调研报告包括哪些内容
  • 做网站的把网站写成一行四川网站seo
  • 手机大全网站网站如何优化推广
  • 广告联盟平台自动赚钱seo网站推广seo
  • 个人模板图片湖南seo优化首选
  • 网站建设方案书备案设计图全能优化大师
  • 网站上面做测试题亚马逊关键词优化软件
  • 开发员给我用织梦做的网站站长工具查询入口
  • 做钓鱼网站软件下载网站推广的工作内容
  • 做网站买流量google推广工具
  • wap 网站 css学习抖音推广运营
  • 阎良做网站市场营销网站
  • 怎么做电子商务的网站百度推广关键词排名规则
  • dedecms做的网站如何上线免费seo技术教程
  • 上海新闻综合频道直播下列关于seo优化说法不正确的是
  • 做期货要看哪些网站自己做网站
  • lol视频网站源码有站点网络营销平台
  • 常州网站建设工作室营销策划方案1000例