Skip to content

Commit 6e67a19

Browse files
authored
Huocun/self main (#206)
* add prefix to patch ref * fix config issues * add io_flush * delete funny enforce
1 parent 8a129e7 commit 6e67a19

File tree

6 files changed

+62
-59
lines changed

6 files changed

+62
-59
lines changed

bazel/psi.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ FAST_FLAGS = ["-O1"]
3030

3131
def _psi_copts():
3232
return select({
33-
"//bazel:psi_build_as_release": RELEASE_FLAGS,
34-
"//bazel:psi_build_as_debug": DEBUG_FLAGS,
35-
"//bazel:psi_build_as_fast": FAST_FLAGS,
33+
"@psi//bazel:psi_build_as_release": RELEASE_FLAGS,
34+
"@psi//bazel:psi_build_as_debug": DEBUG_FLAGS,
35+
"@psi//bazel:psi_build_as_fast": FAST_FLAGS,
3636
"//conditions:default": FAST_FLAGS,
3737
}) + WARNING_FLAGS
3838

bazel/repositories.bzl

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _com_github_facebook_zstd():
7272
maybe(
7373
http_archive,
7474
name = "com_github_facebook_zstd",
75-
build_file = "//bazel:zstd.BUILD",
75+
build_file = "@psi//bazel:zstd.BUILD",
7676
strip_prefix = "zstd-1.5.5",
7777
sha256 = "98e9c3d949d1b924e28e01eccb7deed865eefebf25c2f21c702e5cd5b63b85e1",
7878
type = ".tar.gz",
@@ -93,7 +93,7 @@ def _upb():
9393
],
9494
patch_args = ["-p1"],
9595
patches = [
96-
"//bazel/patches:upb.patch",
96+
"@psi//bazel/patches:upb.patch",
9797
],
9898
)
9999

@@ -106,14 +106,14 @@ def _com_github_emptoolkit_emp_tool():
106106
type = "tar.gz",
107107
patch_args = ["-p1"],
108108
patches = [
109-
"//bazel/patches:emp-tool.patch",
110-
"//bazel/patches:emp-tool-cmake.patch",
111-
"//bazel/patches:emp-tool-sse2neon.patch",
109+
"@psi//bazel/patches:emp-tool.patch",
110+
"@psi//bazel/patches:emp-tool-cmake.patch",
111+
"@psi//bazel/patches:emp-tool-sse2neon.patch",
112112
],
113113
urls = [
114114
"https://github.com/emp-toolkit/emp-tool/archive/refs/tags/0.2.5.tar.gz",
115115
],
116-
build_file = "//bazel:emp-tool.BUILD",
116+
build_file = "@psi//bazel:emp-tool.BUILD",
117117
)
118118

119119
def _com_github_intel_ipp():
@@ -122,10 +122,10 @@ def _com_github_intel_ipp():
122122
name = "com_github_intel_ipp",
123123
sha256 = "d70f42832337775edb022ca8ac1ac418f272e791ec147778ef7942aede414cdc",
124124
strip_prefix = "cryptography-primitives-ippcp_2021.8",
125-
build_file = "//bazel:ipp.BUILD",
125+
build_file = "@psi//bazel:ipp.BUILD",
126126
patch_args = ["-p1"],
127127
patches = [
128-
"//bazel/patches:ippcp.patch",
128+
"@psi//bazel/patches:ippcp.patch",
129129
],
130130
urls = [
131131
"https://github.com/intel/cryptography-primitives/archive/refs/tags/ippcp_2021.8.tar.gz",
@@ -140,11 +140,11 @@ def _com_github_microsoft_seal():
140140
strip_prefix = "SEAL-4.1.1",
141141
type = "tar.gz",
142142
patch_args = ["-p1"],
143-
patches = ["//bazel/patches:seal.patch"],
143+
patches = ["@psi//bazel/patches:seal.patch"],
144144
urls = [
145145
"https://github.com/microsoft/SEAL/archive/refs/tags/v4.1.1.tar.gz",
146146
],
147-
build_file = "//bazel:seal.BUILD",
147+
build_file = "@psi//bazel:seal.BUILD",
148148
)
149149

