forked from max2ma/k-nearest-neighbors_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (55 loc) · 2.37 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
ifndef XILINX_SDACCEL
$(error Environment variable XILINX_SDACCEL is required and should point to SDAccel install area)
endif
SDA_FLOW = hw_emu
HOST_SRCS = main_cl.cpp
HOST_EXE_DIR=.
HOST_EXE = main_ex
HOST_CFLAGS = -g -Wall -I${XILINX_SDACCEL}/runtime/include/1_2
HOST_LFLAGS = -L${XILINX_SDACCEL}/runtime/lib/x86_64 -lxilinxopencl -llmx6.0
KERNEL_DEFS =
KERNEL_INCS =
#set target device for XCLBIN
XDEVICE=xilinx:adm-pcie-7v3:1ddr:3.0
XDEVICE_REPO_PATH=
KEEP_TEMP=1
KERNEL_DEBUG=
XCLBIN_NAME=bin_mmult
HOST_CFLAGS+=-DTARGET_DEVICE=\"${XDEVICE}\"
#BOARD_SETUP_FILE needs to point to setup.sh generated by xbinst command
BOARD_SETUP_FILE=setup.sh
include ~/WORKSPACE/SDAccel/common.mk
HOST_ARGS = -n 128 -b $(BINARY_CONTAINERS) -f /home/liang/WORKSPACE/SDAccel/KNN/data/filelist.txt
CLCC_OPTS = -t $(SDA_FLOW) --save-temps --report estimate $(CLCC_OPT_LEVEL) ${DEVICE_REPO_OPT} --xdevice ${XDEVICE} ${KERNEL_DEFS} ${KERNEL_INCS}
BINARY_NAME = kNN
BUILD_SUBDIRS += bin_$(BINARY_NAME)_$(SDA_FLOW)
SOLUTION_NAME=_xocc_link_$(BUILD_SUBDIRS)
KERNEL_SOURCE1 = distance_calc.cpp
KERNEL_NAME1 = distance_calc
COMPUTE_UINT1 = 1
SOLUTION_NAME1 =_xocc_compile_$(BUILD_SUBDIRS)_$(KERNEL_NAME1)
KERNEL_SOURCE2 = nearestNeighbor.cpp
KERNEL_NAME2 = nearestNeighbor
COMPUTE_UINT2 = 1
SOLUTION_NAME2 =_xocc_compile_$(BUILD_SUBDIRS)_$(KERNEL_NAME2)
BINARY_CONTAINERS += $(BUILD_SUBDIRS).xclbin
BIN_KERNEL_HW_EMU_OBJS += $(BUILD_SUBDIRS)/$(KERNEL_NAME1).xo
BIN_KERNEL_HW_EMU_OBJS += $(BUILD_SUBDIRS)/$(KERNEL_NAME2).xo
ALL_KERNEL_OBJS += $(BIN_KERNEL_HW_EMU_OBJS)
$(BUILD_SUBDIRS)/$(KERNEL_NAME1).xo: $(KERNEL_SOURCE1)
@mkdir -p $(@D)
-@$(RM) $@
$(CLCC) $(CLCC_OPTS) -c -k $(KERNEL_NAME1) -I$(<D) --xp misc:solution_name=$(SOLUTION_NAME1) -o"$@" "$<"
$(BUILD_SUBDIRS)/$(KERNEL_NAME2).xo: $(KERNEL_SOURCE2)
@mkdir -p $(@D)
-@$(RM) $@
$(CLCC) $(CLCC_OPTS) -c -k $(KERNEL_NAME2) -I$(<D) --xp misc:solution_name=$(SOLUTION_NAME2) -o"$@" "$<"
$(BINARY_CONTAINERS): $(BIN_KERNEL_HW_EMU_OBJS)
$(CLCC) $(CLCC_OPTS) -l --nk $(KERNEL_NAME1):$(COMPUTE_UINT1) --nk $(KERNEL_NAME2):$(COMPUTE_UINT2) --xp misc:solution_name=$(SOLUTION_NAME) -o"$@" $(+)
run: host $(BINARY_CONTAINERS)
XCL_EMULATION_MODE=true ${HOST_EXE_DIR}/${HOST_EXE} ${HOST_ARGS}
clean:
-$(RM) $(BINARY_CONTAINERS) $(ALL_KERNAL_OBJS) $(ALL_MESSAGE_FILES) $(EMCONFIG_FILE) $(HOST_EXE) $(HOST_OBJECTS)
-$(RMDIR) $(BUILD_SUBDIRS)
-$(RM) -r _xocc*
-$(RM) -r .Xil