cuda编程中需要用到的部分常用的函数
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
590 B

#ifndef __UTILS__
#define __UTILS__
#include <iostream>
#include <chrono>
namespace utils{
class hdTimer{
public:
hdTimer(){
}
void tik(){
start = std::chrono::high_resolution_clock::now();
}
void tok(){
end = std::chrono::high_resolution_clock::now();
}
double cost(){
return double( std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count())/1000000000.0;
}
private:
std::chrono::time_point<std::chrono::steady_clock> start,end;
};
}
#endif