-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.cuh
57 lines (46 loc) · 978 Bytes
/
types.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef TYPES_CUH
#define TYPES_CUH
#define POPULATION_SIZE 100
#define WIDTH 300
#define HEIGHT 300
#define TOURNAMENT_SIZE 5
#define MUTATION_RATE 0.3
#define EPOCHS 1000
#define MAX_POINTS 8
#define MAX_POLYGONS 20
struct Image {
unsigned char* data;
int width;
int height;
int channels;
};
struct Color {
float r, g, b, a;
};
struct Point {
unsigned int x, y;
};
struct Line {
Point p1, p2;
};
struct Polygon {
Color color;
Point points[MAX_POINTS];
Line lines[MAX_POINTS];
int num_points;
};
struct InitialImage {
Color background;
Polygon polygons[MAX_POLYGONS];
int num_polygons;
};
#define CUDA_CHECK(call) \
do { \
cudaError_t error = call; \
if (error != cudaSuccess) { \
fprintf(stderr, "CUDA error at %s:%d: %s\n", __FILE__, __LINE__, \
cudaGetErrorString(error)); \
exit(EXIT_FAILURE); \
} \
} while(0)
#endif // TYPES_CUH