-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.cuh
37 lines (26 loc) · 935 Bytes
/
utils.cuh
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
31
32
33
34
35
36
37
#ifndef UTILS_CUH
#define UTILS_CUH
#include <vector>
#include <cstdint>
struct DeviceBool {
bool *device_data;
bool *host_data;
DeviceBool(bool initial);
DeviceBool();
~DeviceBool();
void set_value(bool val);
bool get_value();
};
struct VirtualCSR {
std::vector<uint32_t> vmap;
std::vector<uint32_t> vptrs;
std::vector<uint32_t> adjs;
VirtualCSR() = delete;
VirtualCSR(const std::vector<std::pair<uint32_t, uint32_t>> &edges, uint32_t mdeg);
};
uint32_t num_verts(const std::vector<std::pair<uint32_t, uint32_t>> &edges);
// Helper function which converts graph into adjacency lists representation.
static std::vector<std::vector<uint32_t>> adjacency_lists(const std::vector<std::pair<uint32_t, uint32_t>> &edges);
// Returns grid_size based on the overall required number of threads and block size.
uint32_t grid_size(uint32_t min_threads_count, uint32_t block_size);
#endif