-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (77 loc) · 4.25 KB
/
Makefile
File metadata and controls
111 lines (77 loc) · 4.25 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# get arch name
ARCH = $(shell uname -m)
# add Intel specific compiler flags
ifeq ($(ARCH), x86_64)
CFLAGS += -mavx2 -mfma
endif
TARGET = mnist
LIB_OBJS = ann.o tensor.o json.o ann_hypertune.o
LIBANN = libann.a
DEPS = ann.h tensor.h ann_config.h json.h ann_hypertune.h
# use no blas
#CFLAGS += -g -O2
#LFLAGS += -lm
# use cblas (requires C11 atomics)
# CFLAGS += -std=c11 -g -O2 -DUSE_BLAS -DCBLAS -I"/opt/cblas/include"
# LFLAGS += -L"/opt/cblas/lib" -lcblas -lm
# CFLAGS += -std=c11 -g -O2 -DUSE_BLAS -DCBLAS -I.
# LFLAGS += -L. -lcblas
# use openblas
CFLAGS += -g -O2 -DUSE_BLAS -I"/opt/OpenBLAS/include"
LFLAGS += -L/opt/OpenBLAS/lib/ -lopenblas
#-DMKL_ILP64 -m64 -I"${MKLROOT}/include"
#LFLAGS = ${MKLROOT}/lib/libmkl_intel_ilp64.a ${MKLROOT}/lib/libmkl_tbb_thread.a ${MKLROOT}/lib/libmkl_core.a -L${TBBROOT}/lib -ltbb -lc++ -lpthread -lm -ldl
# -DMKL_ILP64 -m64 -I"${MKLROOT}/include"
# ${MKLROOT}/lib/libmkl_intel_ilp64.a ${MKLROOT}/lib/libmkl_tbb_thread.a ${MKLROOT}/lib/libmkl_core.a -L${TBBROOT}/lib -ltbb -lc++ -lpthread -lm -ldl
all: $(LIBANN) mnist mnist_hypertune logic digit5x7 save_test save_test_binary blas_perf test_tensor test_network test_activations test_loss_functions test_save_load test_optimizers test_forward_pass test_training_convergence test_onnx_export test_hypertune test_json
# build the static library
$(LIBANN): $(LIB_OBJS)
$(AR) rcs $@ $^
# build the shared library
LIBANN_SO = libann.so
SHARED_OBJS = ann.pic.o tensor.pic.o json.pic.o ann_hypertune.pic.o
%.pic.o: %.c $(DEPS)
$(CC) -c -fPIC $(CFLAGS) -o $@ $<
shared: $(LIBANN_SO)
$(LIBANN_SO): $(SHARED_OBJS)
$(CC) -shared -o $@ $^ $(LFLAGS)
$(TARGET): $(LIBANN) mnist.o
$(CC) -o $@ mnist.o $(LIBANN) $(LFLAGS)
mnist_hypertune: $(LIBANN) mnist_hypertune.o
$(CC) -o $@ mnist_hypertune.o $(LIBANN) $(LFLAGS)
logic: $(LIBANN) logic.o
$(CC) -o $@ logic.o $(LIBANN) $(LFLAGS)
digit5x7: $(LIBANN) digit5x7.o
$(CC) -o $@ digit5x7.o $(LIBANN) $(LFLAGS)
save_test: $(LIBANN) save_test.o
$(CC) -o $@ save_test.o $(LIBANN) $(LFLAGS)
save_test_binary: $(LIBANN) save_test_binary.o
$(CC) -o $@ save_test_binary.o $(LIBANN) $(LFLAGS)
blas_perf: $(LIBANN) blas_perf.o
$(CC) -o $@ blas_perf.o $(LIBANN) $(LFLAGS)
test_tensor: $(LIBANN) test_tensor.o testy/test_main.o
$(CC) -o $@ test_tensor.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_network: $(LIBANN) test_network.o testy/test_main.o
$(CC) -o $@ test_network.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_activations: $(LIBANN) test_activations.o testy/test_main.o
$(CC) -o $@ test_activations.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_loss_functions: $(LIBANN) test_loss_functions.o testy/test_main.o
$(CC) -o $@ test_loss_functions.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_save_load: $(LIBANN) test_save_load.o testy/test_main.o
$(CC) -o $@ test_save_load.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_optimizers: $(LIBANN) test_optimizers.o testy/test_main.o
$(CC) -o $@ test_optimizers.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_forward_pass: $(LIBANN) test_forward_pass.o testy/test_main.o
$(CC) -o $@ test_forward_pass.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_training_convergence: $(LIBANN) test_training_convergence.o testy/test_main.o
$(CC) -o $@ test_training_convergence.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_onnx_export: $(LIBANN) test_onnx_export.o testy/test_main.o
$(CC) -o $@ test_onnx_export.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_hypertune: $(LIBANN) test_hypertune.o testy/test_main.o
$(CC) -o $@ test_hypertune.o testy/test_main.o $(LIBANN) $(LFLAGS)
test_json: $(LIBANN) test_json.o testy/test_main.o
$(CC) -o $@ test_json.o testy/test_main.o $(LIBANN) $(LFLAGS)
%.o: %.c $(DEPS)
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
clean:
rm -f $(LIBANN) $(LIBANN_SO) $(LIB_OBJS) $(SHARED_OBJS) $(TARGET) logic digit5x7 logic.o digit5x7.o mnist.o save_test.o save_test save_test_binary save_test_binary.o blas_perf blas_perf.o test_tensor test_tensor.o test_network test_network.o test_activations test_activations.o test_loss_functions test_loss_functions.o test_save_load test_save_load.o test_optimizers test_optimizers.o test_forward_pass test_forward_pass.o test_training_convergence test_training_convergence.o test_onnx_export test_onnx_export.o test_hypertune test_hypertune.o test_json test_json.o testy/test_main.o