Skip to content

Commit

Permalink
[Makefile] Track user-cpu time (not used for scoring) (#78)
Browse files Browse the repository at this point in the history
* [Makefile] Also print out user-cpu time

* Update Makefile

* Update Makefile

Signed-off-by: Eddie Hung <[email protected]>

* User-CPU time only if not rwroute

Signed-off-by: Eddie Hung <[email protected]>

* Call java directly

Signed-off-by: Eddie Hung <[email protected]>

* Use target-specific export instead

Signed-off-by: Eddie Hung <[email protected]>

* Revert "Use target-specific export instead"

This reverts commit a03d85a.

* Try :=

Signed-off-by: Eddie Hung <[email protected]>

* Double dollar

Signed-off-by: Eddie Hung <[email protected]>

* Compute inside subshell not Makefile

Signed-off-by: Eddie Hung <[email protected]>

* Wall clock time to be second-to-last line now

Signed-off-by: Eddie Hung <[email protected]>

* Use an intermediate java classpath file

Signed-off-by: Eddie Hung <[email protected]>

* Filter word list

Signed-off-by: Eddie Hung <[email protected]>

* Improve workflow tests

Signed-off-by: Eddie Hung <[email protected]>

* Make java-classpath.txt an order-only dep

Signed-off-by: Eddie Hung <[email protected]>

* Fix workflow

Signed-off-by: Eddie Hung <[email protected]>

---------

Signed-off-by: Eddie Hung <[email protected]>
  • Loading branch information
eddieh-xlnx authored Feb 2, 2024
1 parent fd0fa4e commit 6ecca48
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ jobs:
- name: Verify pass (non nxroute-poc)
if: matrix.router != 'nxroute-poc'
run: |
set -x
# Allow CheckPhysNetlist to fail if no remote access to Vivado
grep -H PASS *.check || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }}
grep -H PASS *.check || (grep -H FAIL *.check && ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }})
grep -H -e "# of nets with routing errors[. :]\+0" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }}
# But CheckPhysNetlist must have no differences
grep "INFO: No differences found between routed and unrouted netlists" *.check.log
Expand All @@ -101,14 +102,15 @@ jobs:
- name: Verify fail (nxroute-poc)
if: matrix.router == 'nxroute-poc'
run: |
set -x
grep -H FAIL *.check
# Only expect report_route_status output if URL given
grep -H -e "# of nets with routing errors[. :]\+[1-9]" -e "# of unrouted nets[. :]\+[1-9]" *.check.log || ${{ secrets.REPORT_ROUTE_STATUS_URL == '' }}
# But CheckPhysNetlist must have no differences (except koios because out-of-memory)
grep "INFO: No differences found between routed and unrouted netlists" *.check.log || ${{ matrix.benchmark == 'koios_dla_like_large' }}
# Check no multiple sources, but expect stubs (except koios because out-of-memory)
# Check no multiple sources, but expect possibility of stubs since nxroute is unlikely to fully route the design
grep "UserWarning: Found [0-9]\+ sources" *.wirelength && exit 1
grep "UserWarning: Found [0-9]\+ stubs" *.wirelength || ${{ matrix.benchmark == 'koios_dla_like_large' }}
grep "UserWarning: Found [0-9]\+ stubs" *.wirelength || true
# Allow wirelength computation to fail since nxroute may not have routed anything or wirelength_analyzer was not run
grep "^Wirelength: [1-9][0-9]*" *.wirelength || true
- uses: actions/upload-artifact@v3
Expand Down
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ $(if $(HTTPSHOST),-Dhttps.proxyHost=$(HTTPSHOST) -Dhttps.proxyPort=$(HTTPSPORT),
# (other supported values: nxroute-poc)
ROUTER ?= rwroute

# Make /usr/bin/time only print out wall-clock time in seconds
export TIME=Wall-clock time (sec): %e
# Make /usr/bin/time only print out wall-clock and user time in seconds
TIME = Wall-clock time (sec): %e
# Note that User-CPU time is for information purposes only (not used for scoring)
TIME += \nUser-CPU time (sec): %U
export TIME

# Existence of the VERBOSE environment variable indicates whether router/
# checker outputs will be displayed on screen
Expand All @@ -63,6 +66,11 @@ export RAPIDWRIGHT_PATH = $(abspath RapidWright)
.PHONY: run-$(ROUTER)
run-$(ROUTER): score-$(ROUTER)

JAVA_CLASSPATH_TXT = java-classpath.txt
.INTERMEDIATE: $(JAVA_CLASSPATH_TXT)
$(JAVA_CLASSPATH_TXT): compile-java
echo "$$(./gradlew -quiet --offline runtimeClasspath):build/classes/java/main" > $@

# Use Gradle to compile Java source code in this repository as well as the RapidWright repository.
# Also download/generate all device files necessary for the xcvu3p device
.PHONY: compile-java
Expand Down Expand Up @@ -92,8 +100,8 @@ fpga-interchange-schema/interchange/capnp/java.capnp:
# Gradle is used to invoke the CheckPhysNetlist class' main method with arguments
# $^ (%.netlist and %_rwroute.phys), and display/redirect all output to [email protected] (%_rwroute.check.log).
# The exit code of Gradle determines if 'PASS' or 'FAIL' is written to $@ (%_rwroute.check)
%_$(ROUTER).check: %.netlist %_$(ROUTER).phys %_unrouted.phys | compile-java
if ./gradlew --offline -DjvmArgs="$(JVM_HEAP)" -Dmain=com.xilinx.fpga24_routing_contest.CheckPhysNetlist :run --args='$^' $(call log_and_or_display,$@.log); then \
%_$(ROUTER).check: %.netlist %_$(ROUTER).phys %_unrouted.phys | $(JAVA_CLASSPATH_TXT)
if java -cp $$(cat $(JAVA_CLASSPATH_TXT)) $(JVM_HEAP) com.xilinx.fpga24_routing_contest.CheckPhysNetlist $^ $(call log_and_or_display,$@.log); then \
echo "PASS" > $@; \
else \
echo "FAIL" > $@; \
Expand Down Expand Up @@ -135,8 +143,9 @@ distclean: clean
# /usr/bin/time is used to measure the wall clock time
# Gradle is used to invoke the PartialRouterPhysNetlist class' main method with arguments
# $< (%_unrouted.phys) and $@ (%_rwroute.phys), and display/redirect all output into %_rwroute.phys.log
%_rwroute.phys: %_unrouted.phys | compile-java
(/usr/bin/time ./gradlew --offline -DjvmArgs="$(JVM_HEAP)" -Dmain=com.xilinx.fpga24_routing_contest.PartialRouterPhysNetlist :run --args='$< $@') $(call log_and_or_display,$@.log)
%_rwroute.phys: %_unrouted.phys | $(JAVA_CLASSPATH_TXT)
(/usr/bin/time java -cp $$(cat $(JAVA_CLASSPATH_TXT)) $(JVM_HEAP) com.xilinx.fpga24_routing_contest.PartialRouterPhysNetlist $< $@) $(call log_and_or_display,$@.log)


## NXROUTE-POC
%_nxroute-poc.phys: %_unrouted.phys xcvu3p.device | install-python-deps fpga-interchange-schema/interchange/capnp/java.capnp
Expand Down
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ task run(type: JavaExec) {
}
}

task runtimeClasspath {
doLast {
println configurations.runtimeClasspath.asPath
}
}
2 changes: 1 addition & 1 deletion compute-score.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def runtime_result(physlogfile):
"""
reWallClockSeconds = re.compile(r'Wall-clock time \(sec\): ([0-9.]+)')
with open(physlogfile) as fp:
last = fp.readlines()[-1].rstrip()
last = fp.readlines()[-2].rstrip()
m = reWallClockSeconds.match(last)
if not m:
return float('inf')
Expand Down

0 comments on commit 6ecca48

Please sign in to comment.