From 5213f8bcc9a896a8ea6dfed981a9882584362596 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 22 Sep 2023 14:44:10 -0700 Subject: [PATCH] Limit memory inside GitHub Actions --- Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a2f3121..a9994be 100644 --- a/Makefile +++ b/Makefile @@ -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) @@ -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) @@ -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