150150
def _com_github_microsoft_apsi():
@@ -156,11 +156,11 @@ def _com_github_microsoft_apsi():
156156
urls = [
157157
"https://github.com/microsoft/APSI/archive/refs/tags/v0.11.0.tar.gz",
158158
],
159-
build_file = "//bazel:microsoft_apsi.BUILD",
159+
build_file = "@psi//bazel:microsoft_apsi.BUILD",
160160
patch_args = ["-p1"],
161161
patches = [
162-
"//bazel/patches:apsi.patch",
163-
"//bazel/patches:apsi-fourq.patch",
162+
"@psi//bazel/patches:apsi.patch",
163+
"@psi//bazel/patches:apsi-fourq.patch",
164164
],
165165
patch_cmds = [
166166
"rm -rf common/apsi/fourq",
@@ -177,7 +177,7 @@ def _com_github_microsoft_gsl():
177177
urls = [
178178
"https://github.com/microsoft/GSL/archive/refs/tags/v4.0.0.tar.gz",
179179
],
180-
build_file = "//bazel:microsoft_gsl.BUILD",
180+
build_file = "@psi//bazel:microsoft_gsl.BUILD",
181181
)
182182

183183
def _com_github_microsoft_kuku():
@@ -190,7 +190,7 @@ def _com_github_microsoft_kuku():
190190
urls = [
191191
"https://github.com/microsoft/Kuku/archive/refs/tags/v2.1.0.tar.gz",
192192
],
193-
build_file = "//bazel:microsoft_kuku.BUILD",
193+
build_file = "@psi//bazel:microsoft_kuku.BUILD",
194194
)
195195

196196
def _com_google_flatbuffers():
@@ -208,7 +208,7 @@ def _com_google_flatbuffers():
208208
"rm grpc/src/compiler/BUILD.bazel",
209209
"rm src/BUILD.bazel",
210210
],
211-
build_file = "//bazel:flatbuffers.BUILD",
211+
build_file = "@psi//bazel:flatbuffers.BUILD",
212212
)
213213

214214
def _org_apache_arrow():
@@ -220,7 +220,7 @@ def _org_apache_arrow():
220220
],
221221
sha256 = "2852b21f93ee84185a9d838809c9a9c41bf6deca741bed1744e0fdba6cc19e3f",
222222
strip_prefix = "arrow-apache-arrow-10.0.0",
223-
build_file = "//bazel:arrow.BUILD",
223+
build_file = "@psi//bazel:arrow.BUILD",
224224
)
225225

226226
def _com_github_grpc_grpc():
@@ -231,7 +231,7 @@ def _com_github_grpc_grpc():
231231
strip_prefix = "grpc-1.51.0",
232232
type = "tar.gz",
233233
patch_args = ["-p1"],
234-
patches = ["//bazel/patches:grpc.patch"],
234+
patches = ["@psi//bazel/patches:grpc.patch"],
235235
urls = [
236236
"https://github.com/grpc/grpc/archive/refs/tags/v1.51.0.tar.gz",
237237
],
@@ -246,7 +246,7 @@ def _com_github_nelhage_rules_boost():
246246
sha256 = "a7c42df432fae9db0587ff778d84f9dc46519d67a984eff8c79ae35e45f277c1",
247247
strip_prefix = "rules_boost-%s" % RULES_BOOST_COMMIT,
248248
patch_args = ["-p1"],
249-
patches = ["//bazel/patches:boost.patch"],
249+
patches = ["@psi//bazel/patches:boost.patch"],
250250
urls = [
251251
"https://github.com/nelhage/rules_boost/archive/%s.tar.gz" % RULES_BOOST_COMMIT,
252252
],
@@ -261,7 +261,7 @@ def _com_github_tencent_rapidjson():
261261
],
262262
sha256 = "bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e",
263263
strip_prefix = "rapidjson-1.1.0",
264-
build_file = "//bazel:rapidjson.BUILD",
264+
build_file = "@psi//bazel:rapidjson.BUILD",
265265
)
266266

