occlum/demos/paddlepaddle
2023-03-22 10:34:57 +08:00
..
.gitignore Add PaddlePaddle demo 2023-03-22 10:34:57 +08:00
demo.py Add PaddlePaddle demo 2023-03-22 10:34:57 +08:00
install_python_with_conda.sh Add PaddlePaddle demo 2023-03-22 10:34:57 +08:00
paddlepaddle.yaml Add PaddlePaddle demo 2023-03-22 10:34:57 +08:00
README.md Add PaddlePaddle demo 2023-03-22 10:34:57 +08:00
run_paddlepaddle_on_occlum.sh Add PaddlePaddle demo 2023-03-22 10:34:57 +08:00

Use PaddlePaddle with Python and Occlum

This project demonstrates how Occlum enables unmodified PaddlePaddle programs running in SGX enclaves, on the basis of unmodified Python. The workload is a primary AI task from PaddlePaddle Quick Start. The source code of the workload resides in demo.py.

How to Run

This tutorial is written under the assumption that you have Docker installed and use Occlum in a Docker container.

Occlum is compatible with glibc-supported Python, we employ miniconda as python installation tool. You can import paddle packages using conda. Here, miniconda is automatically installed by install_python_with_conda.sh script, the required python and paddle packages for this project are also loaded by this script.

Step 1 (on the host): Start an Occlum container

docker pull occlum/occlum:latest-ubuntu20.04
docker run -it --name=pythonDemo --device /dev/sgx/enclave occlum/occlum:latest-ubuntu20.04 bash

Step 2 (in the Occlum container): Download miniconda and install python to prefix position.

cd /root/demos/paddlepaddle
bash ./install_python_with_conda.sh

Step 3 (in the Occlum container): Run the sample code on Occlum

cd /root/demos/paddlepaddle
bash ./run_paddlepaddle_on_occlum.sh