-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
30 lines (26 loc) · 806 Bytes
/
Copy pathutils.h
File metadata and controls
30 lines (26 loc) · 806 Bytes
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
27
28
29
30
#include <chrono>
#include <cstdlib>
#include <cuda.h>
#include <iostream>
#include <nlohmann/json.hpp>
#include <tuple>
using namespace std;
using json = nlohmann::json;
tuple<CUcontext, CUstream_st *> setup_cuda();
CUdeviceptr make_data(size_t size);
void deepcopyCUdeviceptr(CUdeviceptr src, CUdeviceptr *dst, size_t size);
void cleanup(CUcontext context, CUstream_st *stream, CUdeviceptr d_X);
struct test_result {
std::chrono::duration<double> duration;
int nreps;
int grid_size;
int block_size;
json to_json() const {
return json{{"block_size", block_size},
{"grid_size", grid_size},
{"nreps", nreps},
{"duration",
std::chrono::duration_cast<std::chrono::nanoseconds>(duration)
.count()}};
}
};