forked from cs5220-f24/matmul-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (55 loc) · 1.62 KB
/
Makefile
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
# ---
# Platform-dependent configuration
#
# If you have multiple platform-dependent configuration options that you want
# to play with, you can put them in an appropriately-named Makefile.in.
# For example, the default setup has a Makefile.in.icc and Makefile.in.gcc.
PLATFORM=gcc
include Makefile.in.$(PLATFORM)
DRIVERS=$(addprefix matmul-,$(BUILDS))
TIMINGS=$(addsuffix .csv,$(addprefix timing-,$(BUILDS)))
.PHONY: all
all: $(DRIVERS)
# ---
# Rules to build the drivers
matmul-%: $(OBJS) dgemm_%.o
$(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
matmul-f2c: $(OBJS) dgemm_f2c.o dgemm_f2c_desc.o fdgemm.o
$(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
matmul-blas: $(OBJS) dgemm_blas.o
$(LD) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBBLAS)
matmul-mkl: $(OBJS) dgemm_mkl.o
$(LD) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBMKL)
matmul-veclib: $(OBJS) dgemm_veclib.o
$(LD) -o $@ $^ $(LDFLAGS) $(LIBS) -framework Accelerate
# --
# Rules to build object files
matmul.o: matmul.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $<
%.o: %.c
$(CC) -c $(CFLAGS) $(OPTFLAGS) $(CPPFLAGS) $<
%.o: %.f
$(FC) -c $(FFLAGS) $(OPTFLAGS) $<
dgemm_blas.o: dgemm_blas.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCBLAS) $<
dgemm_mkl.o: dgemm_blas.c
$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $(INCMKL) $<
dgemm_veclib.o: dgemm_blas.c
clang -o $@ -c $(CFLAGS) $(CPPFLAGS) -DOSX_ACCELERATE $<
# ---
# Rules for building timing CSV outputs
.PHONY: run
run: $(TIMINGS)
timing-%.csv: matmul-%
OPENMP_NUM_THREADS=1 ./matmul-$*
# ---
# Rules for plotting
.PHONY: plot
plot:
$(PYTHON) plotter.py $(BUILDS)
# ---
.PHONY: clean realclean
clean:
rm -f matmul-* *.o
realclean: clean
rm -f *~ timing-*.csv timing.pdf