Makefile 6.65 KB
Newer Older
lvs's avatar
lvs committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
COMMON_REPO := ../common_xilinx/

#Common Includes
include $(COMMON_REPO)/utility/boards.mk
include $(COMMON_REPO)/libs/xcl2/xcl2.mk
include $(COMMON_REPO)/libs/opencl/opencl.mk






# Host Application

#helloworld_SRCS=./src/host.cpp $(oclHelper_SRCS) $(xcl2_SRCS)
#helloworld_HDRS=$(xcl2_HDRS)

lvs's avatar
lvs committed
18
19
20
21
22
23
24
25
#helloworld_SRCS=$(wildcard ../common/src/AOCLUtils/*.cpp wrapcl/src/*.cpp host/src/*.cpp) \
#		$(oclHelper_SRCS) \
#		$(xcl2_SRCS)

#helloworld_HDRS=$(wildcard ./host/inc/*.h) \
#		$(xcl2_HDRS)

hostbin_SRCS=$(wildcard ../common/src/AOCLUtils/*.cpp wrapcl/src/*.cpp host/src/*.cpp) \
lvs's avatar
lvs committed
26
27
28
		$(oclHelper_SRCS) \
		$(xcl2_SRCS)

lvs's avatar
lvs committed
29
hostbin_HDRS=$(wildcard ./host/inc/*.h) \
lvs's avatar
lvs committed
30
31
32
33
34
		$(xcl2_HDRS)

# -U__STRICT_ANSI__: to avoid: ‘cl_float3 {aka union cl_float4}’ has no member named ‘y’


lvs's avatar
lvs committed
35
36
37
38
39
40
41
42
43
44
45
46
#helloworld_CXXFLAGS=-I../common/inc/ \
#		    -I./host/inc/ \
#		    -I. \
#		    -I./wrapcl/inc/ \
#		    $(opencl_CXXFLAGS) $(xcl2_CXXFLAGS) $(oclHelper_CXXFLAGS) \
#		    -std=c++0x \
#		    -U__STRICT_ANSI__ \
#		    $(ENABLE_KERNELS) \
#		    $(REP) \
#		    $(FIPO_FLAG)

hostbin_CXXFLAGS=-I../common/inc/ \
lvs's avatar
lvs committed
47
48
49
50
51
52
53
54
55
56
		    -I./host/inc/ \
		    -I. \
		    -I./wrapcl/inc/ \
		    $(opencl_CXXFLAGS) $(xcl2_CXXFLAGS) $(oclHelper_CXXFLAGS) \
		    -std=c++0x \
		    -U__STRICT_ANSI__ \
		    $(ENABLE_KERNELS) \
		    $(REP) \
		    $(FIPO_FLAG)
		    
lvs's avatar
lvs committed
57
#helloworld_LDFLAGS=$(opencl_LDFLAGS)
Leonardo Solis's avatar
Leonardo Solis committed
58
59
#hostbin_LDFLAGS=$(opencl_LDFLAGS)
hostbin_LDFLAGS=$(opencl_LDFLAGS) -lrt
lvs's avatar
lvs committed
60

lvs's avatar
lvs committed
61
62
#EXES=helloworld
EXES=hostbin
lvs's avatar
lvs committed
63
64
65

# Kernel
#vector_addition_SRCS=./src/vector_addition.cl
lvs's avatar
lvs committed
66
67
#vector_addition_SRCS=./device/Krnl_GA.cl
Krnl_GA_SRCS=./device/Krnl_GA.cl
lvs's avatar
lvs committed
68

lvs's avatar
lvs committed
69
70
#XOS=vector_addition
XOS=Krnl_GA
lvs's avatar
lvs committed
71

lvs's avatar
lvs committed
72
73
#vector_addition_XOS=vector_addition
Krnl_GA_XOS=Krnl_GA
lvs's avatar
lvs committed
74

lvs's avatar
lvs committed
75
76
#XCLBINS=vector_addition
XCLBINS=Krnl_GA
lvs's avatar
lvs committed
77
78

# check
lvs's avatar
lvs committed
79
80
81
82
#check_EXE=helloworld
check_EXE=hostbin
#check_XCLBINS=vector_addition
check_XCLBINS=Krnl_GA
lvs's avatar
lvs committed
83
84
85
86

CHECKS=check

include $(COMMON_REPO)/utility/rules.mk
lvs's avatar
lvs committed
87

88
89
90
91
92
93
94
95
# Note that the definition of "newline" contains two blank lines.
# Using $(newline) will expand into only one newline.
define newline


endef


96
97
98
99
100
101
# Docking parameters 
# that directly determine the execution time
# Following values are used only for emulation
# to have a short but still a representative test
PDB  := 1stp
NRUN := 5
102
NEV  := 800000 
103

104
105
106
107
108
109
110
# Switching to the other SDAccel 2017.4 default platform
# As it is available in Xelera "saruman" server
#DEVICES:= xilinx:kcu1500:dynamic (in ../common_xilinx/utility/boards.mk)
#BOARD:= xilinx:kcu1500:dynamic
BOARD:= xilinx:vcu1525:dynamic
NDEVICES_EMU:=1

111
112
113
114
# Compile and generate report
kerrpt-sw:
	make clean
	@echo $(newline)
115
	make all REPORT=estimate TARGETS=sw_emu DEVICES=$(BOARD)
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	@echo $(newline)
	cp ./xclbin/$(XCLBINS).sw_emu.*.xclbin .
	@echo $(newline)
	mv ./$(XCLBINS).sw_emu.*.xclbin ./$(XCLBINS).xclbin
	@echo $(newline)
	@echo "==========================================================================="
	@echo "INFO: sw emulation file created under: ./xclbin/$(XCLBINS).sw_emu.*.xclbin "
	@echo "INFO: ... was copied and renamed as ./$(XCLBINS).xclbin                    "
	@echo $(newline)
	@echo "INFO: a ./system_estimate.xtxt report was generated!                       "
	@echo "==========================================================================="
	@echo $(newline)

# Compile for sw and hw emulation
130
kerswemu:
131
	make all TARGETS=sw_emu DEVICES=$(BOARD)
132
133
	cp ./xclbin/$(XCLBINS).sw_emu.*.xclbin .
	mv ./$(XCLBINS).sw_emu.*.xclbin ./$(XCLBINS).xclbin
134
135
136
137
138
139
	@echo $(newline)
	@echo "==========================================================================="
	@echo "INFO: sw emulation file created under: ./xclbin/$(XCLBINS).sw_emu.*.xclbin "
	@echo "INFO: ... was copied and renamed as ./$(XCLBINS).xclbin    	          "
	@echo "==========================================================================="
	@echo $(newline)
140
141

kerhwemu:
142
	make all TARGETS=hw_emu	DEVICES=$(BOARD)
143
144
145
146
147
148
149
150
	cp ./xclbin/$(XCLBINS).hw_emu.*.xclbin .
	mv ./$(XCLBINS).hw_emu.*.xclbin ./$(XCLBINS).xclbin
	@echo $(newline)
	@echo "==========================================================================="
	@echo "INFO: hw emulation file created under: ./xclbin/$(XCLBINS).hw_emu.*.xclbin "
	@echo "INFO: ... was copied and renamed as ./$(XCLBINS).xclbin    	          "
	@echo "==========================================================================="
	@echo $(newline)
151

152
153
154
# Run emulation
# Compilation (host & device) if not done previously
# The .dlg file is written in ./
lvs's avatar
lvs committed
155
# "exe" and "xclbin" are rules from "rules.mk"
156
157
# SDAccel 2017.4: User Guide UG1023, "Running Software and Hardware Emulation in XOCC Flow"
#emconfigutil --platform xilinx_vcu1525_dynamic_5_0 --nd 1
158
swemu: kerswemu
159
	emconfigutil --platform $(BOARD) --nd $(NDEVICES_EMU)
160
	XCL_EMULATION_MODE=sw_emu ./$(EXES) -ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld -lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt -nev $(NEV) -nrun $(NRUN)  -gfpop 1
161
162
163
164
165
166
167
168
169
170
171
172
173
174
	@echo $(newline)
	@echo "========================================================================="
	@echo "INFO: swemu log file is under: ./docking.dlg "
	@echo $(newline)
	@echo "INFO: profile and timeline trace report files are formatted for SDx GUI "
	@echo "INFO: ... if reports not generated, verify that sdaccel.ini exists!"
	@echo $(newline)
	sdx_analyze profile sdaccel_profile_summary.csv
	@echo $(newline)
	sdx_analyze trace sdaccel_timeline_trace.csv
	@echo "========================================================================="
	@echo $(newline)

hwemu: kerhwemu
175
	emconfigutil --platform $(BOARD) --nd $(NDEVICES_EMU)
176
177
178
179
180
181
182
183
184
185
186
187
188
	XCL_EMULATION_MODE=hw_emu ./$(EXES) -ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld -lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt -nev $(NEV) -nrun $(NRUN)  -gfpop 1
	@echo $(newline)
	@echo "========================================================================="
	@echo "INFO: hwemu log file is under: ./docking.dlg "
	@echo $(newline)
	@echo "INFO: profile and timeline trace report files are formatted for SDx GUI "
	@echo "INFO: ... if reports not generated, verify that sdaccel.ini exists!"
	@echo $(newline)
	sdx_analyze profile sdaccel_profile_summary.csv
	@echo $(newline)
	sdx_analyze trace sdaccel_timeline_trace.csv
	@echo "========================================================================="
	@echo $(newline)
189
190
191
192

# Build hw (FPGA bitstream)
# NOT integrated yet in a multistep compilation
hw: 	
193
	make all TARGETS=hw DEVICES=$(BOARD)
194
195
196
197
198
	@echo $(newline)
	@echo "======================================================================="
	@echo "INFO: FPGA bitstream is under: ./xclbin/$(XCLBINS).hw.*.xclbin"
	@echo "======================================================================="
	@echo $(newline)
199

200
sw-debug:
201
	XCL_EMULATION_MODE=sw_emu xgdb -args ./$(EXES) -ffile input/1stp/derived/1stp_protein.maps.fld -lfile input/1stp/derived/1stp_ligand.pdbqt -nrun 1 -nev 100 -lsit 10 -psize 10