forked from intel-analytics/ipex-llm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable FL Server in SGX (intel-analytics#5396)
* add assembly * Enable FL Sever in SGX * Change the url in tutorial.md * Add start-fl-server.py to Docker Image * rm ppml-assebly.xml * Add start-python-fl-server-sgx.sh to Docker Image * Put start-fl-server.py into assembly * Update 3.1.2 Start FL Server in SGX in pytorch-nn-lr-tutorial.md * Change the location of start-fl-server.py * Correct the path in start-python-fl-server-sgx.sh * Delete -r in cp command Co-authored-by: Jiaming <[email protected]>
- Loading branch information
1 parent
b57dbdd
commit 4df578e
Showing
13 changed files
with
156 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ppml/trusted-big-data-ml/python/docker-graphene/start-scripts/start-python-fl-server-sgx.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
port=8980 | ||
client_num=2 | ||
|
||
while getopts "p:c:" opt | ||
do | ||
case $opt in | ||
p) | ||
port=$OPTARG | ||
;; | ||
c) | ||
client_num=$OPTARG | ||
;; | ||
esac | ||
done | ||
cd /ppml/trusted-big-data-ml | ||
/graphene/Tools/argv_serializer bash -c " /opt/jdk8/bin/java\ | ||
-cp '/ppml/trusted-big-data-ml/work/spark-3.1.2/conf/:/ppml/trusted-big-data-ml/work/spark-3.1.2/jars/*'\ | ||
-Xmx10g org.apache.spark.deploy.SparkSubmit\ | ||
--master 'local[4]'\ | ||
/ppml/trusted-big-data-ml/fl/start-fl-server.py -p $port -c $client_num" > /ppml/trusted-big-data-ml/secured-argvs | ||
./init.sh | ||
SGX=1 ./pal_loader bash 2>&1 | tee fl-server-sgx.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
##### Server property | ||
# clientNum: 2 | ||
# privateKeyFilePath: /ppml/trusted-big-data-ml/work/keys/server.pem | ||
# certChainFilePath: /ppml/trusted-big-data-ml/work/keys/server.crt | ||
# serverPort: | ||
|
||
##### Client property | ||
# clientTarget: | ||
# taskID: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PYTHON_ZIP=$(find lib -name *-python-api.zip) | ||
JAR=$(find lib -name *-jar-with-dependencies.jar) | ||
export PYTHONPATH=$PYTHONPATH:$(pwd)/$PYTHON_ZIP | ||
export PYTHONPATH=$PYTHONPATH:$(pwd)/$PYTHON_ZIP/bigdl/ppml/fl/nn/generated | ||
export BIGDL_CLASSPATH=$JAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# Copyright 2016 The BigDL Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from bigdl.ppml.fl.fl_server import FLServer | ||
|
||
if __name__ == '__main__': | ||
fl_server = FLServer() | ||
fl_server.build() | ||
fl_server.start() | ||
fl_server.wait_for_termination() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# | ||
# Copyright 2016 The BigDL Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import sys | ||
import os | ||
import fnmatch | ||
import getopt | ||
|
||
for files in os.listdir('/ppml/trusted-big-data-ml/work/bigdl-2.1.0-SNAPSHOT/python/'): | ||
if fnmatch.fnmatch(files, 'bigdl-ppml-*-python-api.zip'): | ||
sys.path.append('/ppml/trusted-big-data-ml/work/bigdl-2.1.0-SNAPSHOT/python/' + files) | ||
sys.path.append('/ppml/trusted-big-data-ml/work/bigdl-2.1.0-SNAPSHOT/python/' + files + '/bigdl/ppml/fl/nn/generated') | ||
|
||
if '/usr/lib/python3.6' in sys.path: | ||
sys.path.remove('/usr/lib/python3.6') | ||
if '/usr/lib/python3.6/lib-dynload' in sys.path: | ||
sys.path.remove('/usr/lib/python3.6/lib-dynload') | ||
if '/usr/local/lib/python3.6/dist-packages' in sys.path: | ||
sys.path.remove('/usr/local/lib/python3.6/dist-packages') | ||
if '/usr/lib/python3/dist-packages' in sys.path: | ||
sys.path.remove('/usr/lib/python3/dist-packages') | ||
|
||
from bigdl.ppml.fl.nn.fl_server import FLServer | ||
|
||
if __name__ == '__main__': | ||
|
||
client_num = 2 | ||
port = 8980 | ||
|
||
try: | ||
opts, args = getopt.getopt(sys.argv[1:], "hc:p:", ["client-num=", "port="]) | ||
except getopt.GetoptError: | ||
print("start_fl_server.py -c <client-num> -p <port>") | ||
sys.exit(2) | ||
|
||
for opt, arg in opts: | ||
if opt == '-h': | ||
print("start_fl_server.py -c <client-num> -p <port>") | ||
elif opt in ("-c", "--client-num"): | ||
client_num = arg | ||
elif opt in ("-p", "--port"): | ||
port = arg | ||
|
||
fl_server = FLServer(client_num) | ||
fl_server.set_port(port) | ||
fl_server.build() | ||
fl_server.start() | ||
|
||
fl_server.wait_for_termination() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters