//#include <iostream>
//#include "device_launch_parameters.h"
//#include "cuda_runtime.h"
//#include <ctime>
//
//clock_t start, end;
//
//__global__ void HelloFromGPU(void)
//{
// printf("Hello World From GPU!\n");
//}
//
//int main(void)
//{
// start = clock();
// //printf("Hello World From GPU!\n");
//
// HelloFromGPU << <1, 1000 >> > ();
// end = clock();
//
// cudaDeviceReset();
// std::cout << "耗时:" << ((double)end - (double)start) / CLOCKS_PER_SEC << "秒" << std::endl;
//
// return 0;
//}
//#include<iostream>
//#include <ctime>
//using namespace std;
//clock_t start, end1;
//void HelloFromGPU(void)
//{
// printf("Hello World From GPU!\n");
//}
//int main()
//{
// start = clock();
// for (int i = 0; i < 1000; ++i)
// {
// HelloFromGPU();
// }
//
// end1 = clock();
// std::cout << "耗时:" << ((double)end1 - (double)start) / CLOCKS_PER_SEC << "秒" << std::endl;
// return 0;
//}
C++/CUDA编程
最新推荐文章于 2025-06-18 15:30:00 发布