Skip to content

Commit

Permalink
Add PyTorch Workload Support for Ubuntu 24.04
Browse files Browse the repository at this point in the history
Signed-off-by: Adarsh Anand <[email protected]>
  • Loading branch information
adarshan-intel committed Nov 11, 2024
1 parent c9e6e4d commit 39a7052
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pytorch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

# PyTorch and the pre-trained model must be installed on the system. See README for details.

SHELL := /bin/bash

THIS_DIR := $(shell pwd)

VENV_DIR ?= $(THIS_DIR)/my_venv

ENTRYPOINT := $(VENV_DIR)/bin/python3

ARCH_LIBDIR ?= /lib/$(shell $(CC) -dumpmachine)

ifeq ($(DEBUG),1)
Expand All @@ -21,7 +29,8 @@ pytorch.manifest: pytorch.manifest.template
gramine-manifest \
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
-Darch_libdir=$(ARCH_LIBDIR) \
-Dentrypoint=$(realpath $(shell sh -c "command -v python3")) \
-Dentrypoint=$(ENTRYPOINT) \
-Dvenv_dir=$(VENV_DIR) \
$< > $@

# Make on Ubuntu <= 20.04 doesn't support "Rules with Grouped Targets" (`&:`),
Expand Down
1 change: 1 addition & 0 deletions pytorch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ installation.
- `sudo apt install python3-pip lsb-release` to install `pip` and `lsb_release`.
The former is required to install additional Python packages while the latter
is used by the Makefile.
- `python3 -m venv my_venv && source my_venv/bin/activate` to create and activate a virtual environment.
- `pip3 install --user torchvision pillow` to install the torchvision and pillow
Python packages and their dependencies (usually in $HOME/.local). WARNING:
This downloads several hundred megabytes of data!
Expand Down
2 changes: 2 additions & 0 deletions pytorch/pytorch.manifest.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fs.mounts = [
{ path = "/usr/lib", uri = "file:/usr/lib" },
{ path = "{{ arch_libdir }}", uri = "file:{{ arch_libdir }}" },
{ path = "/usr/{{ arch_libdir }}", uri = "file:/usr/{{ arch_libdir }}" },
{ path = "{{ venv_dir }}", uri = "file:{{ venv_dir }}" },
{% for path in python.get_sys_path(entrypoint) %}
{ path = "{{ path }}", uri = "file:{{ path }}" },
{% endfor %}
Expand All @@ -43,6 +44,7 @@ sgx.trusted_files = [
"file:/usr/lib/",
"file:{{ arch_libdir }}/",
"file:/usr/{{ arch_libdir }}/",
"file:{{ venv_dir }}/",
{% for path in python.get_sys_path(entrypoint) %}
"file:{{ path }}{{ '/' if path.is_dir() else '' }}",
{% endfor %}
Expand Down

0 comments on commit 39a7052

Please sign in to comment.