I. Environment preparation

1.1 VM Environment

Prepare three virtual machines that can communicate with each other. My machine environment is a three-node cluster environment using Vagrant+VirtualBox, IP is 192.168.7.2, 192.168.7.3, 192.168.7.4, operating system is Cenos 7.

1.2 installation Python3

According to the documentation, the Python version is 3.6.9. In particular, there were many errors when I experimented with Python 3.7.5, and even Tensorflow and TF-encrypted could not be installed successfully. It was only when I switched to version 3.6.9 that I succeeded.


yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc libffi-devel python-devel openssl-devel -y



wget https://www.python.org/ftp/python/3.69./Python-3.69..tar.xz

tar -xvJf Python-3.69..tar.xz

mkdir /usr/local/python3
cd Python-3.69.
./configure --prefix=/usr/local/python3


make && make install


ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

Copy the code

1.2 installation tensorflow

Tensorflow versions must be consistent.

Pip3 install --upgrade PIP pip3 install --upgrade setuptools pip3 install tensorflow==1.13.2 pip3 install TF-encryptedCopy the code

1.3 Password-free Login

Configure password-free login between the three machines.

192.168.7.2 Run on the host:

Ssh-keygen -t rsa ssh-copy-id -i ~/. SSH /id_rsa.pub [email protected] ssh-keygen -t rsa ssh-copy-id -i ~/. SSH /id_rsa.pub [email protected]Copy the code

192.168.7.3 Run the following command on the host:

Ssh-keygen -t rsa ssh-copy-id -i ~/. SSH /id_rsa.pub [email protected] ssh-keygen -t rsa ssh-copy-id -i ~/. SSH /id_rsa.pub [email protected]Copy the code

192.168.7.4 Run the following command on the host:

Ssh-keygen -t rsa ssh-copy-id -i ~/. SSH /id_rsa.pub [email protected] ssh-keygen -t rsa ssh-copy-id -i ~/. SSH /id_rsa.pub [email protected]Copy the code

2. Experimental data and codes

Start by writing a config file, config.json:

{
    "alice": "192.168.7.2:8088"."bob": "192.168.7.3:8088"."crypto-producer": "192.168.7.4:8088"
}

Copy the code

Note the relationship between the name and the corresponding IP, 192.168.7.2 is the machine that corresponds to Alice, so copy the code and data that Alice needs to this machine.

Alice:


config.json , common.py , training_alice.py , aliceTrainFile.csv
Copy the code

Bob:


config.json , training_bob.py , bobTrainFileWithLabel.csv
Copy the code

Crypto – producer:


config.json , training_server.py to machine3
Copy the code

The structure and content of the code directory are as follows:

Three, training,

In order, Bob is executed first:


python3 training_bob.py
Copy the code

Crypto-producer:

python3 training_server.py
Copy the code

Finally, execute Alice:


python3 training_alice.py
Copy the code

Finally, training results will be output on Alice node.

Reference Documents:

Github.com/tf-encrypte…

Alibaba – Gemini – lab. Making. IO/docs/blog/t…