add mpc_test.sh and get it working

This commit is contained in:
Andrew Morris
2025-01-15 15:06:52 +11:00
parent b272c9b4ea
commit 0af266cf69
2 changed files with 33 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
using namespace std;
using namespace emp;
const string circuit_file_location = macro_xstr(EMP_CIRCUIT_PATH) + string("bristol_format/");
const string circuit_file_location = "circuits/sha-1.txt";;
static char out3[] = "92b404e556588ced6c1acd4ebf053f6809f73a93";//bafbc2c87c33322603f38e06c3e0f79c1f1b1475";
int main(int argc, char** argv) {
@@ -15,9 +15,7 @@ int main(int argc, char** argv) {
NetIOMP<nP> io2(party, port+2*(nP+1)*(nP+1)+1);
NetIOMP<nP> *ios[2] = {&io, &io2};
ThreadPool pool(4);
string file = circuit_file_location+"/AES-non-expanded.txt";
file = circuit_file_location+"/sha-1.txt";
BristolFormat cf(file.c_str());
BristolFormat cf(circuit_file_location.c_str());
CMPC<nP>* mpc = new CMPC<nP>(ios, &pool, party, &cf);
cout <<"Setup:\t"<<party<<"\n";

31
scripts/mpc_test.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -euo pipefail
# Define the programs to run
PROGRAM_A="./build/mpc 1 8005"
PROGRAM_B="./build/mpc 2 8005"
PROGRAM_C="./build/mpc 3 8005"
# Run 3 instances of the program in the background and print output as it comes
$PROGRAM_A 2>&1 | sed 's/^/A: /' &
PID1=$!
$PROGRAM_B 2>&1 | sed 's/^/B: /' &
PID2=$!
$PROGRAM_C 2>&1 | sed 's/^/C: /' &
PID3=$!
# Function to abort everything if a process fails
abort() {
echo "Aborting..."
kill $PID1 $PID2 $PID3 2>/dev/null
wait $PID1 $PID2 $PID3 2>/dev/null
exit 1
}
# Wait for all processes to complete, abort if any fail
wait $PID1 || abort
wait $PID2 || abort
wait $PID3 || abort
echo "Finished"