267267
def _com_github_xtensor_xsimd():
@@ -274,14 +274,14 @@ def _com_github_xtensor_xsimd():
274274
sha256 = "d52551360d37709675237d2a0418e28f70995b5b7cdad7c674626bcfbbf48328",
275275
type = "tar.gz",
276276
strip_prefix = "xsimd-8.1.0",
277-
build_file = "//bazel:xsimd.BUILD",
277+
build_file = "@psi//bazel:xsimd.BUILD",
278278
)
279279

280280
def _brotli():
281281
maybe(
282282
http_archive,
283283
name = "brotli",
284-
build_file = "//bazel:brotli.BUILD",
284+
build_file = "@psi//bazel:brotli.BUILD",
285285
sha256 = "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff",
286286
strip_prefix = "brotli-1.1.0",
287287
urls = [
@@ -299,14 +299,14 @@ def _com_github_lz4_lz4():
299299
sha256 = "030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1",
300300
type = "tar.gz",
301301
strip_prefix = "lz4-1.9.3",
302-
build_file = "//bazel:lz4.BUILD",
302+
build_file = "@psi//bazel:lz4.BUILD",
303303
)
304304

305305
def _org_apache_thrift():
306306
maybe(
307307
http_archive,
308308
name = "org_apache_thrift",
309-
build_file = "//bazel:thrift.BUILD",
309+
build_file = "@psi//bazel:thrift.BUILD",
310310
sha256 = "31e46de96a7b36b8b8a457cecd2ee8266f81a83f8e238a9d324d8c6f42a717bc",
311311
strip_prefix = "thrift-0.21.0",
312312
urls = [
@@ -320,7 +320,7 @@ def _com_google_double_conversion():
320320
name = "com_google_double_conversion",
321321
sha256 = "04ec44461850abbf33824da84978043b22554896b552c5fd11a9c5ae4b4d296e",
322322
strip_prefix = "double-conversion-3.3.0",
323-
build_file = "//bazel:double-conversion.BUILD",
323+
build_file = "@psi//bazel:double-conversion.BUILD",
324324
urls = [
325325
"https://github.com/google/double-conversion/archive/refs/tags/v3.3.0.tar.gz",
326326
],
@@ -330,7 +330,7 @@ def _bzip2():
330330
maybe(
331331
http_archive,
332332
name = "bzip2",
333-
build_file = "//bazel:bzip2.BUILD",
333+
build_file = "@psi//bazel:bzip2.BUILD",
334334
sha256 = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269",
335335
strip_prefix = "bzip2-1.0.8",
336336
urls = [
@@ -347,7 +347,7 @@ def _com_github_google_snappy():
347347
],
348348
sha256 = "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7",
349349
strip_prefix = "snappy-1.1.9",
350-
build_file = "//bazel:snappy.BUILD",
350+
build_file = "@psi//bazel:snappy.BUILD",
351351
)
352352

353353
def _com_github_google_perfetto():
@@ -360,8 +360,8 @@ def _com_github_google_perfetto():
360360
sha256 = "4c8fe8a609fcc77ca653ec85f387ab6c3a048fcd8df9275a1aa8087984b89db8",
361361
strip_prefix = "perfetto-41.0",
362362
patch_args = ["-p1"],
363-
patches = ["//bazel/patches:perfetto.patch"],
364-
build_file = "//bazel:perfetto.BUILD",
363+
patches = ["@psi//bazel/patches:perfetto.patch"],
364+
build_file = "@psi//bazel:perfetto.BUILD",
365365
)
366366

367367
def _com_github_floodyberry_curve25519_donna():
@@ -371,7 +371,7 @@ def _com_github_floodyberry_curve25519_donna():
371371
strip_prefix = "curve25519-donna-2fe66b65ea1acb788024f40a3373b8b3e6f4bbb2",
372372
sha256 = "ba57d538c241ad30ff85f49102ab2c8dd996148456ed238a8c319f263b7b149a",
373373
type = "tar.gz",
374-
build_file = "//bazel:curve25519-donna.BUILD",
374+
build_file = "@psi//bazel:curve25519-donna.BUILD",
375375
urls = [
376376
"https://github.com/floodyberry/curve25519-donna/archive/2fe66b65ea1acb788024f40a3373b8b3e6f4bbb2.tar.gz",
377377
],
@@ -386,7 +386,7 @@ def _com_github_ridiculousfish_libdivide():
386386
],
387387
sha256 = "01ffdf90bc475e42170741d381eb9cfb631d9d7ddac7337368bcd80df8c98356",
388388
strip_prefix = "libdivide-5.0",
389-
build_file = "//bazel:libdivide.BUILD",
389+
build_file = "@psi//bazel:libdivide.BUILD",
390390
)
391391

