Makefile 25.4 KB
Newer Older
1
2
3
4
5
# All included makefiles refer to 
# the official SDAccel GitHub repository / aws_2017.4 branch.
# These are not modified at all. In case custom configuration is required, 
# the corresponding vars of these makefiles were modified from here.
COMMON_REPO := ../SDAccel_Examples
lvs's avatar
lvs committed
6

7
# Common Includes
lvs's avatar
lvs committed
8
9
10
11
include $(COMMON_REPO)/utility/boards.mk
include $(COMMON_REPO)/libs/xcl2/xcl2.mk
include $(COMMON_REPO)/libs/opencl/opencl.mk

12
13
14
# Added to fix the unnecessarily required pointer 
# to global memory in each kernel
OTHER_FLAGS=
lvs's avatar
lvs committed
15

16
17
18
ifeq ($(TARGETS), sw_emu)
	OTHER_FLAGS=-DSW_EMU
endif
lvs's avatar
lvs committed
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
# Enable Kernels
ENABLE_KRNL_GA       = YES
ENABLE_KRNL_CONFORM  = YES
ENABLE_KRNL_INTERE   = YES
ENABLE_KRNL_INTRAE   = YES

ENABLE_KRNL_PRNG_BT_USHORT_FLOAT = YES
ENABLE_KRNL_PRNG_GG_UCHAR        = YES
ENABLE_KRNL_PRNG_GG_FLOAT        = YES

ENABLE_KRNL_PRNG_LS123_USHORT    = YES
ENABLE_KRNL_PRNG_LS_FLOAT  	 = YES
ENABLE_KRNL_PRNG_LS2_FLOAT       = YES
ENABLE_KRNL_PRNG_LS3_FLOAT       = YES

ENABLE_KRNL_PRNG_LS4_FLOAT       = YES
ENABLE_KRNL_PRNG_LS5_FLOAT       = YES
ENABLE_KRNL_PRNG_LS6_FLOAT       = YES
ENABLE_KRNL_PRNG_LS7_FLOAT       = YES
ENABLE_KRNL_PRNG_LS8_FLOAT       = YES
ENABLE_KRNL_PRNG_LS9_FLOAT       = YES

ENABLE_KRNL_LS  = YES
ENABLE_KRNL_LS2 = YES
ENABLE_KRNL_LS3 = YES
ENABLE_KRNL_LS4 = YES
ENABLE_KRNL_LS5 = YES
ENABLE_KRNL_LS6 = YES
ENABLE_KRNL_LS7 = YES
ENABLE_KRNL_LS8 = YES
ENABLE_KRNL_LS9 = YES

ENABLE_KRNL_IGL_ARBITER = YES

ifeq ($(ENABLE_KRNL_GA),YES)
	KRNL_GA =-DENABLE_KRNL_GA
else
	KRNL_GA =
endif
lvs's avatar
lvs committed
59

60
61
62
63
64
ifeq ($(ENABLE_KRNL_CONFORM),YES)
	KRNL_CONFORM =-DENABLE_KRNL_CONFORM
else
	KRNL_CONFORM =
endif
lvs's avatar
lvs committed
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
ifeq ($(ENABLE_KRNL_INTERE),YES)
	KRNL_INTERE =-DENABLE_KRNL_INTERE
else
	KRNL_INTERE =
endif

ifeq ($(ENABLE_KRNL_INTRAE),YES)
	KRNL_INTRAE =-DENABLE_KRNL_INTRAE
else
	KRNL_INTRAE =
endif

ifeq ($(ENABLE_KRNL_PRNG_BT_USHORT_FLOAT),YES)
	KRNL_PRNG_BT_USHORT_FLOAT =-DENABLE_KRNL_PRNG_BT_USHORT_FLOAT
else
	KRNL_PRNG_BT_USHORT_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_GG_UCHAR),YES)
	KRNL_PRNG_GG_UCHAR =-DENABLE_KRNL_PRNG_GG_UCHAR
else
	KRNL_PRNG_GG_UCHAR =
endif

ifeq ($(ENABLE_KRNL_PRNG_GG_FLOAT),YES)
	KRNL_PRNG_GG_FLOAT =-DENABLE_KRNL_PRNG_GG_FLOAT
else
	KRNL_PRNG_GG_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS123_USHORT),YES)
	KRNL_PRNG_LS123_USHORT =-DENABLE_KRNL_PRNG_LS123_USHORT
else
	KRNL_PRNG_LS123_USHORT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS_FLOAT),YES)
	KRNL_PRNG_LS_FLOAT =-DENABLE_KRNL_PRNG_LS_FLOAT
else
	KRNL_PRNG_LS_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS2_FLOAT),YES)
	KRNL_PRNG_LS2_FLOAT =-DENABLE_KRNL_PRNG_LS2_FLOAT
else
	KRNL_PRNG_LS2_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS3_FLOAT),YES)
	KRNL_PRNG_LS3_FLOAT =-DENABLE_KRNL_PRNG_LS3_FLOAT
