-
Notifications
You must be signed in to change notification settings - Fork 2
/
data.h
60 lines (46 loc) · 1.21 KB
/
data.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
#ifndef DATA_H
#define DATA_H
#include <omp.h>
#include "constant.h"
typedef struct
{
volatile int stage __attribute__((aligned(64)));
omp_lock_t lock __attribute__((aligned(64)));
int start, end, tid, pid;
} block_t;
#define POSITION(i,j) ((i) + mSize * (j))
#define array_OFFSET(i,j) (POSITION (i,j) * sizeof(double))
#define source_array_ELEM(i,j) ((double *)source_array)[POSITION (i,j)]
#define work_array_ELEM(i,j) ((double *)work_array)[POSITION (i,j)]
#define target_array_ELEM(i,j) ((double *)target_array)[POSITION (i,j)]
void data_init(block_t *block
, int *block_num
, int tSize
, int mSize
);
void data_init_tlocal(int mStart
, int mStop
, block_t *block
, int block_num
, int *tStart
, int *tStop
, int tid
, double* source_array
, double* work_array
, double* target_array
,int mSize
);
void data_compute(int mStart
, int mStop
, block_t *block
, int i
, double* work_array
, double* target_array
, int mSize
);
void data_validate(int mSize
, int mStart
, double* target_array
);
void sort_median(double *begin, double *end);
#endif