Skip to content

Commit

Permalink
Limit memory inside GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieh-xlnx committed Sep 22, 2023
1 parent bd0ea01 commit 5213f8b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ else
log_and_or_display = > $(1) 2>&1
endif

ifdef GITHUB_ACTIONS
# Limit Java heap size inside GitHub Actions to 6G
JVM_MEM = "-Xms6g -Xmx6g"
else
# If not specified, limit Java heap size ~32G
JVM_MEM ?= "-Xmx32736m -Xmx32736m"
endif


# Default recipe: route and score all given download-benchmarks
.PHONY: run-$(ROUTER)
Expand Down Expand Up @@ -65,7 +73,7 @@ fpga-interchange-schema/interchange/capnp/java.capnp:
# When inside GitHub Actions (which has no access to Vivado), and also when the routed netlist
# was successfully converted back into a DCP, then return a mock PASS result
%_$(ROUTER).check: %.netlist %_$(ROUTER).phys | compile-java
( ( (_JAVA_OPTIONS="-Xms6g -Xmx6g" ./gradlew -Dmain=com.xilinx.fpga24_routing_contest.CheckPhysNetlist :run --args='$^' $(call log_and_or_display,$@.log)) && echo "PASS" ) || echo "FAIL") > $@
( ( (GRADLE_OPTS="-Xms6g -Xmx6g" ./gradlew -Dmain=com.xilinx.fpga24_routing_contest.CheckPhysNetlist :run --args='$^' $(call log_and_or_display,$@.log)) && echo "PASS" ) || echo "FAIL") > $@
[ -z "${GITHUB_ACTION}" ] || [ ! -f "$(patsubst %.check,%.dcp,$@)" ] || echo "PASS" > $@

.PHONY: score-$(ROUTER)
Expand All @@ -86,12 +94,11 @@ distclean: clean
#### BEGIN ROUTER RECIPES

## RWROUTE
# _JAVA_OPTIONS="-Xms32736m -Xmx32736m" sets the initial and maximum heap size of the JVM to be ~32GB
# /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 log_and_or_displaying all output into %_rwroute.phys.log
%_rwroute.phys: %_unrouted.phys | compile-java
(_JAVA_OPTIONS="-Xms6g -Xmx6g" /usr/bin/time ./gradlew -Dmain=com.xilinx.fpga24_routing_contest.PartialRouterPhysNetlist :run --args='$< $@') $(call log_and_or_display,$@.log)
(GRADLE_OPTS="$(JVM_MEM)" /usr/bin/time ./gradlew -Dmain=com.xilinx.fpga24_routing_contest.PartialRouterPhysNetlist :run --args='$< $@') $(call log_and_or_display,$@.log)

## NXROUTE-POC
%_nxroute-poc.phys: %_unrouted.phys xcvu3p.device | nxroute-deps fpga-interchange-schema/interchange/capnp/java.capnp
Expand Down

0 comments on commit 5213f8b

Please sign in to comment.