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: |
|
||||||
with:
|
sudo apt-get update -y -qq
|
||||||
crate: burn-tensor
|
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
|
||||||
test-no-default-feature: true
|
sudo apt-get update
|
||||||
no-std-build-targets: true
|
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
|
||||||
|
|
||||||
test-burn-tch:
|
- name: run checks & tests
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
run: ./run-checks.sh std
|
||||||
with:
|
|
||||||
crate: burn-tch
|
|
||||||
args-doc: --features doc
|
|
||||||
|
|
||||||
test-burn-ndarray:
|
test-burn-no-std:
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
runs-on: ubuntu-latest
|
||||||
with:
|
steps:
|
||||||
crate: burn-ndarray
|
- name: checkout
|
||||||
test-no-default-feature: true
|
uses: actions/checkout@v3
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-no-std-tests:
|
- name: install rust
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
crate: burn-no-std-tests
|
components: rustfmt, clippy
|
||||||
test-no-default-feature: true
|
|
||||||
no-std-build-targets: true
|
|
||||||
|
|
||||||
test-burn-autodiff:
|
- name: caching
|
||||||
uses: burn-rs/burn/.github/workflows/test-template.yml@main
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
crate: burn-autodiff
|
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
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,31 +66,69 @@ 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"
|
||||||
|
|
||||||
|
# Run the checks for std and all features with std
|
||||||
|
std_func() {
|
||||||
|
echo "Running std checks"
|
||||||
|
|
||||||
|
cargo build --workspace
|
||||||
|
cargo test --workspace
|
||||||
|
cargo fmt --check --all
|
||||||
|
cargo clippy -- -D warnings
|
||||||
|
cargo doc --workspace
|
||||||
|
|
||||||
|
# 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-core"
|
||||||
|
build_and_test_no_std "burn-common"
|
||||||
|
build_and_test_no_std "burn-tensor"
|
||||||
|
build_and_test_no_std "burn-ndarray"
|
||||||
|
build_and_test_no_std "burn-no-std-tests"
|
||||||
|
}
|
||||||
|
|
||||||
# Save the script start time
|
# Save the script start time
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
|
|
||||||
# Add wasm32 target for compiler.
|
# If no arguments were supplied or if it's empty, set the default as 'all'
|
||||||
rustup target add wasm32-unknown-unknown
|
if [ -z "${1-}" ]; then
|
||||||
rustup target add thumbv7m-none-eabi
|
arg="all"
|
||||||
|
else
|
||||||
|
arg=$1
|
||||||
|
fi
|
||||||
|
|
||||||
cargo build --workspace
|
# Check the argument and call the appropriate functions
|
||||||
cargo test --workspace
|
case $arg in
|
||||||
cargo fmt --check --all
|
all)
|
||||||
cargo clippy -- -D warnings
|
no_std_func
|
||||||
cargo doc --workspace
|
std_func
|
||||||
|
;;
|
||||||
# no_std tests
|
no_std)
|
||||||
build_and_test_no_std "burn"
|
no_std_func
|
||||||
build_and_test_no_std "burn-core"
|
;;
|
||||||
build_and_test_no_std "burn-common"
|
std)
|
||||||
build_and_test_no_std "burn-tensor"
|
std_func
|
||||||
build_and_test_no_std "burn-ndarray"
|
;;
|
||||||
build_and_test_no_std "burn-no-std-tests"
|
*)
|
||||||
|
echo "Error: Invalid argument"
|
||||||
# all features tests
|
echo "Usage: $0 {all|no_std|std}"
|
||||||
build_and_test_all_features "burn-dataset"
|
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