else
	KRNL_PRNG_LS3_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS4_FLOAT),YES)
	KRNL_PRNG_LS4_FLOAT =-DENABLE_KRNL_PRNG_LS4_FLOAT
else
	KRNL_PRNG_LS4_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS5_FLOAT),YES)
	KRNL_PRNG_LS5_FLOAT =-DENABLE_KRNL_PRNG_LS5_FLOAT
else
	KRNL_PRNG_LS5_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS6_FLOAT),YES)
	KRNL_PRNG_LS6_FLOAT =-DENABLE_KRNL_PRNG_LS6_FLOAT
else
	KRNL_PRNG_LS6_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS7_FLOAT),YES)
	KRNL_PRNG_LS7_FLOAT =-DENABLE_KRNL_PRNG_LS7_FLOAT
else
	KRNL_PRNG_LS7_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS8_FLOAT),YES)
	KRNL_PRNG_LS8_FLOAT =-DENABLE_KRNL_PRNG_LS8_FLOAT
else
	KRNL_PRNG_LS8_FLOAT =
endif

ifeq ($(ENABLE_KRNL_PRNG_LS9_FLOAT),YES)
	KRNL_PRNG_LS9_FLOAT =-DENABLE_KRNL_PRNG_LS9_FLOAT
else
	KRNL_PRNG_LS9_FLOAT =
endif

ifeq ($(ENABLE_KRNL_LS),YES)
	KRNL_LS =-DENABLE_KRNL_LS
else
	KRNL_LS =
endif

ifeq ($(ENABLE_KRNL_LS2),YES)
	KRNL_LS2 =-DENABLE_KRNL_LS2
else
	KRNL_LS2 =
endif

ifeq ($(ENABLE_KRNL_LS3),YES)
	KRNL_LS3 =-DENABLE_KRNL_LS3
else
	KRNL_LS3 =
endif

ifeq ($(ENABLE_KRNL_LS4),YES)
	KRNL_LS4 =-DENABLE_KRNL_LS4
else
	KRNL_LS4 =
endif

ifeq ($(ENABLE_KRNL_LS5),YES)
	KRNL_LS5 =-DENABLE_KRNL_LS5
else
	KRNL_LS5 =
endif

ifeq ($(ENABLE_KRNL_LS6),YES)
	KRNL_LS6 =-DENABLE_KRNL_LS6
else
	KRNL_LS6 =
endif

ifeq ($(ENABLE_KRNL_LS7),YES)
	KRNL_LS7 =-DENABLE_KRNL_LS7
else
	KRNL_LS7 =
endif

ifeq ($(ENABLE_KRNL_LS8),YES)
	KRNL_LS8 =-DENABLE_KRNL_LS8
else
	KRNL_LS8 =
endif

ifeq ($(ENABLE_KRNL_LS9),YES)
	KRNL_LS9 =-DENABLE_KRNL_LS9
else
	KRNL_LS9 =
endif

ifeq ($(ENABLE_KRNL_IGL_ARBITER),YES)
	KRNL_IGL_ARBITER =-DENABLE_KRNL_IGL_ARBITER
else
	KRNL_IGL_ARBITER =
endif

# Reproduce result (remove randomness)
REPRO=NO

ifeq ($(REPRO), YES)
	REP=-DREPRO
else	
	REP=
endif

ENABLE_KERNELS = $(KRNL_GA) \
		 $(KRNL_CONFORM) \
		 $(KRNL_INTERE) \
		 $(KRNL_INTRAE) \
		 $(KRNL_PRNG_BT_USHORT_FLOAT) \
		 $(KRNL_PRNG_GG_UCHAR) \
		 $(KRNL_PRNG_GG_FLOAT) \
		 $(KRNL_PRNG_LS123_USHORT) \
	         $(KRNL_PRNG_LS_FLOAT)  \
		 $(KRNL_PRNG_LS2_FLOAT) \
		 $(KRNL_PRNG_LS3_FLOAT) \
		 $(KRNL_PRNG_LS4_FLOAT) \
		 $(KRNL_PRNG_LS5_FLOAT) \
		 $(KRNL_PRNG_LS6_FLOAT) \
		 $(KRNL_PRNG_LS7_FLOAT) \
		 $(KRNL_PRNG_LS8_FLOAT) \
		 $(KRNL_PRNG_LS9_FLOAT) \
		 $(KRNL_LS)  \
		 $(KRNL_LS2) \
		 $(KRNL_LS3) \
		 $(KRNL_LS4) \
		 $(KRNL_LS5) \
		 $(KRNL_LS6) \
		 $(KRNL_LS7) \
		 $(KRNL_LS8) \
		 $(KRNL_LS9) \
		 $(KRNL_IGL_ARBITER)

# Fixed-point
# FIxed-POint COform flag (FIPOCO)
#FIXED_POINT_CONFORM=YES
FIXED_POINT_CONFORM=NO

FIXED_POINT_INTERE=NO
FIXED_POINT_INTRAE=NO

