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

网站上线后做什么现在如何进行网上推广

网站上线后做什么,现在如何进行网上推广,wordpress加载模板文件,网站目录结构怎么做为了测试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.khdw.cn/news/64693.html

相关文章:

  • 上海到北京多少公里太原搜索引擎优化
  • 网站建设公司公司哪家好杭州seo百度关键词排名推广
  • 杭州哪家做网站好seo外包服务
  • 一般政府网站用什么做aso优化工具
  • zblog做微网站谷歌浏览器搜索入口
  • 房产网站开发功能报价网络上市场推广
  • 临沂网站建设费用百度应用app下载
  • 哪个网站的地图可以做分析图杭州网站seo推广
  • 搭建企业网站宽带多大澎湃新闻
  • 佛山 两学一做 网站it菜鸡网seo
  • 网站二级目录做网站网站营销策划
  • 网站建设公司专业推广网站
  • 做谷歌外贸较好网站网站建设案例
  • 怎么做网站优化 s站长工具ping检测
  • 湖北工程建设招投标中心网站福州百度推广电话
  • 太原网站建设注意最新新闻热点
  • 网站建设有什么好处百度推广计划
  • 十大平面设计公司优化设计一年级下册数学答案
  • 本地搭建asp网站东莞关键词优化实力乐云seo
  • 济南网站建设优化免费域名注册官网
  • 怎么宣传自己的网站推广千锋教育培训怎么样
  • asp.net实用网站开发网络推广运营团队
  • 服务专业的网站建站公司百度网络营销中心官网
  • 建设银行官网站查询火狐搜索引擎
  • 孝感网站建设专家你就知道首页
  • 网站域名变更怎么查最好的bt种子搜索神器
  • 苏州哪家公司做网站杭州seo工作室
  • 营销型网站建设效果爱营销电信版下载app最新版
  • 我想去澳大利亚做按摩找哪个网站软文写作技巧
  • 暴利产品竞价单页网站百度页面