Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
a12b2b1b
Commit
a12b2b1b
authored
6 years ago
by
nhynes
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[SGX] Add ignored files to sgx example (#1852)
parent
15d67c11
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/sgx/README.md
+15
-0
15 additions, 0 deletions
apps/sgx/README.md
apps/sgx/enclave/build.rs
+9
-0
9 additions, 0 deletions
apps/sgx/enclave/build.rs
apps/sgx/enclave/src/build_model.py
+38
-0
38 additions, 0 deletions
apps/sgx/enclave/src/build_model.py
with
62 additions
and
0 deletions
apps/sgx/README.md
+
15
−
0
View file @
a12b2b1b
...
...
@@ -19,6 +19,21 @@ Check out the `/tvm/install/ubuntu_install_sgx.sh` for the commands to get these
## Running the example
If using Docker, start by running
```
git clone https://github.com/dmlc/tvm.git
docker run --rm -it -v $(pwd)/tvm:/mnt tvmai/ci-cpu /bin/bash
```
then, in the container
```
cd /mnt
mkdir build && cd build
cmake .. -DUSE_LLVM=ON -DUSE_SGX=/opt/sgxsdk -DRUST_SGX_SDK=/opt/rust-sgx-sdk
make -j4
cd ../apps/sgx
```
`bash run_example.sh`
If everything goes well, you should see a lot of build messages and below them
...
...
This diff is collapsed.
Click to expand it.
apps/sgx/enclave/build.rs
0 → 100644
+
9
−
0
View file @
a12b2b1b
use
std
::
env
;
fn
main
()
{
println!
(
"cargo:rustc-link-search=native={}"
,
env
::
var
(
"BUILD_DIR"
)
.unwrap
()
);
println!
(
"cargo:rustc-link-lib=static=model"
);
}
This diff is collapsed.
Click to expand it.
apps/sgx/enclave/src/build_model.py
0 → 100644
+
38
−
0
View file @
a12b2b1b
"""
Creates a simple TVM modules.
"""
import
argparse
import
os
from
os
import
path
as
osp
import
nnvm.compiler
import
nnvm.testing
import
tvm
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
-o
'
,
'
--out-dir
'
,
default
=
'
.
'
)
opts
=
parser
.
parse_args
()
# from tutorials/nnvm_quick_start.py
dshape
=
(
1
,
3
,
224
,
224
)
net
,
params
=
nnvm
.
testing
.
resnet
.
get_workload
(
layers
=
18
,
batch_size
=
dshape
[
0
],
image_shape
=
dshape
[
1
:])
with
nnvm
.
compiler
.
build_config
(
opt_level
=
3
):
graph
,
lib
,
params
=
nnvm
.
compiler
.
build
(
net
,
'
llvm --system-lib
'
,
shape
=
{
'
data
'
:
dshape
},
params
=
params
)
build_dir
=
osp
.
abspath
(
opts
.
out_dir
)
if
not
osp
.
isdir
(
build_dir
):
os
.
makedirs
(
build_dir
,
exist_ok
=
True
)
lib
.
save
(
osp
.
join
(
build_dir
,
'
model.bc
'
))
with
open
(
osp
.
join
(
build_dir
,
'
graph.json
'
),
'
w
'
)
as
f_graph_json
:
f_graph_json
.
write
(
graph
.
json
())
with
open
(
osp
.
join
(
build_dir
,
'
params.bin
'
),
'
wb
'
)
as
f_params
:
f_params
.
write
(
nnvm
.
compiler
.
save_param_dict
(
params
))
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment