To install the gmpy2
on Linux with pip
, you must already have installed libgmp, libmpfr and libmpc (Tested on Ubuntu 18.04).
sudo apt install libgmp-dev libmpfr-dev libmpc-dev
Then install the only 3 python requirements, numpy, gmpy2 and mpyc.
pip3 install numpy gmpy2 git+git://github.com/lschoe/mpyc.git@4642a3cc65b62234491b6392b2f106fd8ae6457a
The code is in main.py
and it only calls one external file called utils.py
containing some helper functions.
For the purpose of the PoC, this code requires to be ran in this directory structure - namely having a directory DATA/
containing at least mnist250/
and svhn250/
- and having a (potentially empty) directory BENCHMARK/
.
MPC-Aggreg/
| .gitignore
| main.py
| utils.py
|
| DATA/
| | mnist250/
| | | votes_client_i.npy
| | | […]
| | svhn250/
| | | votes_client_i.npy
| | | […]
|
| BENCHMARK/
| | mnist250_640s_5c.csv
| | […]
|
| runAll.sh
To generate these votes votes_client_i.npy
, where i
is the cliend ID, we wrote a little script votes_compilator.py
that you find in the DATA/
directory (more information in the README file of the DATA/
directory).
The script runAll.sh
was used to generate the CSV files used in the benchmarking of this PoC.
What it does, is running the code main.py
with both datasets "mnist" and "svhn" and different number of clients ranging from 2 (3-party MPC) to 250 (251-party MPC).
-
Log in to your instance via ssh
ssh -i key_file ubuntu@IP_ADDRESS_OF_INSTANCE
-
Clone this repository
git clone https://github.com/AlexConnat/MPC-Aggreg
-
In this repository, run the setup script
cd MPC-Aggreg; ./setup.sh
This will:
Update the sources lists for apt
sudo apt update
Install python and pip
sudo apt install python3 python3-pip
Install the required system libraries
sudo apt install libgmp-dev libmpfr-dev libmpc-dev
Install the required python libraries
pip3 install numpy gmpy2 git+https://github.com/lschoe/mpyc
You can then run the runAll
script
./runAll.sh
You can tune the parameters in the runAll
script. Results could be found in the BENCHMARK
directory, under the format {name of dataset}_{number of clients}_{number of samples}_{timestamp}.csv
(e.g: mnist250_8c_640s_1566203440
)
NB: These CSV files contain at each line: the sample ID, the label it was assigned, and the time it took to do so.