LoginSignup
3
5

More than 5 years have passed since last update.

CUDAのための時間計測の簡素化

Last updated at Posted at 2016-10-15

Abstract

CUDAはNVIDIAのGPUのための統合開発環境である.

cudaAPIの時間計測にはcudaEventを用いるがcudaEventCreate()やcudaEventSynchronize()、cudaEventElapsedTime()を使ったりしてるうちにProgramが雑多となるので, プログラム簡素化のために時間計測のためのクラスを作成した.

Source Code

git clone https://github.com/hurou927/cuda_get_time.git

Usage

// some headers
#include "my_cuda_get_time.cuh"

int main(){

 cudatimeStamp cutime(5);//最大5回のタイムスタンプ取得可能
 //cudatimeStamp cutime; //デフォルト=10回分のタイムスタンプ取得可能

 cutime.stamp(); // 0回目 タイムスタンプ
 // cudaCode 0
 cutime.stamp(); // 1回目 タイムスタンプ
 // cudaCode 1
 cutime.stamp(); // 2回目 タイムスタンプ


 cutime.print(); //全スタンプ間である2回分(0-1,1-2)の時間を出力
 printf("%f,ms\n",cutime.interval(0,1));//0-1回目の時間を出力
 return 0;
}
3
5
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5