-
Notifications
You must be signed in to change notification settings - Fork 3
/
bench.h
26 lines (20 loc) · 833 Bytes
/
bench.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef __BENCHMARK_H__
#define __BENCHMARK_H__
#include <cuda.h>
#include "buffer.h"
#include "stream.h"
#include "timer.h"
// Specify a memory transfer
struct TransferSpec
{
int device; // the CUDA device to transfer to or from
BufferPtr deviceBuffer; // memory buffer on the device
BufferPtr hostBuffer; // memory buffer on the host
size_t length; // the transfer size
cudaMemcpyKind direction; // the transfer direction (HtoD or DtoH)
StreamPtr stream; // the stream to use for the stransfer
TimerPtr timer; // timer data to record how long the transfer took
};
// Run a simple bandwidth test using cudaMemcpyAsync()
void runBandwidthTest(const std::vector<TransferSpec>& transferSpecifications);
#endif