#FIXED_POINT_LS1=YES
#FIXED_POINT_LS2=YES
#FIXED_POINT_LS3=YES
#FIXED_POINT_LS4=YES
#FIXED_POINT_LS5=YES
#FIXED_POINT_LS6=YES
#FIXED_POINT_LS7=YES
#FIXED_POINT_LS8=YES
#FIXED_POINT_LS9=YES
FIXED_POINT_LS1=NO
FIXED_POINT_LS2=NO
FIXED_POINT_LS3=NO
FIXED_POINT_LS4=NO
FIXED_POINT_LS5=NO
FIXED_POINT_LS6=NO
FIXED_POINT_LS7=NO
FIXED_POINT_LS8=NO
FIXED_POINT_LS9=NO

SINGLE_COPY_POP_ENE=YES

SEPARATE_FGRID_INTERE=NO

ifeq ($(FIXED_POINT_CONFORM), YES)
	FIPOCO_FLAG=-DFIXED_POINT_CONFORM
else	
	FIPOCO_FLAG=
endif

ifeq ($(FIXED_POINT_INTERE), YES)
	FIPOIE_FLAG=-DFIXED_POINT_INTERE
else	
	FIPOIE_FLAG=
endif

ifeq ($(FIXED_POINT_INTRAE), YES)
	FIPOIA_FLAG=-DFIXED_POINT_INTRAE
else	
	FIPOIA_FLAG=
endif

ifeq ($(FIXED_POINT_LS1), YES)
	FIPOLS1_FLAG=-DFIXED_POINT_LS1
else	
	FIPOLS1_FLAG=
endif

ifeq ($(FIXED_POINT_LS2), YES)
	FIPOLS2_FLAG=-DFIXED_POINT_LS2
else	
	FIPOLS2_FLAG=
endif

ifeq ($(FIXED_POINT_LS3), YES)
	FIPOLS3_FLAG=-DFIXED_POINT_LS3
else	
	FIPOLS3_FLAG=
endif

ifeq ($(FIXED_POINT_LS4), YES)
	FIPOLS4_FLAG=-DFIXED_POINT_LS4
else	
	FIPOLS4_FLAG=
endif

ifeq ($(FIXED_POINT_LS5), YES)
	FIPOLS5_FLAG=-DFIXED_POINT_LS5
else	
	FIPOLS5_FLAG=
endif
lvs's avatar
lvs committed
331
332
333



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
ifeq ($(FIXED_POINT_LS6), YES)
	FIPOLS6_FLAG=-DFIXED_POINT_LS6
else	
	FIPOLS6_FLAG=
endif

ifeq ($(FIXED_POINT_LS7), YES)
	FIPOLS7_FLAG=-DFIXED_POINT_LS7
else	
	FIPOLS7_FLAG=
endif

ifeq ($(FIXED_POINT_LS8), YES)
	FIPOLS8_FLAG=-DFIXED_POINT_LS8
else	
	FIPOLS8_FLAG=
endif

ifeq ($(FIXED_POINT_LS9), YES)
	FIPOLS9_FLAG=-DFIXED_POINT_LS9
else	
	FIPOLS9_FLAG=
endif

ifeq ($(SINGLE_COPY_POP_ENE), YES)
	COPYPOPENE_FLAG=-DSINGLE_COPY_POP_ENE
else	
	COPYPOPENE_FLAG=
endif

ifeq ($(SEPARATE_FGRID_INTERE), YES)
	SEP_FGRID_FLAG=-DSEPARATE_FGRID_INTERE
else	
	SEP_FGRID_FLAG=
endif

FIPO_FLAG = $(FIPOCO_FLAG) \
	    $(FIPOIE_FLAG) \
	    $(FIPOIA_FLAG) \
	    $(FIPOLS1_FLAG) \
	    $(FIPOLS2_FLAG) \
	    $(FIPOLS3_FLAG) \
	    $(FIPOLS4_FLAG) \
	    $(FIPOLS5_FLAG) \
	    $(FIPOLS6_FLAG) \
	    $(FIPOLS7_FLAG) \
	    $(FIPOLS8_FLAG) \
	    $(FIPOLS9_FLAG) \
	    $(COPYPOPENE_FLAG) $(SEP_FGRID_FLAG) 
lvs's avatar
lvs committed
383

384
385
386
387
388
389

CXXFLAGS:=-Wall -O0 -g -std=c++14 $(OTHER_FLAGS)



# Host Application
lvs's avatar
lvs committed
390
391

