Skip to content

Commit

Permalink
Merge pull request #3 from joyoFeng/master
Browse files Browse the repository at this point in the history
fix all compile flags from python to python3
  • Loading branch information
Xiang Xie authored Apr 21, 2020
2 parents f110721 + 2da9e8b commit 6cca67f
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 47 deletions.
8 changes: 4 additions & 4 deletions cc/tf/dpass/compile_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ builddir=${ccdir}/../build/
libpath=${builddir}/lib
mkdir -p ${libpath}

TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
TF_CFLG=$(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))')
TF_LFLG=$(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')
TF_INC=$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
TF_CFLG=$(python3 -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))')
TF_LFLG=$(python3 -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')



Expand Down
8 changes: 4 additions & 4 deletions cc/tf/mpcops/compile_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ builddir=${ccdir}/../build/
libpath=${builddir}/lib
mkdir -p ${libpath}

TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
TF_CFLG=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_compile_flags())')
TF_LFLG=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_link_flags()[1])')
TF_INC=$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
TF_CFLG=$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_compile_flags())')
TF_LFLG=$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_link_flags()[1])')

TF_CFLGS="-D_GLIBCXX_USE_CXX11_ABI=1"

Expand Down
8 changes: 2 additions & 6 deletions compile_and_test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ function run_stage_4() {
python setup.py build_ext
python setup.py bdist_wheel

pv=$(python -c 'import sys; print(sys.version_info[0])')
pip_cmd=pip
if [ $pv == '3' ]; then
pip_cmd=pip3
fi

pip_cmd=pip3

if [ $USER == "root" ]; then
${pip_cmd} install dist/*.whl
else
Expand Down
6 changes: 3 additions & 3 deletions doc/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ Run the `Millionaire Problem` example:
```bash
mkdir log
# MPC player 2
python millionaire.py --party_id=2
python3 millionaire.py --party_id=2
````
- **`P1`node**
```bash
mkdir log
# MPC player 1
python millionaire.py --party_id=1
python3 millionaire.py --party_id=1
````
- **`P0` node**
```bash
mkdir log
# MPC player 0
python millionaire.py --party_id=0
python3 millionaire.py --party_id=0
````
After execution, output should be like this:
Expand Down
6 changes: 3 additions & 3 deletions doc/DEPLOYMENT_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,19 @@ openssl x509 -req -days 365 -in certs/cert.req -signkey certs/server-prikey -out
```bash
mkdir log
# MPC player 2
python millionaire.py --party_id=2
python3 millionaire.py --party_id=2
```
- **`P1`节点**
```bash
mkdir log
# MPC player 1
python millionaire.py --party_id=1
python3 millionaire.py --party_id=1
```
- **`P0`节点**
```bash
mkdir log
# MPC player 0
python millionaire.py --party_id=0
python3 millionaire.py --party_id=0
```

执行完成后,如果可以查看到类似输出:
Expand Down
8 changes: 5 additions & 3 deletions doc/TENSORFLOW_INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [System requirements](#system-requirements)
- [System software installation](#system-software-installation)
- [Source code installation](#source-code-installation)
- [Installation inspection](#installation-inspection)
- [Installation verification](#installation-verification)

## Description of documentation

Expand Down Expand Up @@ -93,12 +93,14 @@ Once the installation is complete, check again for compliance with the system re
````
> TensorFlow source code installation can be referenced to [official documentation][tensorflow-source-install]

## Installation inspection
## Installation verification

After installation, check TensorFlow availability.

> Note: Please switch to a directory other than the TensorFlow source code for installation verification.

```bash
python -c 'import tensorflow as tf;print(tf.__version__)'
python3 -c 'import tensorflow as tf;print(tf.__version__)'
````
Output: `v1.14.0` indicates successful installation.
Expand Down
4 changes: 3 additions & 1 deletion doc/TENSORFLOW_INSTALL_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ sudo pip3 install --upgrade pip

安装完成后,检验TensorFlow可用性:

> 注意:请切换到TensorFlow源码之外的目录进行安装检验

```bash
python -c 'import tensorflow as tf;print(tf.__version__)'
python3 -c 'import tensorflow as tf;print(tf.__version__)'
```

输出:`v1.14.0`表示安装成功。
Expand Down
6 changes: 3 additions & 3 deletions doc/TUTORIALS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ Or, you can run the following program on three different terminals (just to simu

```sh
# node 0
python quickstart.py --party_id=0
python3 quickstart.py --party_id=0
```

```sh
# node 1
python quickstart.py --party_id=1
python3 quickstart.py --party_id=1
```

```sh
# node 2
python quickstart.py --party_id=2
python3 quickstart.py --party_id=2
```

If you see `DONE!` in the output, you have accomplished the first goal.
Expand Down
6 changes: 3 additions & 3 deletions doc/TUTORIALS_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ import latticex.rosetta as rtt

```sh
# node 0
python quickstart.py --party_id=0
python3 quickstart.py --party_id=0
```

```sh
# node 1
python quickstart.py --party_id=1
python3 quickstart.py --party_id=1
```

```sh
# node 2
python quickstart.py --party_id=2
python3 quickstart.py --party_id=2
```

如果输出了 `DONE!`,那么表示 OK 了。
Expand Down
14 changes: 7 additions & 7 deletions example/logistic_regression/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function test_mpc_llr() {
fi
echo -e "\nrun mpc case: ${script_name} ..."

python ${script_name} --party_id=2 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-2.log 2>&1 &
python ${script_name} --party_id=1 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-1.log 2>&1 &
python ${script_name} --party_id=0 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-0.log 2>&1
python3 ${script_name} --party_id=2 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-2.log 2>&1 &
python3 ${script_name} --party_id=1 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-1.log 2>&1 &
python3 ${script_name} --party_id=0 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-0.log 2>&1
sleep 0.5
}

Expand All @@ -46,7 +46,7 @@ function test_plain_llr() {
fi
echo -e "\nrun plain case: ${script_name} ..."

python ${script_name} --epochs=${epochs} --dims=${dims} --learn_rate=${lr} > log/D${dims}-E${epochs}-LR${lr}-plain.log 2>&1
python3 ${script_name} --epochs=${epochs} --dims=${dims} --learn_rate=${lr} > log/D${dims}-E${epochs}-LR${lr}-plain.log 2>&1
}

function get_trained_params() {
Expand Down Expand Up @@ -76,9 +76,9 @@ function get_trained_params() {
echo -e "${GREEN}b: ${NOCOLOR}"$'\n'"${mpc_b}"
echo -e "${GREEN}acc:${NOCOLOR} "$'\n'"${mpc_acc}"

delta_W=`python -c "import numpy as np;print(np.double($plain_W)-np.double($mpc_W))"`
delta_b=`python -c "import numpy as np;print(np.double($plain_b)-np.double($mpc_b))"`
delta_acc=`python -c "import numpy as np;print(np.double($plain_acc)-np.double($mpc_acc), '%')"`
delta_W=`python3 -c "import numpy as np;print(np.double($plain_W)-np.double($mpc_W))"`
delta_b=`python3 -c "import numpy as np;print(np.double($plain_b)-np.double($mpc_b))"`
delta_acc=`python3 -c "import numpy as np;print(np.double($plain_acc)-np.double($mpc_acc), '%')"`
echo -e "${name}-D${dims}-E${epochs}-LR${lr} 'plain-mpc' ${GREEN}delta_W:${NOCOLOR}: "$'\n'"${RED} ${delta_W} ${NOCOLOR}"
echo -e "${name}-D${dims}-E${epochs}-LR${lr} 'plain-mpc' ${GREEN}delta_b:${NOCOLOR}: "$'\n'"${RED} ${delta_b} ${NOCOLOR}"
echo -e "${name}-D${dims}-E${epochs}-LR${lr} 'plain-mpc' ${GREEN}delta_acc:${NOCOLOR}: "$'\n'"${RED} ${delta_acc} ${NOCOLOR}"
Expand Down
14 changes: 7 additions & 7 deletions example/logistic_regression/test_stat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function test_mpc_llr() {
fi
echo -e "\nrun mpc case: ${script_name} ..."

python ${script_name} --party_id=2 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-2.log 2>&1 &
python ${script_name} --party_id=1 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-1.log 2>&1 &
python ${script_name} --party_id=0 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-0.log 2>&1
python3 ${script_name} --party_id=2 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-2.log 2>&1 &
python3 ${script_name} --party_id=1 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-1.log 2>&1 &
python3 ${script_name} --party_id=0 --epochs=${epochs} --dims=${dims} --learn_rate=${lr} >log/D${dims}-E${epochs}-LR${lr}-0.log 2>&1
sleep 0.5
}

Expand All @@ -46,7 +46,7 @@ function test_plain_llr() {
fi
echo -e "\nrun plain case: ${script_name} ..."

python ${script_name} --epochs=${epochs} --dims=${dims} --learn_rate=${lr} > log/D${dims}-E${epochs}-LR${lr}-plain.log 2>&1
python3 ${script_name} --epochs=${epochs} --dims=${dims} --learn_rate=${lr} > log/D${dims}-E${epochs}-LR${lr}-plain.log 2>&1
}

function get_trained_params() {
Expand Down Expand Up @@ -76,9 +76,9 @@ function get_trained_params() {
echo -e "${GREEN}b: ${NOCOLOR}"$'\n'"${mpc_b}"
echo -e "${GREEN}acc:${NOCOLOR} "$'\n'"${mpc_acc}"

delta_W=`python -c "import numpy as np;print(np.double($plain_W)-np.double($mpc_W))"`
delta_b=`python -c "import numpy as np;print(np.double($plain_b)-np.double($mpc_b))"`
delta_acc=`python -c "import numpy as np;print(np.double($plain_acc)-np.double($mpc_acc), '%')"`
delta_W=`python3 -c "import numpy as np;print(np.double($plain_W)-np.double($mpc_W))"`
delta_b=`python3 -c "import numpy as np;print(np.double($plain_b)-np.double($mpc_b))"`
delta_acc=`python3 -c "import numpy as np;print(np.double($plain_acc)-np.double($mpc_acc), '%')"`
echo -e "${name}-D${dims}-E${epochs}-LR${lr} 'plain-mpc' ${GREEN}delta_W:${NOCOLOR}: "$'\n'"${RED} ${delta_W} ${NOCOLOR}"
echo -e "${name}-D${dims}-E${epochs}-LR${lr} 'plain-mpc' ${GREEN}delta_b:${NOCOLOR}: "$'\n'"${RED} ${delta_b} ${NOCOLOR}"
echo -e "${name}-D${dims}-E${epochs}-LR${lr} 'plain-mpc' ${GREEN}delta_acc:${NOCOLOR}: "$'\n'"${RED} ${delta_acc} ${NOCOLOR}"
Expand Down
6 changes: 3 additions & 3 deletions example/millionaire/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ Run the following on three different terminals (you can understand that these th

```sh
# node 0
python millionaire.py --party_id=0
python3 millionaire.py --party_id=0
```

```sh
# node 1
python millionaire.py --party_id=1
python3 millionaire.py --party_id=1
```

```sh
# node 2
python millionaire.py --party_id=2
python3 millionaire.py --party_id=2
```

Output:
Expand Down

0 comments on commit 6cca67f

Please sign in to comment.