From 4aca025b867223de667d32d9104add0a322cf83c Mon Sep 17 00:00:00 2001 From: xu-shawn <50402888+xu-shawn@users.noreply.github.com> Date: Tue, 13 Aug 2024 16:42:48 -0700 Subject: [PATCH] Fix Build on Older Workers (#114) Elo | 10.78 +- 6.75 (95%) SPRT | 8.0+0.08s Threads=1 Hash=8MB LLR | 2.98 (-2.94, 2.94) [-5.00, 0.00] Games | N: 3418 W: 896 L: 790 D: 1732 Penta | [34, 371, 809, 445, 50] https://chess.aronpetkovski.com/test/2826/ bench 1849271 --- Makefile | 3 +-- Serendipity/pom.xml | 4 ++-- .../org/shawn/games/Serendipity/UCI/UCI.java | 2 +- header.sh | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 header.sh diff --git a/Makefile b/Makefile index ed783e5d..4769cd91 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,5 @@ ifdef EVALFILE cp $(EVALFILE) ./Serendipity/src/main/resources/embedded.nnue endif mvn -f ./Serendipity/pom.xml package - echo "#!/usr/bin/env -S java -jar -Xmx128m" > $(EXE) - cat ./Serendipity/target/Serendipity-Test.jar >> $(EXE) + cat header.sh ./Serendipity/target/Serendipity-Test.jar > $(EXE) chmod +x $(EXE) diff --git a/Serendipity/pom.xml b/Serendipity/pom.xml index 7229063f..f4f5b0e6 100644 --- a/Serendipity/pom.xml +++ b/Serendipity/pom.xml @@ -14,8 +14,8 @@ UTF-8 - 17 - 17 + 8 + 8 Test diff --git a/Serendipity/src/main/java/org/shawn/games/Serendipity/UCI/UCI.java b/Serendipity/src/main/java/org/shawn/games/Serendipity/UCI/UCI.java index 61255558..942ebef7 100644 --- a/Serendipity/src/main/java/org/shawn/games/Serendipity/UCI/UCI.java +++ b/Serendipity/src/main/java/org/shawn/games/Serendipity/UCI/UCI.java @@ -71,7 +71,7 @@ public void set(String value) public static void main(String args[]) { - transpositionTable = new TranspositionTable(32); + transpositionTable = new TranspositionTable(4); options = new HashMap<>(); networkName = new NNUEOption("embedded.nnue", "nnuefile"); threads = new IntegerOption(1, 1, 1, "Threads"); diff --git a/header.sh b/header.sh new file mode 100644 index 00000000..2c49281b --- /dev/null +++ b/header.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Taken from https://web.archive.org/web/20240813210415/https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable + +MYSELF=`which "$0" 2>/dev/null` + +[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0" + +java=java + +if test -n "$JAVA_HOME"; then + java="$JAVA_HOME/bin/java" +fi + +exec "$java" -Xms48m -Xmx48m -XX:+UseParallelGC $java_args -jar $MYSELF "$@" + +exit 1