Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Commit

Permalink
Add docker compose files for Avalon openvino worker.
Browse files Browse the repository at this point in the history
- Docker compose file to start openvino object detection worker container.
- Update ReadMewith steps to test Avalon with openvino worker.

Signed-off-by: Manoj Gopalakrishnan <[email protected]>
  • Loading branch information
manojgop committed Aug 27, 2020
1 parent 8e11428 commit ed424e7
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docker/compose/avalon-graphene-ov-sgx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2020 Intel Corporation
#
# 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.

version: '3.5'

services:
ov-work-order:
image: gsc-openvinowl
devices:
- "/dev/gsgx:/dev/gsgx"
- "/dev/isgx:/dev/isgx"
volumes:
- /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket
32 changes: 32 additions & 0 deletions docker/compose/avalon-graphene-ov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 Intel Corporation
#
# 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.

version: '3.5'

services:
ov-work-order:
container_name: ov-work-order
image: openvinowl
environment:
- http_proxy
- https_proxy
- no_proxy
expose:
- 8888
volumes:
# Output images directory for openvino object detection.
- ./output:/home/openvino/output
command: openvinowl
stop_signal: SIGKILL

53 changes: 53 additions & 0 deletions docker/compose/avalon-ov-subnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2020 Intel Corporation
#
# 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.

version: '3.5'

# Define network for openvino and assign static ip for openvino container.
# GSC tool/Graphene has an issue and is not able to resolve DNS name to IP.
# So need to assign static IP for openvino container.
networks:
awov:
ipam:
config:
- subnet: 10.5.0.0/24

services:
avalon-shell:
networks:
- awov

avalon-enclave-manager:
networks:
- awov

avalon-lmdb:
networks:
- awov

avalon-listener:
networks:
- awov

graphene-python-worker:
networks:
- awov

# This IP address should match with IP address in file
# examples/graphene_apps/python_worker/ov_workload/ov_workload_config.toml
ov-work-order:
networks:
awov:
ipv4_address: 10.5.0.6

48 changes: 48 additions & 0 deletions examples/graphene_apps/python_worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,54 @@ https://creativecommons.org/licenses/by/4.0/
`docker-compose -f docker-compose.yaml -f compose/graphene-sgx.yaml -f compose/ov.yaml -f compose/ov-sgx.yaml -f compose/ov-subnet.yaml up`
### Testing OpenVino (with Avalon)
- If Intel SGX is not used , execute following commands from Avalon repository top-level directory
1. Combine the docker compose files to create `openvino.yaml`
`docker-compose -f docker-compose.yaml -f docker/compose/avalon-graphene.yaml -f docker/compose/avalon-graphene-ov.yaml -f docker/compose/avalon-ov-subnet.yaml config > openvino.yaml`
2. Start Avalon containers. This will also start Avalon python worker and openvino containers in detached mode.
`docker-compose -f openvino.yaml up -d`
- For Intel SGX, execute the following commands:
1. Combine the docker compose files to create `openvino-sgx.yaml`
`docker-compose -f docker-compose.yaml -f docker/compose/avalon-graphene.yaml -f docker/compose/avalon-graphene-sgx.yaml -f docker/compose/avalon-graphene-ov.yaml -f docker/compose/avalon-graphene-ov-sgx.yaml -f docker/compose/avalon-ov-subnet.yaml config > openvino-sgx.yaml`
2. Start Avalon containers. This will also start Avalon python worker and openvino containers running inside Graphene-SGX in detached mode.
`docker-compose -f openvino-sgx.yaml up -d`
- In case of Intel SGX, Graphene-SGX python worker and openvino containers will take around 3 minutes to get ready. To view the logs of python worker and openvino containers, execute the following command:
`docker-compose -f openvino-sgx.yaml logs -f graphene-python-worker ov-work-order`
- To send openvino work orders to python worker, we can use [generic client](https://github.com/hyperledger/avalon/tree/master/examples/apps/generic_client) application. Execute the following commands:
1. Get into Avalon Shell container : `sudo docker exec -it avalon-shell bash`
2. cd `/project/avalon/examples/apps/generic_client/`
3. Send openvino work order request with *"ov-inference"* workload id to Graphene worker *"graphene-worker-1"*
`./generic_client.py --uri "http://avalon-listener:1947" -w "graphene-worker-1" --workload_id "ov-inference" --in_data "street.jpg" -o`
If everything goes fine, then you should see the following output in stdout:
*Decryption result at client - Openvino Success: Generated output file: street.bmp*
output file *street.bmp* will be present in *output* folder in Avalon repository top level directory.
- To restart the python worker we have to first bring all the containers down before bringing it up again. This is to ensure that python worker generates new worker signing and encryption keys and Avalon Graphene Enclave Manager gets the updated signup information from python worker.
If Intel SGX is not used, execute the command: `docker-compose -f openvino.yaml down`
For Intel SGX, execute the command: `docker-compose -f openvino-sgx.yaml down`
## Known issues
- Knows issues are captured in GitHub : https://github.com/hyperledger/avalon/issues/621
Expand Down

0 comments on commit ed424e7

Please sign in to comment.