Open Quantum-SMC opened 1 month ago
Hi Quantum-SMC,
first off, I don't know how many protocols provide by MP-SPDZ can be used to run our code. We only have tested it for the four protocols specified in the README. Most protocols should work because of the way MP-SPDZ is designed.
I will give you some directions on how to integrate other protocols so you can try out the protocols you need. First, you need to extend get_protocol which return the shell script name of the protocol based on the command line argument --protocol.
Second, you may need to change the compilation arguments used to compile the MP-SPDZ code. Currently, we are using -R 64 -X, but this may not work with other protocols.
https://github.com/encryptogroup/SAFEFL/blob/31773ec23e25e620b6662ae284b507f1fffcd6e7/main.py#L380
Other than that, I don't think that more changes are needed to integrate new protocols into the framework.
Thank you for your reply. It seems working. However, while python main.py
I get the following errors. It seems that some files are missing and I couldnt find them nether in MP-SPDZ nor in SAFEFL . I appreciate your help:
File "/Users/zeinab/Downloads/SAFEFL/mpspdz/Compiler/program.py", line 256, in init_names raise CompilerError( Compiler.exceptions.CompilerError: found none of the potential input files: '14000', 'Programs/Source/14000.mpc', 'Programs/Source/14000.py'
...
Running /Users/zeinab/Downloads/SAFEFL/mpspdz/Scripts/../mascot-party.x 0 mpc_fedavg_server-14000-3372-30-2000-200-1-1 -pn 13248 -h localhost -N 2
Running /Users/zeinab/Downloads/SAFEFL/mpspdz/Scripts/../mascot-party.x 1 mpc_fedavg_server-14000-3372-30-2000-200-1-1 -pn 13248 -h localhost -N 2
libc++abi: terminating due to uncaught exception of type file_error: File Error : Missing 'Programs/Schedules/mpc_fedavg_server-14000-3372-30-2000-200-1-1.sch'. Did you compile 'mpc_fedavg_server-14000-3372-30-2000-200-1-1'?
I just tried it out and got Mascot working. I believe you made an error in the compilation I highlighted above:
https://github.com/encryptogroup/SAFEFL/blob/31773ec23e25e620b6662ae284b507f1fffcd6e7/main.py#L380
According to the error, MP-SPDZ is looking for a file named 14000.mpc
or 14000.py
to compile it. I think you accidentally deleted args.filename_server
from the line above, which is the first variable argument given to compile.py
. This argument specifies the file to compile and should be either mpc_fedavg_server
or mpc_fltrust_server
. In your case, the first argument is 14000
which is the default port, which leads me to believe the correct filename is missing.
In my case, I got MASCOT working by adding the protocol like you did and changing the -R
to a -F
in the compilation string shown above.
I hope this fixes your problem.
Thank you. I was able to run main.py
for Mascot. However, it keeps waiting for the other clients to connect (according to MP-SPDZ, I might need to open a new terminal? ). Could you please tell me how to fix this:
/opt/homebrew/Caskroom/miniconda/base/envs/safefl_env/bin/python /Users/zeinab/Downloads/SAFEFL/main_working_for_mascot.py
cpu
dataset: p0.1_HAR, server_pc: 100, bias: 0.5, nworkers: 30, net: lr, niter: 2000, lr: 0.25, batch_size: 64, nbyz: 6, attack: no, aggregation: fedavg, FLOD_threshold: 0.5, Flame_epsilon: 3000, Flame_delta: 0.001, Number_runs: 1, DnC_niters: 5, DnC_c: 1, DnC_b: 2000, MP-SPDZ: True, Port: 14000, Chunk_size: 200, Protocol: mascot, Threads: 1, Parallels: 1, Seed: 1, Test Every: 50
LinearRegression(
(linear): Linear(in_features=561, out_features=6, bias=True)
)
Setting up SSL for 2 parties
..+...+.+.........+...+..+......+.+......+..+++++++++++++++++++++++++++++++++++++++*..+.........+..+++++++++++++++++++++++++++++++++++++++*...+..+............+......+....+...+...+.........+......+.....................+...+......+......+...............+......+..+...+...+....+..+.+..+...+...+.......+.....+...+.......+..+..........+..+.........+....+...+............+.....+.+.....+......+...+......+.+......+..+............+.+...+..+.......+.....+.+..+....+...........+............+...+....+...+......+.....+.+.....+......+...+....+..+.........+.+..................+...+............+.....+...............+...+....+.....+.+..+......+................+.....+......+....+...+..+.........+.......+...+..+....+.....+...+.+..+.......+......+..+....+........................+......+...+...+..............+.+.....+..........+.................+.+.....+.+........+......+.......+.................+.+......+.....++++++
.....+....+++++++++++++++++++++++++++++++++++++++*....+...+....+...+..............+...+.......+.....+.............+++++++++++++++++++++++++++++++++++++++*.+...+......+............+.........+.+.....+.......+.....+.+..+.........+.........+....+.....+......+....+.....................+.....+.+...+.....+......+......+..................+...............+.+.....+.......+..+......+......+.+..+.+......+......+...+.....+.+...........++++++
-----
...+......+........+.+..+....+.....+...+.......+.........+..+.......+..+.+++++++++++++++++++++++++++++++++++++++*.....+..+++++++++++++++++++++++++++++++++++++++*.+...+......+..+...+.+......+........+....+...+..+.+..............+.+...........+.+........+.......+.....+...+......+.....................+....+........+..........+.....+.......+.........++++++
.......+.+......+.....+.+.....+.........+.+..............+...+...+....+...+......+............+.....+...+.+...............+.....+++++++++++++++++++++++++++++++++++++++*...+.....+......+.......+..+.........+++++++++++++++++++++++++++++++++++++++*..+...+.+.....+.+......+.....+.......+...........+.......+..+...+..................+......+..................+.......+...+..++++++
-----
Doing Player-Data
.........+++++++++++++++++++++++++++++++++++++++*...+..+.+......+......+.....+...+.+...+...........+.+...+...+++++++++++++++++++++++++++++++++++++++*........+.......+..+...+.............+...+..+.............+......+........+..........+........+.......+..+.+..............+.+..+......+...............+.......+........++++++
...+...............+...+...+..+++++++++++++++++++++++++++++++++++++++*..+++++++++++++++++++++++++++++++++++++++*.....+......+...+.+..................+......+..+.........+...+.+.........+......+..+............+.+............+..+............+....+......+........+..........+........+...+.......+.....+.......+.....+.+.....+.+...+......+.....++++++
Setting up SSL for 1 parties
-----
Doing Player-Data
Data done
Starting Computation Parties
Running /Users/zeinab/Downloads/SAFEFL/mpspdz/Scripts/../mascot-party.x 0 mpc_fedavg_server-14000-3372-30-2000-200-1-1 -pn 18586 -h localhost -N 2
Running /Users/zeinab/Downloads/SAFEFL/mpspdz/Scripts/../mascot-party.x 1 mpc_fedavg_server-14000-3372-30-2000-200-1-1 -pn 18586 -h localhost -N 2
Using statistical security parameter 40
Arguments:
Programm: mpc_fedavg_server
Iterations: 2000
Workers: 30
Parameters: 3372
Portnum: 14000
Chunk Size: 200
Threads: 1
Parallel: 1
Listening for client connections on base port 14000
Starting aggregation
Data send
Regards,
Hi, Can other types of protocols in MP-SPDZ (e.g. MASCOT) be integrated to your platform? I need to use a protocol that utilises OT. Thank you.