Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PSI aarch64 linux issues #10

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ jobs:
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: secretflow/ubuntu-base-ci:latest
resource_class: 2xlarge+
parameters:
resource_class:
type: string
resource_class: << parameters.resource_class >>
shell: /bin/bash --login -eo pipefail
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
Expand All @@ -54,12 +57,15 @@ jobs:
command: sh ../devtools/decompress-build-cache.sh psi_build_cache
- run:
name: "build"
command: bazel build //... -c opt --ui_event_filters=-info,-debug,-warning --disk_cache=~/.cache/psi_build_cache --jobs 20
command: |
source ~/miniconda3/bin/activate base
bazel build //... -c opt --ui_event_filters=-info,-debug,-warning --disk_cache=~/.cache/psi_build_cache --jobs 20
- run:
name: "test"
command: |
set +e
declare -i test_status
source ~/miniconda3/bin/activate base
bazel test //... -c opt --ui_event_filters=-info,-debug,-warning --test_output=errors --disk_cache=~/.cache/psi_build_cache | tee test_result.log; test_status=${PIPESTATUS[0]}

sh ../devtools/rename-junit-xml.sh
Expand Down Expand Up @@ -141,5 +147,8 @@ workflows:
unittest:
when: << pipeline.parameters.build-and-run >>
jobs:
- linux_ut
- linux_ut:
matrix:
parameters:
resource_class: ["2xlarge", "arm-xlarge"]
- macos_ut
40 changes: 34 additions & 6 deletions bazel/patches/apsi.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
From c0ce586da1f98b8603e001852b2f467353a728b4 Mon Sep 17 00:00:00 2001
From: anakinxc <zhengyancheng.zyc@alibaba-inc.com>
Date: Sun, 10 Dec 2023 15:32:12 +0800
Subject: [PATCH] patch

---
CMakeLists.txt | 27 +++------------------------
1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78d54a6..07df321 100644
index 78d54a6..51ec679 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,24 +140,6 @@ else()
@@ -140,25 +140,6 @@ else()
message(STATUS "Microsoft Kuku: found")
endif()

-# Flatbuffers
-find_package(Flatbuffers REQUIRED)
-if(NOT Flatbuffers_FOUND)
Expand All @@ -24,11 +33,12 @@ index 78d54a6..07df321 100644
-else()
- message(STATUS "jsoncpp: found")
-endif()

-
# [Option] APSI_USE_LOG4CPLUS (default: ON)
set(APSI_USE_LOG4CPLUS_OPTION_STR "Use Log4cplus for logging")
@@ -263,9 +245,7 @@ apsi_install_target(apsi APSITargets)

option(APSI_USE_LOG4CPLUS ${APSI_USE_LOG4CPLUS_OPTION_STR} ON)
@@ -263,9 +244,7 @@ apsi_install_target(apsi APSITargets)

target_link_libraries(apsi
PUBLIC SEAL::seal
- PUBLIC Kuku::kuku
Expand All @@ -38,6 +48,24 @@ index 78d54a6..07df321 100644
if(APSI_USE_LOG4CPLUS)
target_link_libraries(apsi PUBLIC log4cplus::log4cplus)
endif()
@@ -299,7 +278,7 @@ endif()
if(APSI_FOURQ_AMD64)
target_compile_options(apsi PUBLIC -D_AMD64_)
message(STATUS "FourQlib optimization: arch=AMD64")
-elseif(APSI_FOURQ_ARM64 AND UNIX)
+elseif(APSI_FOURQ_ARM64 AND UNIX AND APPLE)
message(STATUS "FourQlib optimization: arch=ARM64")
else()
target_compile_options(apsi PUBLIC -D_GENERIC_)
@@ -326,7 +305,7 @@ else()
endif()

# Use optimized assembly on UNIX
-if(APSI_USE_ASM AND UNIX AND NOT APPLE AND NOT CYGWIN AND NOT MINGW)
+if(APSI_FOURQ_AMD64 AND APSI_USE_ASM AND UNIX AND NOT APPLE AND NOT CYGWIN AND NOT MINGW)
check_language(ASM)
if(CMAKE_ASM_COMPILER)
enable_language(ASM)
diff --git a/common/apsi/CMakeLists.txt b/common/apsi/CMakeLists.txt
index a65bbfe..ee3b975 100644
--- a/common/apsi/CMakeLists.txt
Expand Down
25 changes: 25 additions & 0 deletions bazel/patches/boost.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/config.lzma-linux.h b/config.lzma-linux.h
index e8b00d8..092696f 100644
--- a/config.lzma-linux.h
+++ b/config.lzma-linux.h
@@ -56,7 +56,9 @@
/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */

/* Define to 1 if you have the <cpuid.h> header file. */
-#define HAVE_CPUID_H 1
+#ifdef __x86_64__
+ #define HAVE_CPUID_H 1
+#endif

/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
@@ -309,7 +311,9 @@

/* Define to 1 if _mm_clmulepi64_si128 is usable. See configure.ac for
details. */
+#ifdef __x86_64__
#define HAVE_USABLE_CLMUL 1
+#endif

/* Define to 1 if you have the `utime' function. */
/* #undef HAVE_UTIME */
3 changes: 2 additions & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def _com_github_grpc_grpc():
strip_prefix = "grpc-1.51.0",
type = "tar.gz",
patch_args = ["-p1"],
# Set grpc to use local go toolchain
patches = ["@psi//bazel:patches/grpc.patch"],
urls = [
"https://github.com/grpc/grpc/archive/refs/tags/v1.51.0.tar.gz",
Expand All @@ -257,6 +256,8 @@ def _com_github_nelhage_rules_boost():
name = "com_github_nelhage_rules_boost",
sha256 = "a7c42df432fae9db0587ff778d84f9dc46519d67a984eff8c79ae35e45f277c1",
strip_prefix = "rules_boost-%s" % RULES_BOOST_COMMIT,
patch_args = ["-p1"],
patches = ["@psi//bazel:patches/boost.patch"],
urls = [
"https://github.com/nelhage/rules_boost/archive/%s.tar.gz" % RULES_BOOST_COMMIT,
],
Expand Down
Loading