task_rust.sh 2.05 KB
Newer Older
1
#!/bin/bash
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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.
18 19

set -e
20
set -u
21

22 23 24 25
# Temporary disable rust tests
# remove this line to re-enable.
exit 0

26
export TVM_HOME="$(git rev-parse --show-toplevel)"
27

28 29
export LD_LIBRARY_PATH="$TVM_HOME/lib:$TVM_HOME/build:${LD_LIBRARY_PATH:-}"
export PYTHONPATH="$TVM_HOME/python":"$TVM_HOME/topi/python"
30
export RUST_DIR="$TVM_HOME/rust"
31

32 33 34 35 36
cd $RUST_DIR
cargo fmt -- --check

# test common
cd $RUST_DIR/common
37 38
cargo build
cargo test --tests
39

40 41
cargo build --features bindings
cargo test --features bindings --tests
42 43 44

# test runtime
cd $RUST_DIR/runtime
45 46

# run basic tests
47 48
python3 tests/build_model.py
cargo test --tests
49 50

# run TVM module test
51 52 53
cd tests/test_tvm_basic
cargo run
cd -
54

55 56 57 58
cd tests/test_tvm_dso
cargo run
cd -

59 60
# run nn graph test
cd tests/test_nn
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
cargo run
cd -

# test frontend
cd $RUST_DIR/frontend

cargo test --tests -- --test-threads=1

# run basic tests on cpu
cd tests/basics
cargo build --features cpu
cargo run --features cpu
# uncomment when have more CI resources
# cargo build --features gpu
# cargo run --features gpu
# fi
cd -

# run callback tests separately: https://discuss.tvm.ai/t/are-global-functions-need-to-be-accessed-in-separate-processes/1075
cd tests/callback
cargo build
cargo run --bin int
cargo run --bin float
cargo run --bin array
cargo run --bin string
cd -
87 88 89 90

cd examples/resnet
cargo build
cd -