Open Bankee-256 opened 2 days ago
You can start the network by calling "SetupBrpcWorld" instead of "SetupWorld". This will start the local ports 10086 and 10087. Note that the traffic volume does not seem to be accurate when using SetupBrpcWorld (so we do not use SetupBrpcWorld in this repo), but it is enough to simulate a WAN using "tc". The traffic volume is shown in the value when calling "SetupWorld". @Bankee-256
@Bankee-256 The following indicates that the UPSI in a real network has been successful.
Thanks for the guidance! I was able to run the program under WAN conditions. However, when I set the bandwidth to 200Mbit and the delay to 40ms, I noticed that the UPSI time feels unusually long, as highlighted in the red box in the attached image. Could you help me understand what might be causing this extended runtime?
It's normal in my local area. I don't know what went wrong at the moment because the information you provided is limited. I will try debugging to find out why you are having problems. @Bankee-256
I’m running the program in a Docker container (shallmate/upsi). I made a modification in main.cc, replacing SetupWorld with SetupBrpcWorld.
When building, I initially encountered an issue using bazel build --linkopt=-ldl //...
, so I switched to bazel build --linkopt="-L/usr/lib64" --linkopt="-ldl" --cxxopt="-std=c++17" //... --experimental_cc_shared_library
, which allowed the build to complete successfully.
After applying the tc command to set bandwidth and delay as discussed, I ran ./bazel-bin/examples/upsi/upsi. However, the UPSI time in the output appears quite high.
void RunUPSI() {
const uint64_t num = 1 << 22;
const uint64_t addnum = 1 << 8;
const uint64_t subnum = 1 << 8;
SPDLOG_INFO("|X| = |Y|: {}", num);
SPDLOG_INFO("|X^+| = |Y^+|: {}", addnum);
SPDLOG_INFO("|X^-| = |Y^-|: {}", subnum);
size_t bin_size = num;
size_t weight = 3;
size_t ssp = 40;
okvs::Baxos baxos;
yacl::crypto::Prg
SPDLOG_INFO("baxos.size(): {}", baxos.size());
std::vector
auto sender_stats = lctxs[0]->GetStats();
auto receiver_stats = lctxs[1]->GetStats();
std::cout << "Base PSI Sender sent bytes: "
<< bytesToMB(sender_stats->sent_bytes.load()) << " MB" << std::endl;
std::cout << "Base PSI Sender received bytes: "
<< bytesToMB(sender_stats->recv_bytes.load()) << " MB" << std::endl;
std::cout << "Base PSI Receiver sent bytes: "
<< bytesToMB(receiver_stats->sent_bytes.load()) << " MB"
<< std::endl;
std::cout << "Base PSI Receiver received bytes: "
<< bytesToMB(receiver_stats->recv_bytes.load()) << " MB"
<< std::endl;
std::cout << "Base PSI Total Communication: "
<< bytesToMB(receiver_stats->sent_bytes.load()) +
bytesToMB(receiver_stats->recv_bytes.load())
<< " MB" << std::endl;
auto start_time = std::chrono::high_resolution_clock::now();
EcdhReceiver yaddreceiver;
EcdhSender yaddsender;
yaddsender.UpdatePRFs(absl::MakeSpan(X));
EcdhReceiver xaddreceiver;
EcdhSender xaddsender;
xaddsender.UpdatePRFs(absl::MakeSpan(Y));
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration
std::future<std::vector
You can try changing RunUPSI to the above. I think it may solve your problem. @Bankee-256
Thank you for the RunUPSI
function! I made the suggested modifications, changing static_cast(bytes)
to static_cast<double>(bytes)
and std::chrono::duration
to std::chrono::duration<double>
. However, I’m still encountering the same issue with high UPSI times. I suspect that network delay may be contributing to the problem, but I'm unsure of the best way to address or mitigate this. Any additional guidance would be greatly appreciated!
Hello, you can clone the latest upsi code into the container and recompile it. I believe it will work properly. Previously, it seemed that the remote PSU implementation was inconsistent with my local one. The specific method is to delete the upsi in the examples directory, then clone it again in the examples directory, and recompile it. @Bankee-256
Thank you again for your help! The code runs well with an initial set size $\geq 2^{20}$. However, when the initial set size is below $2^{20}$, the issue reoccurs, especially when network delay is added. I’m still encountering the same timeout error:
terminate called after throwing an instance of 'yacl::IoError'
what(): [yacl/link/transport/channel.cc:427] Get data timeout, key=root:P2P-37:0->1
Aborted (core dumped)
Hi! I am trying to run your program on two terminals to adapt to WAN network conditions. I've used the
tc
command to limit the network bandwidth, but it seems that runningbazel-bin/examples/upsi/upsi
alone doesn’t rely on the network. Do you have any recommendations on how to run this program on two terminals to better simulate and adapt to a WAN environment?