-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile2_PLOCKS
77 lines (53 loc) · 3.48 KB
/
Makefile2_PLOCKS
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
BUILD_DIR := build_plocks
CC := $(CXX) #g++
LD := $(CXX) #g++
#ADEPT_INCLUDE := -I./adept-serial/include
ADEPT_INCLUDE := -I./cilk-adept/include -I./
CSI_RT_PATH=/efs/tools/opencilk2/llvm/lib/clang/9.0.1/lib/linux/libclang_rt.csi-x86_64.a
# Use the 'aftertapirloops' for divide and conquer loop representation of parallel_for.
CSIFLAGS_OPT := -fcsi=aftertapirloops
# The CSI flags need to be in the cflags of any binary that has parallel control flow that performs
# Adept operations.
#CSIFLAGS += -gdwarf-3 $(CSIFLAGS_OPT) -mllvm -csi-instrument-basic-blocks=false -mllvm -csi-instrument-memory-accesses=false -mllvm -csi-instrument-atomics=false -mllvm -csi-instrument-memintrinsics=false -mllvm -csi-instrument-allocfn=false -mllvm -csi-instrument-alloca=false -mllvm -csi-instrument-func-entry-exit=false -mllvm -csi-instrument-function-calls=false -mllvm -csi-interpose=false -mllvm -csi-instrument-loops=false -mllvm -csi-instrument-arithmetic=none
CSIFLAGS += -gdwarf-3 $(CSIFLAGS_OPT) -mllvm -csi-instrument-basic-blocks=false -mllvm -csi-instrument-memory-accesses=false -mllvm -csi-instrument-atomics=false -mllvm -csi-instrument-memintrinsics=false -mllvm -csi-instrument-allocfn=false -mllvm -csi-instrument-alloca=false -mllvm -csi-instrument-func-entry-exit=false -mllvm -csi-instrument-function-calls=false -mllvm -csi-interpose=false -mllvm -csi-instrument-loops=false
# Regular CFLAGS plus a few extra defined values for adept.
CFLAGS += -gdwarf-3 -std=c++11 -stdlib=libstdc++ $(EXTRA_CFLAGS) -m64 -march=native -pthread $(ADEPT_INCLUDE) -DADEPT_STACK_THREAD_SAFE -DADEPT_STORAGE_THREAD_SAFE -DADEPT_RECORDING_PAUSABLE -DTFK_ONE_THREAD -DTFK_SPEC_OPT -DTFK_USE_LOCKS
LDFLAGS = -ldl $(EXTRA_LDFLAGS) -O3 -lcilkrts -lprofiler -lpthread -lblas
# Disable LTO in order to get more readily debuggable code.
#CFLAGS += -flto -O3 -gdwarf-3
#LDFLAGS += -flto -O3 -fuse-ld=gold -gdwarf-3
CFLAGS += -O3 -gdwarf-3 -flto=full
LDFLAGS += -O3 -flto=full -fuse-ld=lld -Xlinker --export-dynamic -Xlinker --gdb-index
ifdef DEBUG
CFLAGS += -DDEBUG -O0 -gdwarf-3 -fcilkplus
else
CFLAGS += -DNDEBUG
CFLAGS += -O3 -gdwarf-3 -mavx2 -m64 -march=native -fcilkplus
endif
.PHONY: all clean
BINS := run_plocks
all: $(BINS)
$(BUILD_DIR)/sp_tree.o: parad/sp_tree.cpp parad/sp_tree.h
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(BUILD_DIR)/rad_algs.o: parad/rad_algs.cpp parad/rad_algs.h
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
#$(BUILD_DIR)/tfkparallel.o: parad/tfkparallel.cpp parad/tfkparallel.h
# $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
#$(BUILD_DIR)/main.ll: main.cpp $(BUILD_DIR)/tool.bc
# $(CC) $(CFLAGS) -gdwarf-3 -fcsi -S -emit-llvm -ftapir=none $(DEFINES) -c -o $@ $<
$(BUILD_DIR)/main.o: main.cpp $(BUILD_DIR)/sp_tree.o $(BUILD_DIR)/tool.o
$(CC) $(CFLAGS) $(CSIFLAGS) $(DEFINES) -c -o $@ $<
$(BUILD_DIR)/Graph.o: Graph.cpp Graph.hpp
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(BUILD_DIR)/optimization.o: optimization.cpp optimization.hpp
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(BUILD_DIR)/activations.o: activations.cpp activations.hpp
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(BUILD_DIR)/tool.bc: tool.cpp
$(CC) $(CFLAGS) $(DEFINES) -c -emit-llvm -o $@ $<
$(BUILD_DIR)/tool.o: tool.cpp $(BUILD_DIR)/tool.bc
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
run_plocks: $(BUILD_DIR)/main.o $(BUILD_DIR)/optimization.o $(BUILD_DIR)/activations.o $(BUILD_DIR)/Graph.o $(BUILD_DIR)/tool.o $(BUILD_DIR)/sp_tree.o $(BUILD_DIR)/rad_algs.o $(CSI_RT_PATH)
$(LD) -v -o $@ $^ $(LDFLAGS)
clean:
rm -f $(BINS) $(BUILD_DIR)/*.o $(BUILD_DIR)/*.bc $(BUILD_DIR)/*.ll