392392
def _com_github_sparsehash_sparsehash():
@@ -398,14 +398,14 @@ def _com_github_sparsehash_sparsehash():
398398
],
399399
sha256 = "8cd1a95827dfd8270927894eb77f62b4087735cbede953884647f16c521c7e58",
400400
strip_prefix = "sparsehash-sparsehash-2.0.4",
401-
build_file = "//bazel:sparsehash.BUILD",
401+
build_file = "@psi//bazel:sparsehash.BUILD",
402402
)
403403

404404
def _com_github_zeromq_cppzmq():
405405
maybe(
406406
http_archive,
407407
name = "com_github_zeromq_cppzmq",
408-
build_file = "//bazel:cppzmq.BUILD",
408+
build_file = "@psi//bazel:cppzmq.BUILD",
409409
strip_prefix = "cppzmq-4.10.0",
410410
sha256 = "c81c81bba8a7644c84932225f018b5088743a22999c6d82a2b5f5cd1e6942b74",
411411
type = ".tar.gz",
@@ -418,7 +418,7 @@ def _com_github_zeromq_libzmq():
418418
maybe(
419419
http_archive,
420420
name = "com_github_zeromq_libzmq",
421-
build_file = "//bazel:libzmq.BUILD",
421+
build_file = "@psi//bazel:libzmq.BUILD",
422422
strip_prefix = "libzmq-4.3.5",
423423
sha256 = "6c972d1e6a91a0ecd79c3236f04cf0126f2f4dfbbad407d72b4606a7ba93f9c6",
424424
type = ".tar.gz",
@@ -431,7 +431,7 @@ def _com_github_log4cplus_log4cplus():
431431
maybe(
432432
http_archive,
433433
name = "com_github_log4cplus_log4cplus",
434-
build_file = "//bazel:log4cplus.BUILD",
434+
build_file = "@psi//bazel:log4cplus.BUILD",
435435
strip_prefix = "log4cplus-2.1.1",
436436
sha256 = "42dc435928917fd2f847046c4a0c6086b2af23664d198c7fc1b982c0bfe600c1",
437437
type = ".tar.gz",
@@ -444,7 +444,7 @@ def _com_github_open_source_parsers_jsoncpp():
444444
maybe(
445445
http_archive,
446446
name = "com_github_open_source_parsers_jsoncpp",
447-
build_file = "//bazel:jsoncpp.BUILD",
447+
build_file = "@psi//bazel:jsoncpp.BUILD",
448448
strip_prefix = "jsoncpp-1.9.6",
449449
sha256 = "f93b6dd7ce796b13d02c108bc9f79812245a82e577581c4c9aabe57075c90ea2",
450450
type = ".tar.gz",

psi/interface.cc

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,6 @@ void AbstractPsiParty::CheckSelfConfig() {
219219
YACL_ENFORCE_EQ(static_cast<int>(keys_set.size()), config_.keys().size(),
220220
"Duplicated key is not allowed.");
221221

222-
if (!config_.protocol_config().broadcast_result() &&
223-
config_.advanced_join_type() !=
224-
v2::PsiConfig::ADVANCED_JOIN_TYPE_UNSPECIFIED) {
225-
SPDLOG_WARN(
226-
"broadcast_result turns off while advanced join is enabled. "
227-
"broadcast_result is modified to true since intersection has to be "
228-
"sent to both parties.");
229-
230-
YACL_ENFORCE(!config_.output_config().path().empty(),
231-
"You have to provide path of output.");
232-
233-
config_.mutable_protocol_config()->set_broadcast_result(true);
234-
}
235-
236222
if (!config_.skip_duplicates_check() &&
237223
config_.advanced_join_type() !=
238224
v2::PsiConfig::ADVANCED_JOIN_TYPE_UNSPECIFIED) {

psi/utils/join_processor.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,17 @@ JoinProcessor::JoinProcessor(const v2::UbPsiConfig& ub_psi_config,
121121
v2::UbPsiConfig::MODE_FULL,
122122
};
123123

124-
if (gen_output_mode.find(ub_psi_config.mode()) != gen_output_mode.end()) {
125-
YACL_ENFORCE(
126-
ub_psi_config.output_config().type() == v2::IoType::IO_TYPE_FILE_CSV,
127-
"unsupport output format {}",
128-
v2::IoType_Name(ub_psi_config.input_config().type()));
129-
output_path_ = ub_psi_config.output_config().path();
124+
bool gen_output =
125+
(role_ == v2::ROLE_SERVER && ub_psi_config.server_get_result()) ||
126+
(role_ == v2::ROLE_CLIENT && ub_psi_config.client_get_result());
127+
if (gen_output) {
128+
if (gen_output_mode.find(ub_psi_config.mode()) != gen_output_mode.end()) {
129+
YACL_ENFORCE(
130+
ub_psi_config.output_config().type() == v2::IoType::IO_TYPE_FILE_CSV,
131+
"unsupport output format {}",
132+
v2::IoType_Name(ub_psi_config.input_config().type()));
133+
output_path_ = ub_psi_config.output_config().path();
134+
}
130135
}
131136

132137
if (!std::filesystem::exists(ub_psi_config.cache_path())) {
@@ -265,6 +270,7 @@ std::shared_ptr<KeyInfo> JoinProcessor::GetUniqueKeysInfo() {
265270
KeyInfo::StatInfo JoinProcessor::DealResultIndex(IndexReader& index) {
266271
ResultDumper dumper(sorted_intersect_path_, sorted_except_path_);
267272
auto stat = GetUniqueKeysInfo()->ApplyPeerDupCnt(index, dumper);
273+
dumper.Flush();
268274
if (is_input_key_unique_ && align_output_) {
269275
if (!sorted_intersect_path_.empty()) {
270276
Table::MakeFromCsv(sorted_intersect_path_)

psi/utils/table_utils.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,15 @@ void ResultDumper::Dump(const std::string& line, int64_t duplicate_cnt,
481481
}
482482
}
483483

484+
void ResultDumper::Flush() {
485+
if (intersect_file_) {
486+
intersect_file_->flush();
487+
}
488+
if (except_file_) {
489+
except_file_->flush();
490+
}
491+
}
492+
484493
std::vector<std::string> KeyInfo::SourceFileColumns() const {
485494
return table_->Columns();
486495
}

psi/utils/table_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ struct ResultDumper {
129129
int64_t except_cnt() const { return except_cnt_; }
130130
int64_t intersect_cnt() const { return intersect_cnt_; }
131131

132+
void Flush();
133+
132134
private:
133135
void Dump(const std::string& line, int64_t duplicate_cnt,
134136
std::shared_ptr<std::ofstream>& file, int64_t* total_dump_cnt);

0 commit comments

Comments
 (0)