From 221b80d8d02c12f801402d6d2e1f446474e0afb2 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 29 Apr 2024 17:39:07 -0400 Subject: [PATCH 1/3] Ensure gcc is newer >= 10.3.1 < 12.0.0 when building knn lib Signed-off-by: Peter Zhu --- scripts/build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index d2571efb6..f95646961 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -103,18 +103,25 @@ if [ "$JAVA_HOME" = "" ]; then echo "SET JAVA_HOME=$JAVA_HOME" fi -# Ensure gcc version is at least 12.0.0 for faiss 1.7.4+ / SIMD Neon support on ARM64 compilation +# Ensure gcc version is > 10.3.1 and < 12.0.0 for faiss 1.7.4+ / SIMD Neon support on ARM64 compilation # https://github.com/opensearch-project/k-NN/issues/975 # https://github.com/opensearch-project/k-NN/issues/1138 # https://github.com/opensearch-project/opensearch-build/issues/4386 # https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2067191682 +# https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2083623882 GCC_VERSION=`gcc --version | head -n 1 | cut -d ' ' -f3` -GCC_REQUIRED_VERSION=12.0.0 +GCC_REQUIRED_VERSION=10.3.1 COMPARE_VERSION=`echo $GCC_REQUIRED_VERSION $GCC_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` if [ "$COMPARE_VERSION" != "$GCC_REQUIRED_VERSION" ]; then echo "gcc version on this env is older than $GCC_REQUIRED_VERSION, exit 1" exit 1 fi +GCC_REQUIRED_VERSION_CEILING=12.0.0 +COMPARE_VERSION_CEILING=`echo $GCC_REQUIRED_VERSION_CEILING $GCC_VERSION | tr ' ' '\n' | sort -V | uniq | tail -n 1` +if [ "$COMPARE_VERSION_CEILING" != "$GCC_REQUIRED_VERSION_CEILING" ] && (echo "$OSTYPE" | grep -i linux); then + echo "gcc version on this env is newer than $GCC_REQUIRED_VERSION_CEILING, exit 1" + exit 1 +fi # Build k-NN lib and plugin through gradle tasks cd $work_dir From fc9203fb96f37b409d8eb277aaebd1809d47c5fc Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 29 Apr 2024 21:49:30 -0400 Subject: [PATCH 2/3] Switch to gcc11 as gcc10 is having bugs on arm64 Signed-off-by: Peter Zhu --- scripts/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index f95646961..ebe7e716b 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -103,14 +103,14 @@ if [ "$JAVA_HOME" = "" ]; then echo "SET JAVA_HOME=$JAVA_HOME" fi -# Ensure gcc version is > 10.3.1 and < 12.0.0 for faiss 1.7.4+ / SIMD Neon support on ARM64 compilation +# Ensure gcc version is > 11.2.1 and < 12.0.0 for faiss 1.7.4+ / SIMD Neon support on ARM64 compilation # https://github.com/opensearch-project/k-NN/issues/975 # https://github.com/opensearch-project/k-NN/issues/1138 # https://github.com/opensearch-project/opensearch-build/issues/4386 # https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2067191682 # https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2083623882 GCC_VERSION=`gcc --version | head -n 1 | cut -d ' ' -f3` -GCC_REQUIRED_VERSION=10.3.1 +GCC_REQUIRED_VERSION=11.2.1 COMPARE_VERSION=`echo $GCC_REQUIRED_VERSION $GCC_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` if [ "$COMPARE_VERSION" != "$GCC_REQUIRED_VERSION" ]; then echo "gcc version on this env is older than $GCC_REQUIRED_VERSION, exit 1" From dc9492eb4c6feba33f45e5ae074816c672aa023e Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 29 Apr 2024 21:51:35 -0400 Subject: [PATCH 3/3] Update comments Signed-off-by: Peter Zhu --- scripts/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build.sh b/scripts/build.sh index ebe7e716b..0b1419a93 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -109,6 +109,7 @@ fi # https://github.com/opensearch-project/opensearch-build/issues/4386 # https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2067191682 # https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2083623882 +# https://github.com/opensearch-project/opensearch-build/issues/4379#issuecomment-2084133839 GCC_VERSION=`gcc --version | head -n 1 | cut -d ' ' -f3` GCC_REQUIRED_VERSION=11.2.1 COMPARE_VERSION=`echo $GCC_REQUIRED_VERSION $GCC_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`