Skip to content

Commit

Permalink
Repo sync (#4)
Browse files Browse the repository at this point in the history
* repo-sync-2023-12-01T14:55:23+0800

* Update repositories.bzl

* Update repositories.bzl

* Update repositories.bzl
  • Loading branch information
anakinxc committed Dec 2, 2023
1 parent 682996e commit 7b4637c
Show file tree
Hide file tree
Showing 58 changed files with 13,247 additions and 257 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ build --copt=-fstack-protector-strong
build:linux --copt=-Wl,-z,noexecstack
build:macos --copt=-Wa,--noexecstack


test --keep_going
test --test_output=errors

Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.1
6.4.0
22 changes: 3 additions & 19 deletions bazel/psi.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ warpper bazel cc_xx to modify flags.
"""

load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake", "configure_make")
load("@yacl//bazel:yacl.bzl", "OMP_LINK_FLAGS", "yacl_cmake_external")

WARNING_FLAGS = [
"-Wall",
Expand Down Expand Up @@ -50,29 +50,17 @@ def psi_cc_library(
linkopts = [],
copts = [],
deps = [],
local_defines = [],
**kargs):
cc_library(
linkopts = linkopts,
copts = _psi_copts() + copts,
deps = deps + [
"@com_github_gabime_spdlog//:spdlog",
],
local_defines = local_defines + [
"PSI_BUILD",
],
] + OMP_LINK_FLAGS,
**kargs
)

def psi_cmake_external(**attrs):
if "generate_args" not in attrs:
attrs["generate_args"] = ["-GNinja"]
return cmake(**attrs)

def psi_configure_make(**attrs):
if "args" not in attrs:
attrs["args"] = ["-j 4"]
return configure_make(**attrs)
psi_cmake_external = yacl_cmake_external

def _psi_version_file_impl(ctx):
out = ctx.actions.declare_file(ctx.attr.filename)
Expand All @@ -94,7 +82,6 @@ def psi_cc_test(
linkopts = [],
copts = [],
deps = [],
local_defines = [],
**kwargs):
cc_test(
# -lm for tcmalloc
Expand All @@ -103,8 +90,5 @@ def psi_cc_test(
deps = deps + [
"@com_google_googletest//:gtest_main",
],
local_defines = local_defines + [
"PSI_BUILD",
],
**kwargs
)
15 changes: 1 addition & 14 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

SECRETFLOW_GIT = "https://github.com/secretflow"

YACL_COMMIT_ID = "3baea619ae3f67911d7f072ff7dd39bc6a00ec28"
YACL_COMMIT_ID = "8492bdf8c39444262fdb53b5fdf19a0b75f0356a"

def psi_deps():
_com_github_nelhage_rules_boost()
Expand Down Expand Up @@ -56,19 +56,6 @@ def psi_deps():
remote = "{}/yacl.git".format(SECRETFLOW_GIT),
)

# Add homebrew openmp for macOS, somehow..homebrew installs to different location on Apple Silcon/Intel macs.. so we need two rules here
native.new_local_repository(
name = "local_homebrew_x64",
build_file = "@psi//bazel:local_openmp_macos.BUILD",
path = "/usr/local/opt/libomp",
)

native.new_local_repository(
name = "local_homebrew_arm64",
build_file = "@psi//bazel:local_openmp_macos.BUILD",
path = "/opt/homebrew/opt/libomp/",
)

def _bazel_platform():
http_archive(
name = "platforms",
Expand Down
61 changes: 61 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 2021 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:psi.bzl", "psi_cc_binary", "psi_cc_library")

package(default_visibility = ["//visibility:public"])

psi_cc_library(
name = "utils",
srcs = ["utils.cc"],
hdrs = ["utils.h"],
deps = [
"@com_github_gflags_gflags//:gflags",
"@com_google_absl//absl/strings",
"@yacl//yacl/link:factory",
],
)

psi_cc_binary(
name = "simple_in_memory_psi",
srcs = ["simple_in_memory_psi.cc"],
deps = [
":utils",
"@psi//psi/psi/core:ecdh_psi",
],
)

psi_cc_binary(
name = "simple_psi",
srcs = ["simple_psi.cc"],
data = [
"//examples/data:psi",
],
deps = [
":utils",
"@psi//psi/psi:bucket_psi",
],
)

psi_cc_binary(
name = "simple_dp_psi",
srcs = ["simple_dp_psi.cc"],
data = [
"//examples/data:psi",
],
deps = [
":utils",
"@psi//psi/psi/core/dp_psi",
],
)
16 changes: 6 additions & 10 deletions bazel/local_openmp_macos.BUILD → examples/data/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Ant Group Co., Ltd.
# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,16 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:defs.bzl", "cc_library")
package(default_visibility = ["//visibility:public"])

cc_library(
name = "openmp",
filegroup(
name = "psi",
srcs = [
"lib/libomp.a",
"psi_1.csv",
"psi_2.csv",
],
hdrs = ["include/omp.h"],
includes = [
"include/",
],
visibility = ["//visibility:public"],
)
10 changes: 10 additions & 0 deletions examples/data/pir_client_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
id,id1
0000000014,111111
0000002335,111111
0000003435,111111
0000005002,111111
0000007005,111111
0000007075,111111
0000007464,111111
0000007993,111111
0000008964,111111
Loading

0 comments on commit 7b4637c

Please sign in to comment.