mirror of https://github.com/tracel-ai/burn.git
Simpler CI (#407)
This commit is contained in:
parent
6c834d3b22
commit
b6be22b855
|
@ -6,82 +6,49 @@ on:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize]
|
types: [opened, synchronize]
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-burn:
|
test-burn-std:
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
runs-on: ubuntu-latest
|
||||||
with:
|
steps:
|
||||||
crate: burn
|
- name: checkout
|
||||||
test-no-default-feature: true
|
uses: actions/checkout@v3
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-common:
|
- name: install rust
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
crate: burn-common
|
components: rustfmt, clippy
|
||||||
test-no-default-feature: true
|
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-dataset:
|
- name: caching
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
crate: burn-dataset
|
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
|
||||||
args-test: --all-features
|
|
||||||
|
|
||||||
test-burn-tensor:
|
- name: install llvmpipe and lavapipe
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
run: |
|
||||||
|
sudo apt-get update -y -qq
|
||||||
|
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
|
||||||
|
|
||||||
|
- name: run checks & tests
|
||||||
|
run: ./run-checks.sh std
|
||||||
|
|
||||||
|
test-burn-no-std:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: install rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
crate: burn-tensor
|
components: rustfmt, clippy
|
||||||
test-no-default-feature: true
|
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-tch:
|
- name: caching
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
crate: burn-tch
|
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
|
||||||
args-doc: --features doc
|
|
||||||
|
|
||||||
test-burn-ndarray:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-ndarray
|
|
||||||
test-no-default-feature: true
|
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-no-std-tests:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-no-std-tests
|
|
||||||
test-no-default-feature: true
|
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-autodiff:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-autodiff
|
|
||||||
|
|
||||||
test-burn-core:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-core
|
|
||||||
test-no-default-feature: true
|
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-core-backend-tch:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-core
|
|
||||||
args-doc: --features test-tch
|
|
||||||
|
|
||||||
test-burn-train:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-train
|
|
||||||
|
|
||||||
test-burn-import:
|
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
|
||||||
with:
|
|
||||||
crate: burn-import
|
|
||||||
|
|
||||||
|
- name: run checks & tests
|
||||||
|
run: ./run-checks.sh no_std
|
||||||
|
|
|
@ -312,7 +312,7 @@ impl<G: GraphicsApi> BaseOps<G> {
|
||||||
.context
|
.context
|
||||||
.compile_static::<KernelSettings<IndexSelectAssignInplace, E, I, 256, 1, 1>>();
|
.compile_static::<KernelSettings<IndexSelectAssignInplace, E, I, 256, 1, 1>>();
|
||||||
|
|
||||||
let mut shape_tmp = values.shape.clone();
|
let mut shape_tmp = values.shape;
|
||||||
shape_tmp.dims[dim] = 1; // Just one thread for the dim.
|
shape_tmp.dims[dim] = 1; // Just one thread for the dim.
|
||||||
|
|
||||||
tensor.context.execute(
|
tensor.context.execute(
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
# It is used to check that the code compiles and passes all tests.
|
# It is used to check that the code compiles and passes all tests.
|
||||||
# It is also used to check that the code is formatted correctly and passes clippy.
|
# It is also used to check that the code is formatted correctly and passes clippy.
|
||||||
|
|
||||||
|
# Usage: ./run-checks.sh {all|no_std|std} (default: all)
|
||||||
|
|
||||||
# Exit immediately if a command exits with a non-zero status.
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
@ -64,12 +66,9 @@ build_and_test_all_features() {
|
||||||
# Set RUSTDOCFLAGS to treat warnings as errors for the documentation build
|
# Set RUSTDOCFLAGS to treat warnings as errors for the documentation build
|
||||||
export RUSTDOCFLAGS="-D warnings"
|
export RUSTDOCFLAGS="-D warnings"
|
||||||
|
|
||||||
# Save the script start time
|
# Run the checks for std and all features with std
|
||||||
start_time=$(date +%s)
|
std_func() {
|
||||||
|
echo "Running std checks"
|
||||||
# Add wasm32 target for compiler.
|
|
||||||
rustup target add wasm32-unknown-unknown
|
|
||||||
rustup target add thumbv7m-none-eabi
|
|
||||||
|
|
||||||
cargo build --workspace
|
cargo build --workspace
|
||||||
cargo test --workspace
|
cargo test --workspace
|
||||||
|
@ -77,18 +76,59 @@ cargo fmt --check --all
|
||||||
cargo clippy -- -D warnings
|
cargo clippy -- -D warnings
|
||||||
cargo doc --workspace
|
cargo doc --workspace
|
||||||
|
|
||||||
# no_std tests
|
# all features
|
||||||
|
echo "Running all-features checks"
|
||||||
|
build_and_test_all_features "burn-dataset"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the checks for no_std
|
||||||
|
no_std_func() {
|
||||||
|
echo "Running no_std checks"
|
||||||
|
|
||||||
|
# Add wasm32 target for compiler.
|
||||||
|
rustup target add wasm32-unknown-unknown
|
||||||
|
rustup target add thumbv7m-none-eabi
|
||||||
|
|
||||||
build_and_test_no_std "burn"
|
build_and_test_no_std "burn"
|
||||||
build_and_test_no_std "burn-core"
|
build_and_test_no_std "burn-core"
|
||||||
build_and_test_no_std "burn-common"
|
build_and_test_no_std "burn-common"
|
||||||
build_and_test_no_std "burn-tensor"
|
build_and_test_no_std "burn-tensor"
|
||||||
build_and_test_no_std "burn-ndarray"
|
build_and_test_no_std "burn-ndarray"
|
||||||
build_and_test_no_std "burn-no-std-tests"
|
build_and_test_no_std "burn-no-std-tests"
|
||||||
|
}
|
||||||
|
|
||||||
# all features tests
|
# Save the script start time
|
||||||
build_and_test_all_features "burn-dataset"
|
start_time=$(date +%s)
|
||||||
|
|
||||||
|
# If no arguments were supplied or if it's empty, set the default as 'all'
|
||||||
|
if [ -z "${1-}" ]; then
|
||||||
|
arg="all"
|
||||||
|
else
|
||||||
|
arg=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check the argument and call the appropriate functions
|
||||||
|
case $arg in
|
||||||
|
all)
|
||||||
|
no_std_func
|
||||||
|
std_func
|
||||||
|
;;
|
||||||
|
no_std)
|
||||||
|
no_std_func
|
||||||
|
;;
|
||||||
|
std)
|
||||||
|
std_func
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: Invalid argument"
|
||||||
|
echo "Usage: $0 {all|no_std|std}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Calculate and print the script execution time
|
# Calculate and print the script execution time
|
||||||
end_time=$(date +%s)
|
end_time=$(date +%s)
|
||||||
execution_time=$((end_time - start_time))
|
execution_time=$((end_time - start_time))
|
||||||
echo "Script executed in $execution_time seconds."
|
echo "Script executed in $execution_time seconds."
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue