Joseph Redmon
2016-06-08 7520949d84bb410ebc22dece85181d725e03727a
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
#ifndef AI2_COMMON_H 
#define AI2_COMMON_H
 
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
#include <limits.h>
#include <tgmath.h>
#include <unistd.h>
#include <stdint.h>
//#include <gperftools/profiler.h>
#include <sys/time.h>
 
typedef uint32_t BINARY_WORD;
#define BITS_PER_BINARY_WORD (sizeof(BINARY_WORD) * CHAR_BIT)
 
typedef struct{
    struct timespec requestStart;
    struct timespec requestEnd;
} Timer;
 
typedef struct {
    size_t x;
    size_t y;
    size_t z;
} dim3;
 
typedef struct {
    dim3 weights;
    dim3 input;
    dim3 output;
    dim3 alpha_plane;
    dim3 beta_plane;
    dim3 gamma_plane;
    dim3 zeta_plane;
} ConvolutionArgs;
 
// Timer stuff
double getElapsedTime(Timer *timer); // Returns the time in ms
void start_timer(Timer *timer);
void stop_timer(Timer *timer);
 
BINARY_WORD * mallocBinaryVolume(dim3 vol);
float * mallocFloatVolume(dim3 vol);
ConvolutionArgs initArgs(size_t ix, size_t iy, size_t iz, size_t wx, size_t wy, size_t wz);
double getSizeBytesBinaryArray(dim3 conv_args);
 
#endif