PR #489 Fix 072 Fuzzer by splitting jobs

Signed-off-by: Mehdi Khairy <mehdi.khairy@more-magic.org>
This commit is contained in:
Mehdi Khairy 2019-01-11 00:11:34 +01:00
parent 19a93121a6
commit 84645e8793
6 changed files with 117 additions and 22 deletions

View File

@ -1,6 +1,6 @@
N := 1
SPECIMENS := $(addprefix specimen_,$(shell seq -f '%03.0f' $(N)))
SPECIMENS := $(addprefix build/specimen_,$(shell seq -f '%03.0f' $(N)))
SPECIMENS_OK := $(addsuffix /OK,$(SPECIMENS))
database: $(SPECIMENS_OK)
@ -20,7 +20,7 @@ run:
touch run.ok
clean:
rm -rf specimen_[0-9][0-9][0-9]/ run.ok
rm -rf build run.ok
.PHONY: database pushdb run clean

View File

@ -2,4 +2,5 @@
source ${XRAY_GENHEADER}
${XRAY_VIVADO} -mode batch -source ../generate.tcl
python3 $FUZDIR/run_fuzzer.py

View File

@ -1,19 +0,0 @@
create_project -force -part $::env(XRAY_PART) design design
set_property design_mode PinPlanning [current_fileset]
open_io_design -name io_1
set downhill_fp [open downhill_wires.txt w]
set uphill_fp [open uphill_wires.txt w]
#set_param tcl.collectionResultDisplayLimit 0
foreach pip [get_pips] {
foreach downhill_node [get_nodes -downhill -of_object $pip] {
set ordered_downhill_wires [get_wires -from $pip -of_object $downhill_node]
puts $downhill_fp "$pip $downhill_node $ordered_downhill_wires"
}
foreach uphill_node [get_nodes -uphill -of_object $pip] {
set ordered_uphill_wires [get_wires -to $pip -of_object $uphill_node]
puts $uphill_fp "$pip $uphill_node $ordered_uphill_wires"
}
}
close $downhill_fp
close $uphill_fp

View File

@ -0,0 +1,11 @@
create_project -force -part $::env(XRAY_PART) design design
set_property design_mode PinPlanning [current_fileset]
open_io_design -name io_1
#set_param tcl.collectionResultDisplayLimit 0
set_param messaging.disableStorage 1
set nbpips_fp [open nb_pips.txt w]
set pips [get_pips]
puts $nbpips_fp [llength $pips]

View File

@ -0,0 +1,31 @@
set blocknb [lindex $argv 0]
set start [expr int([lindex $argv 1])]
set stop [expr int([lindex $argv 2])]
create_project -force -part $::env(XRAY_PART) $blocknb $blocknb
set_property design_mode PinPlanning [current_fileset]
open_io_design -name io_1
#set_param tcl.collectionResultDisplayLimit 0
set_param messaging.disableStorage 1
set pips [get_pips]
set dwnhill_fp [open "wires/downhill_wires_${blocknb}.txt" w]
set uphill_fp [open "wires/uphill_wires_${blocknb}.txt" w]
for { set i $start } { $i < $stop } { incr i } {
set pip [lindex $pips $i]
foreach downhill_node [get_nodes -downhill -of_object $pip] {
set ordered_downhill_wires [get_wires -from $pip -of_object $downhill_node]
puts $dwnhill_fp "$pip $downhill_node $ordered_downhill_wires"
}
foreach uphill_node [get_nodes -uphill -of_object $pip] {
set ordered_uphill_wires [get_wires -to $pip -of_object $uphill_node]
puts $uphill_fp "$pip $uphill_node $ordered_uphill_wires"
}
}
close $dwnhill_fp
close $uphill_fp

View File

@ -0,0 +1,71 @@
import os
import shutil
import sys
import subprocess
import signal
from multiprocessing import Pool
def start_vivado(argList):
print(argList)
blockID, start, stop = argList
print("Running instance :" + str(blockID))
subprocess.check_call(
"${XRAY_VIVADO} -mode batch -source $FUZDIR/job.tcl -tclargs " +
str(blockID) + " " + str(start) + " " + str(stop),
shell=True)
def get_nb_pips():
print("Fetching nb pips")
subprocess.check_call(
"${XRAY_VIVADO} -mode batch -source $FUZDIR/get_pipscount.tcl",
shell=True)
countfile = open("nb_pips.txt", "r")
return int(countfile.readline())
def main(argv):
nbBlocks = 64
nbParBlock = 4
pipscount = get_nb_pips()
blocksize = int(pipscount / nbBlocks)
if not os.path.exists("wires"):
os.mkdir("wires")
print(
"Pips Count: " + str(pipscount) + " - Number of blocks: " +
str(nbBlocks) + " - Parallel blocks: " + str(nbParBlock) +
" - Blocksize: " + str(blocksize))
blockId = range(0, nbBlocks)
startI = range(0, pipscount, blocksize)
stopI = range(blocksize, pipscount + 1, blocksize)
argList = zip(blockId, startI, stopI)
with Pool(processes=nbParBlock) as pool:
pool.map(start_vivado, argList)
print("Generating final files")
with open("uphill_wires.txt", "w") as wfd:
for j in range(0, nbBlocks):
f = "wires/uphill_wires_" + str(j) + ".txt"
with open(f, "r") as fd:
shutil.copyfileobj(fd, wfd)
with open("downhill_wires.txt", "w") as wed:
for j in range(0, nbBlocks):
e = "wires/downhill_wires_" + str(j) + ".txt"
with open(e, "r") as ed:
shutil.copyfileobj(ed, wed)
print("Work done !")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))