hostbin_SRCS=$(wildcard ../common/src/AOCLUtils/*.cpp wrapcl/src/*.cpp host/src/*.cpp) \
lvs's avatar
lvs committed
392
393
394
		$(oclHelper_SRCS) \
		$(xcl2_SRCS)

lvs's avatar
lvs committed
395
hostbin_HDRS=$(wildcard ./host/inc/*.h) \
lvs's avatar
lvs committed
396
397
398
399
		$(xcl2_HDRS)

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

lvs's avatar
lvs committed
400
hostbin_CXXFLAGS=-I../common/inc/ \
lvs's avatar
lvs committed
401
402
403
404
405
406
407
408
409
410
		    -I./host/inc/ \
		    -I. \
		    -I./wrapcl/inc/ \
		    $(opencl_CXXFLAGS) $(xcl2_CXXFLAGS) $(oclHelper_CXXFLAGS) \
		    -std=c++0x \
		    -U__STRICT_ANSI__ \
		    $(ENABLE_KERNELS) \
		    $(REP) \
		    $(FIPO_FLAG)
		    
Leonardo Solis's avatar
Leonardo Solis committed
411
hostbin_LDFLAGS=$(opencl_LDFLAGS) -lrt
lvs's avatar
lvs committed
412

lvs's avatar
lvs committed
413
EXES=hostbin
lvs's avatar
lvs committed
414
415

# Kernel
lvs's avatar
lvs committed
416
Krnl_GA_SRCS=./device/Krnl_GA.cl
lvs's avatar
lvs committed
417

418
419
420
421
422
423
424
425
#boards.mk
CLFLAGS= --xp "param:compiler.version=31" --xp "param:compiler.preserveHlsOutput=1" --xp "param:compiler.generateExtraRunData=true" -s -g -I./ -I../ -I./device $(REP) $(FIPO_FLAG) $(OTHER_FLAGS)

LDCLFLAGS=$(CLFLAGS)

#opencl.mk
opencl_LDFLAGS=-L$(OPENCL_LIB) -L$(SDA_LIB) -lxilinxopencl -pthread

426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
#-------------------------------
# AWS only: apply the following 
# kernel compile & link configuration options

# Otherwise error during VPL
# "dr.bd.tcl" seems to be using a configuration for VCU1525
# instead for AWS VU9P

# Problem reported here:
# https://forums.xilinx.com/t5/SDAccel/Building-ERROR-VPL-17-55-set-property-expects-at-least-one/td-p/893221

# AWS reference guide
# https://github.com/aws/aws-fpga/blob/master/SDAccel/docs/On_Premises_Development_Steps.md
# aws-fpga/SDAccel/examples/aws/kernel_3ddr_bandwidth/Makefile

# https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_2/ug1023-sdaccel-user-guide.pdf
# Page 33 (could not find in the v2017.4)
# --max_memory_ports [all | <kernel_name>]
# Optional
# Sets the maximum memory port property 
# for all kernels or a given kernel

448
449
## Commented because it is example
## Choosing the "bandwidth" kernel for maximum memory port property 
450
451
# krnl_GA_CLFLAGS=--max_memory_ports bandwidth

452
453
454
455
## Commented because not all kernels in design need that
## Choosing the all kernels in design for maximum memory port property 
# Krnl_GA_CLFLAGS=--max_memory_ports all

456
457
458
459
460
461
462
## Ideal configuration, but results in routing error
#Krnl_GA_CLFLAGS=--max_memory_ports Krnl_GA \
#		--max_memory_ports Krnl_Conform \
#		--max_memory_ports Krnl_InterE \
#		--max_memory_ports Krnl_IntraE

#Krnl_GA_CLFLAGS=--max_memory_ports Krnl_GA
463
464
465
466
467
468
469
470

# https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_4/ug1023-sdaccel-user-guide.pdf
# Page 44
# --sp <kernel_inst_name>.<interface_name>:<bank>
# Valid DDR4 bank names are 
# bank0, bank1, bank2, and bank3 
# for platforms with 4 DDR banks.

471
## Commented because it is example
472
473
474
475
#krnl_GA_LDCLFLAGS+= --sp bandwidth_1.m_axi_gmem0:bank0 \
#		    --sp bandwidth_1.m_axi_gmem1:bank1 \
#		    --sp bandwidth_1.m_axi_gmem2:bank2	

476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
## Ideal configuration, but results in routing error
# First two args of IntraE are the 2nd and 3rd of InterE (atom_charges & atom_types),
# Therefore they are mapped to the same DDR bank
#Krnl_GA_LDCLFLAGS+=--sp Krnl_GA_1.m_axi_gmem0:bank0 \
#		   --sp Krnl_GA_1.m_axi_gmem1:bank0 \
#		   --sp Krnl_GA_1.m_axi_gmem2:bank0 \
#		   --sp Krnl_GA_1.m_axi_gmem3:bank0 \
#		   --sp Krnl_Conform_1.m_axi_gmem0:bank1 \
#		   --sp Krnl_Conform_1.m_axi_gmem1:bank1 \
#		   --sp Krnl_Conform_1.m_axi_gmem2:bank1 \
#		   --sp Krnl_Conform_1.m_axi_gmem3:bank1 \
#		   --sp Krnl_Conform_1.m_axi_gmem4:bank1 \
#		   --sp Krnl_InterE_1.m_axi_gmem0:bank2 \
#		   --sp Krnl_InterE_1.m_axi_gmem1:bank2 \
#		   --sp Krnl_InterE_1.m_axi_gmem2:bank2 \
#		   --sp Krnl_IntraE_1.m_axi_gmem0:bank2	\
#		   --sp Krnl_IntraE_1.m_axi_gmem1:bank2	\
#		   --sp Krnl_IntraE_1.m_axi_gmem2:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem3:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem4:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem5:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem6:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem7:bank3	\
# 		   --sp Krnl_IntraE_1.m_axi_gmem8:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem9:bank3	\
#		   --sp Krnl_IntraE_1.m_axi_gmem10:bank3

Leonardo Solis's avatar
Leonardo Solis committed
503
504
505
506
507
#Krnl_GA_LDCLFLAGS+=--sp Krnl_GA_1.m_axi_gmem:bank0      \
#		   --sp Krnl_Conform_1.m_axi_gmem:bank1 \
#		   --sp Krnl_InterE_1.m_axi_gmem:bank2  \
#		   --sp Krnl_IntraE_1.m_axi_gmem:bank3

508
Krnl_GA_LDCLFLAGS+=--sp Krnl_GA_1.m_axi_gmem:bank0      \
Leonardo Solis's avatar
Leonardo Solis committed
509
510
511
512
		   --sp Krnl_Conform_1.m_axi_gmem:bank0 \
		   --sp Krnl_InterE_1.m_axi_gmem:bank1  \
		   --sp Krnl_IntraE_1.m_axi_gmem:bank1

513
514
515
516
517
518
519
520
521
522
523
##
# https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_4/ug1281-sdaccel-debugging-guide.pdf
# Page 32
# Instrumentation 1: Kernel Hangs due to AXI Violations
##

# Add Lightweight AXI Protocol Checker (lapc)
# <protocol:< compute_unit_name >:< interface_name >>
LAPC:=none

ifneq ($(LAPC),none)
524
525
526

## Commented because error was obtained:
## Number of axi protocol checkers requested must be between 1 and 63.
527
528
#Krnl_GA_LDCLFLAGS+=--dk protocol:all:all

529
530
531
## Warning obtained (not sure if because of configuration)
## # xbsak status --lapc
## Invalid codes read, skip decoding
532
Krnl_GA_LDCLFLAGS+=--dk protocol:Krnl_GA_1:m_axi_gmem0 \
533
534
535
536
		   --dk protocol:Krnl_GA_1:m_axi_gmem1 \
		   --dk protocol:Krnl_GA_1:m_axi_gmem2 \
		   --dk protocol:Krnl_GA_1:m_axi_gmem3 \
		   --dk protocol:Krnl_Conform_1:m_axi_gmem0 \
537
		   --dk protocol:Krnl_Conform_1:m_axi_gmem1 \
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
		   --dk protocol:Krnl_Conform_1:m_axi_gmem2 \
		   --dk protocol:Krnl_Conform_1:m_axi_gmem3 \
		   --dk protocol:Krnl_Conform_1:m_axi_gmem4 \
                   --dk protocol:Krnl_InterE_1:m_axi_gmem0 \
	 	   --dk protocol:Krnl_InterE_1:m_axi_gmem1 \
		   --dk protocol:Krnl_InterE_1:m_axi_gmem2 \
	           --dk protocol:Krnl_IntraE_1:m_axi_gmem0 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem1 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem2 \
	           --dk protocol:Krnl_IntraE_1:m_axi_gmem3 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem4 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem5 \
	           --dk protocol:Krnl_IntraE_1:m_axi_gmem6 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem7 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem8 \
	           --dk protocol:Krnl_IntraE_1:m_axi_gmem9 \
		   --dk protocol:Krnl_IntraE_1:m_axi_gmem10
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572

## Commented because error was obtained:
## No interface pins matched 'get_bd_intf_pins -of /Krnl_Conform_1 -filter NAME=~m_axi_gmem'
## ERROR: caught error: Unable to find interface pin  for AXI protocol checker insertion
#Krnl_GA_LDCLFLAGS+=--dk protocol:Krnl_GA_1:m_axi_gmem \
#		   --dk protocol:Krnl_Conform_1:m_axi_gmem \
#                  --dk protocol:Krnl_InterE_1:m_axi_gmem \
#	           --dk protocol:Krnl_IntraE_1:m_axi_gmem
endif

## Adding Performance Monitors (spm) 
## enables the listing of detailed communication statistics (counters). 
## --profile_kernel data:<kernel_name|all>:<cu_name|all>:<interface_name|all>
SPM:=none

ifneq ($(SPM),none)
##--profile_kernel data:krnl1:cu1:m_axi_gmem0
##--profile_kernel data:krnl2:cu2:m_axi_gmem
573
574
575
576
Krnl_GA_LDCLFLAGS+=--profile_kernel data:Krnl_GA:Krnl_GA_1:all \
		   --profile_kernel data:Krnl_Conform:Krnl_Conform_1:all \
		   --profile_kernel data:Krnl_InterE:Krnl_InterE_1:all \
		   --profile_kernel data:Krnl_IntraE:Krnl_IntraE_1:all
577
578
endif

579
580
581
582
#-------------------------------



583

lvs's avatar
lvs committed
584
XOS=Krnl_GA
lvs's avatar
lvs committed
585

lvs's avatar
lvs committed
586
Krnl_GA_XOS=Krnl_GA
lvs's avatar
lvs committed
587

lvs's avatar
lvs committed
588
XCLBINS=Krnl_GA
lvs's avatar
lvs committed
589
590

# check
lvs's avatar
lvs committed
591
592
check_EXE=hostbin
check_XCLBINS=Krnl_GA
lvs's avatar
lvs committed
593
594
595
CHECKS=check

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

597
598
599
600
601
602
603
# Note that the definition of "newline" contains two blank lines.
# Using $(newline) will expand into only one newline.
define newline


endef

604
605
606
607
608
# 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
609
PSIZE:= 150
Leonardo Solis's avatar
Leonardo Solis committed
610
611
612
NRUN := 10
NEV  := 800000
NGEN := 27000
613
GFPOP:= 0
614

615
616
617
# 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)
Leonardo Solis's avatar
Leonardo Solis committed
618

619
620
# Boards in SDAccel installation path: /opt/cad/xilinx/SDx/2017.4/platforms/

Leonardo Solis's avatar
Leonardo Solis committed
621
622
# If several versions are present, e.g.: "vcu1525_5_0" and "vcu1525_5_1"
# Pay attention to which should be used
623
#BOARD:= xilinx:kcu1500:dynamic
Leonardo Solis's avatar
Leonardo Solis committed
624
625
626
#BOARD:= xilinx:vcu1525:dynamic

# Boards in external paths
627
628
629
630
631
632
633
634
635
636
637

# Cloned from https://github.com/aws/aws-fpga
# This corresponds to AWS Shell v04261818 
# https://github.com/aws/aws-fpga/blob/master/hdk/docs/AWS_Shell_RELEASE_NOTES.md
# IMPORTANT: source scripts to get the full DSA
# Because by default only the "sw" component is provided in GitHub
#BOARD:= /home/wimi/lvs/ocl_xilinx/aws-fpga/SDAccel/aws_platform/xilinx_aws-vu9p-f1-04261818_dynamic_5_0/xilinx_aws-vu9p-f1-04261818_dynamic_5_0.xpfm
BOARD:= /home/wimi/lvs/DSA_SDACCEL_AWS_VU9P/xilinx_aws-vu9p-f1-04261818_dynamic_5_0/xilinx_aws-vu9p-f1-04261818_dynamic_5_0.xpfm

# Copied from Xelera (saruman) SDAccel installation path
#BOARD:= /home/wimi/lvs/DSA_SDACCEL_AWS_VU9P/xilinx_aws-vu9p-f1_dynamic_5_0/xilinx_aws-vu9p-f1_dynamic_5_0.xpfm
638
#BOARD:= /home/wimi/lvs/DSA_SDACCEL_VCU1525_5_1/xilinx_vcu1525_dynamic_5_1/xilinx_vcu1525_dynamic_5_1.xpfm
639
#BOARD:= /opt/cad/xilinx/SDx/2017.1/platforms/xilinx_adm-pcie-7v3_1ddr_3_0/xilinx_adm-pcie-7v3_1ddr_3_0.xpfm
Leonardo Solis's avatar
Leonardo Solis committed
640

641
642
NDEVICES_EMU:=1

643

644
645
646
647
# Compile and generate report
kerrpt-sw:
	make clean
	@echo $(newline)
648
	make all REPORT=estimate TARGETS=sw_emu DEVICES=$(BOARD)
649
650
651
652
653
	@echo $(newline)
	cp ./xclbin/$(XCLBINS).sw_emu.*.xclbin .
	@echo $(newline)
	mv ./$(XCLBINS).sw_emu.*.xclbin ./$(XCLBINS).xclbin
	@echo $(newline)
654
655
656
	@echo "==============================================================================="
	@echo "INFO: sw emulation file created under: \"./xclbin/$(XCLBINS).sw_emu.*.xclbin\" "
	@echo "INFO: ... was copied and renamed as \"./$(XCLBINS).xclbin\"                    "
657
	@echo $(newline)
658
659
	@echo "INFO: a \"./system_estimate.xtxt\" report was generated!                       "
	@echo "==============================================================================="
660
661
	@echo $(newline)

662

663
# Compile for sw and hw emulation
664
kerswemu:
665
	make all TARGETS=sw_emu DEVICES=$(BOARD)
666
667
	cp ./xclbin/$(XCLBINS).sw_emu.*.xclbin .
	mv ./$(XCLBINS).sw_emu.*.xclbin ./$(XCLBINS).xclbin
668
	@echo $(newline)
669
670
671
672
	@echo "==============================================================================="
	@echo "INFO: sw emulation file created under: \"./xclbin/$(XCLBINS).sw_emu.*.xclbin\" "
	@echo "INFO: ... was copied and renamed as \"./$(XCLBINS).xclbin\"    	              "
	@echo "==============================================================================="
673
	@echo $(newline)
674

675

676
kerhwemu:
677
	make all TARGETS=hw_emu	DEVICES=$(BOARD)
678
679
680
	cp ./xclbin/$(XCLBINS).hw_emu.*.xclbin .
	mv ./$(XCLBINS).hw_emu.*.xclbin ./$(XCLBINS).xclbin
	@echo $(newline)
681
682
683
684
	@echo "==============================================================================="
	@echo "INFO: hw emulation file created under: \"./xclbin/$(XCLBINS).hw_emu.*.xclbin\" "
	@echo "INFO: ... was copied and renamed as \"./$(XCLBINS).xclbin\"                    "
	@echo "==============================================================================="
685
	@echo $(newline)
686

687

688
689
690
# Run emulation
# Compilation (host & device) if not done previously
# The .dlg file is written in ./
lvs's avatar
lvs committed
691
# "exe" and "xclbin" are rules from "rules.mk"
692
693
# SDAccel 2017.4: User Guide UG1023, "Running Software and Hardware Emulation in XOCC Flow"
#emconfigutil --platform xilinx_vcu1525_dynamic_5_0 --nd 1
694
swemu: kerswemu
695
	emconfigutil --platform $(BOARD) --nd $(NDEVICES_EMU)
696
697
698
699
	XCL_EMULATION_MODE=sw_emu ./$(EXES) \
	-ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld \
	-lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt \
	-psize $(PSIZE) -nrun $(NRUN) -nev $(NEV) -ngen $(NGEN) -gfpop 1
700
	@echo $(newline)
Leonardo Solis's avatar
Leonardo Solis committed
701
702
	@echo "===================================================================================="
	@echo "INFO: swemu log file is under: \"./docking.dlg\"                                    "
703
	@echo $(newline)
Leonardo Solis's avatar
Leonardo Solis committed
704
705
	@echo "INFO: profile and timeline trace report files are formatted for SDx GUI             "
	@echo "INFO: ... if reports not generated, verify that \"sdaccel.ini\" exists!             "
706
707
708
709
	@echo $(newline)
	sdx_analyze profile sdaccel_profile_summary.csv
	@echo $(newline)
	sdx_analyze trace sdaccel_timeline_trace.csv
Leonardo Solis's avatar
Leonardo Solis committed
710
711
712
	@echo $(newline)
	@echo "INFO: (1) open sdx, (2) select \"File->Open File\", (3) browse to *.xprf or *.wdb  "
	@echo "===================================================================================="
713
714
	@echo $(newline)

715
716
717
718
719
720
721
722
723
724
725
726
727
728
# Debug on software using Xilinx GDB
# Analyze hangs with the following gdb extensions:
# xprint queue [<cl_command_queue>]
# xprint event <cl_event>
# xprint mem [<cl_mem>]
# xprint kernel
# xprint all
swemudebug:
	xgdb --args \
	./$(EXES) \
	-ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld \
	-lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt \
	-psize $(PSIZE) -nrun $(NRUN) -nev $(NEV) -ngen $(NGEN) -gfpop 1

729

730
hwemu: kerhwemu
731
	emconfigutil --platform $(BOARD) --nd $(NDEVICES_EMU)
732
733
734
735
	XCL_EMULATION_MODE=hw_emu ./$(EXES) \
	-ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld \
	-lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt \
	-psize $(PSIZE) -nrun $(NRUN) -nev $(NEV) -ngen $(NGEN) -gfpop 1
736
	@echo $(newline)
737
738
	@echo "==========================================================================="
	@echo "INFO: hwemu log file is under: \"./docking.dlg\"                           "
739
	@echo $(newline)
740
741
	@echo "INFO: profile and timeline trace report files are formatted for SDx GUI    "
	@echo "INFO: ... if reports not generated, verify that \"sdaccel.ini\" exists!    "
742
743
744
745
	@echo $(newline)
	sdx_analyze profile sdaccel_profile_summary.csv
	@echo $(newline)
	sdx_analyze trace sdaccel_timeline_trace.csv
746
	@echo "==========================================================================="
747
	@echo $(newline)
748

749

750
751
752
# Build hw (FPGA bitstream)
# NOT integrated yet in a multistep compilation
hw: 	
753
	make all TARGETS=hw DEVICES=$(BOARD)
754
	@echo $(newline)
755
756
757
	@echo "========================================================================="
	@echo "INFO: FPGA bitstream is under: \"./xclbin/$(XCLBINS).hw.*.xclbin\"       " 
	@echo "========================================================================="
758
	@echo $(newline)
759

760

761
762
763
# Build instrumented hw (FPGA bitstream)
# NOT integrated yet in a multistep compilation
hw-instr: 	
764
	make all TARGETS=hw DEVICES=$(BOARD) LAPC=yes SPM=yes
765
766
767
768
769
770
771
772
	@echo $(newline)
	@echo "=============================================================================================="
	@echo "INFO: [instrumented] FPGA bitstream is under: \"./xclbin/$(XCLBINS).hw.*.xclbin\"             " 
	@echo "=============================================================================================="
	@echo $(newline)



773
774
775
776
777
778
# Execute on remote server
# Host-recompilation
# Copy of host to $(TARGET_DIR_HW)
# The working directory is changed
# So .dlg file is written in $(TARGET_DIR_HW)
eva: exe
779
780
781
782
783
	./$(EXES) \
	-ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld \
	-lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt \
	-resnam docking_$(PDB)_$(NRUN) \
	-nrun $(NRUN) -gfpop $(GFPOP)
784
785
786
787
788
789
790
791
792
793
794
795
796
797
	@echo $(newline)
	@echo "==========================================================================="
	@echo "INFO: evaluation 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)


798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
# Debug on hardware using Xilinx GDB
# Analyze hangs with the following gdb extensions:
# xprint queue [<cl_command_queue>]
# xprint event <cl_event>
# xprint mem [<cl_mem>]
# xprint kernel
# xprint all
evadebug:
	xgdb --args \
	./$(EXES) \
	-ffile input/$(PDB)/derived/$(PDB)_protein.maps.fld \
	-lfile input/$(PDB)/derived/$(PDB)_ligand.pdbqt \
	-resnam docking_debug_$(PDB)_$(NRUN) \
	-nrun $(NRUN) -gfpop $(GFPOP)


814
815
816
817
818
819
820
821
# Project name
PROJECT_NAME := ofdock_taskpar_xl

COPY_DIR := copy_$(PROJECT_NAME)
COPY_DIR_DOCK := $(PROJECT_NAME)

# Make sure this remote-server alias exists (in ~/.ssh/config)

822
823
824
825
826
827
828
## Xelera
#SERVER_BRIDGE := erebor:/scratch/
#SERVER_EXEC   := saruman:~/ocladock_sdx17_4

## AWS
SERVER_BRIDGE := eredmithrim:/home/lvs/ESA/AWS
SERVER_EXEC   := AWS
829
830
831
832
833
834
835
836
837
838
839
840
841
842

# Delete an existing folder if previously created
# Create a folder $(COPY_DIR) in the parent directory
# Copy binaries into $(COPY_DIR) folder, avoiding the (innecesary) compilation intermediate files
# Copy source files into $(COPY_DIR) as host is built in the remote $(SERVER)
# Create a zip file out of the $(COPY_DIR) folder
copy: clean-copy
	mkdir ../$(COPY_DIR)
	mkdir ../$(COPY_DIR)/$(COPY_DIR_DOCK)
	mkdir ../$(COPY_DIR)/$(COPY_DIR_DOCK)/xclbin
	cp ./xclbin/$(XCLBINS).hw.*.xclbin ../$(COPY_DIR)/$(COPY_DIR_DOCK)/xclbin/
	cp ./xclbin/$(XCLBINS).hw.*.xo ../$(COPY_DIR)/$(COPY_DIR_DOCK)/xclbin/
	cp ./xclbin/$(XCLBINS).hw.*.xclbin ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	mv ../$(COPY_DIR)/$(COPY_DIR_DOCK)/$(XCLBINS).hw.*.xclbin ../$(COPY_DIR)/$(COPY_DIR_DOCK)/$(XCLBINS).xclbin
843
	cp sdaccel.ini ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
844
845
846
847
848
849
	cp Makefile ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	cp defines.h ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	cp defines_fixedpt.h ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	cp defines_fixedpt_64.h ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	cp -r device/ ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	cp -r host/ ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
850
	#cp -r input/ ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
851
852
853
854
855
856
857
858
859
860
	cp -r wrapcl/ ../$(COPY_DIR)/$(COPY_DIR_DOCK)/
	cp -r ../common ../$(COPY_DIR)/
	cp -r ../common_xilinx ../$(COPY_DIR)/
	cp ../conf_sdx174_saruman.sh ../$(COPY_DIR)/
	cd ../;	zip -r $(COPY_DIR).zip $(COPY_DIR)
	@echo $(newline)
	@echo "Transfer the \"$(COPY_DIR).zip\" file to $(SERVER_BRIDGE) server: "
	@echo " "
	cd ../ && scp $(COPY_DIR).zip $(SERVER_BRIDGE)
	@echo $(newline)
861
862
	@echo "=================================================================="
	@echo "Files listed were transferred to $(SERVER_BRIDGE)                 "
863
	@echo $(newline)
864
865
866
	@echo "Then, create AFI and transfer files manually                      "
	@echo "from $(SERVER_BRIDGE) to $(SERVER_EXEC)                           "
	@echo "=================================================================="
867
868
869
870
871
872
873
874
875
876
877
878
879
	@echo $(newline)


clean-copy:
	rm -rf ../$(COPY_DIR)
	rm -f ../$(COPY_DIR).zip
	@echo $(newline)
	@echo "=================================================================="
	@echo "Previous \"$(COPY_DIR).zip\" and its folder were deleted          "
	@echo "=================================================================="
	@echo $(newline)