-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomm.h
executable file
·68 lines (54 loc) · 1.37 KB
/
comm.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef COMM_HEADER
#define COMM_HEADER
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
//--------------------------
//typedef unsigned long int index_t;
//typedef unsigned int vertex_t;
typedef long int index_t;
typedef int vertex_t;
//--------------------------------
#define PART_PER_GPU 1//fixed in this version
#define BufferSize 16777216 //16M edges, or 64MB*2 for edge buffer
#define GPU_NUM 1
#define PART_NUM 1
#define DEV_NUM GPU_NUM//(GPU_NUM+1) if enable CPU
#define GPU_PER_PART 1
inline off_t fsize(const char *filename) {
struct stat st;
if (stat(filename, &st) == 0){
return st.st_size;
}
return -1;
}
static void HandleError( cudaError_t err,
const char *file,
int line ) {
if (err != cudaSuccess) {
printf( "%s in %s at line %d\n", \
cudaGetErrorString( err ),
file, line );
exit( EXIT_FAILURE );
}
}
#define H_ERR( err ) \
(HandleError( err, __FILE__, __LINE__ ))
typedef struct EDGE{
vertex_t A;
vertex_t B;
} Edge;
typedef struct GPUData{
int id;
int partition_id;
int currentBuffer;
vertex_t * adj;
index_t * begin;
index_t * count;
Edge **EdgeBuffer;
} GPU_data;
#endif