Skip to content

Commit

Permalink
Create doc feature in all burn crates and use them for docs.rs build (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
syl20bnr committed Feb 1, 2024
1 parent 017f190 commit 7a8589e
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 49 deletions.
6 changes: 5 additions & 1 deletion burn-candle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ version.workspace = true
[features]
default = ["std"]
std = []
doc = ["default"]
cuda = ["candle-core/cuda"]
metal = ["candle-core/metal"]
accelerate = ["candle-core/accelerate"]


[dependencies]
derive-new = { workspace = true }
burn-tensor = { path = "../burn-tensor", version = "0.12.1", default-features = false }
half = { workspace = true }
candle-core = { workspace = true }


[dev-dependencies]
burn-autodiff = { path = "../burn-autodiff", version = "0.12.1", default-features = false, features = [
"export_tests",
Expand All @@ -33,3 +34,6 @@ burn-tch = { path = "../burn-tch", version = "0.12.1", default-features = false,
burn-tensor = { path = "../burn-tensor", version = "0.12.1", default-features = false, features = [
"export_tests",
] }

[package.metadata.docs.rs]
features = ["doc"]
7 changes: 5 additions & 2 deletions burn-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ version.workspace = true

[features]
default = ["std"]

std = ["rand/std"]

doc = ["default"]
wasm-sync = []

[target.'cfg(target_family = "wasm")'.dependencies]
async-trait = { workspace = true }
getrandom = { workspace = true, features = ["js"] }
web-time = { version = "1.0.0" }


[dependencies]
# ** Please make sure all dependencies support no_std when std is disabled **

Expand All @@ -33,3 +33,6 @@ serde = { workspace = true }

[dev-dependencies]
dashmap = { workspace = true }

[package.metadata.docs.rs]
features = ["doc"]
45 changes: 28 additions & 17 deletions burn-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,41 @@ version.workspace = true
[features]
default = [
"std",
"burn-dataset?/default",
"burn-ndarray?/default",
"burn-candle?/default",
"burn-wgpu?/default",
"burn-common/default",
"burn-dataset?/default",
"burn-fusion?/default",
"burn-ndarray?/default",
"burn-tch?/default",
"burn-dataset?/default",
"burn-common/default",
"burn-tensor/default",
"burn-wgpu?/default",
]
std = [
"bincode/std",
"burn-candle?/std",
"burn-common/std",
"burn-fusion?/std",
"burn-ndarray?/std",
"burn-tensor/std",
"burn-wgpu?/std",
"flate2",
"half/std",
"log",
"rand/std",
"rmp-serde",
"serde/std",
"serde_json/std",
"bincode/std",
"half/std",
"burn-ndarray?/std",
"burn-candle?/std",
"burn-wgpu?/std",
"burn-fusion?/std",
"burn-common/std",
"burn-tensor/std",
]
doc = [
"std",
"burn-candle/doc",
"burn-common/doc",
"burn-dataset/doc",
"burn-fusion/doc",
"burn-ndarray/doc",
"burn-tch/doc",
"burn-tensor/doc",
"burn-wgpu/doc",
]
dataset = ["burn-dataset"]
sqlite = ["burn-dataset?/sqlite"]
Expand Down Expand Up @@ -72,10 +82,8 @@ experimental-named-tensor = ["burn-tensor/experimental-named-tensor"]
test-tch = ["tch"] # To use tch during testing, default uses ndarray.
test-wgpu = ["wgpu"] # To use wgpu during testing, default uses ndarray.


[dependencies]


# ** Please make sure all dependencies support no_std when std is disabled **

burn-common = { path = "../burn-common", version = "0.12.1", default-features = false }
Expand Down Expand Up @@ -118,5 +126,8 @@ burn-dataset = { path = "../burn-dataset", version = "0.12.1", features = [
"fake",
] }

burn-ndarray = { path = "../burn-ndarray", version = "0.12.0", default-features = false }
burn-autodiff = { path = "../burn-autodiff", version = "0.12.0" }
burn-ndarray = { path = "../burn-ndarray", version = "0.12.1", default-features = false }
burn-autodiff = { path = "../burn-autodiff", version = "0.12.1" }

[package.metadata.docs.rs]
features = ["doc"]
4 changes: 4 additions & 0 deletions burn-dataset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version.workspace = true

[features]
default = ["sqlite-bundled"]
doc = ["default"]

audio = ["hound"]

Expand Down Expand Up @@ -64,3 +65,6 @@ fake = { workspace = true }

[package.metadata.cargo-udeps.ignore]
normal = ["strum", "strum_macros"]

[package.metadata.docs.rs]
features = ["doc"]
4 changes: 4 additions & 0 deletions burn-fusion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version.workspace = true
[features]
default = ["std"]
std = ["serde/std"]
doc = ["default"]

[dependencies]
burn-tensor = { path = "../burn-tensor", version = "0.12.1", default-features = false }
Expand All @@ -22,3 +23,6 @@ derive-new = {workspace = true }
spin = { workspace = true }
log = { workspace = true }
serde = { workspace = true }

[package.metadata.docs.rs]
features = ["doc"]
34 changes: 22 additions & 12 deletions burn-ndarray/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,35 @@ version.workspace = true

[features]
default = ["std"]

std = [
"rand/std",
"burn-tensor/std",
"burn-common/std",
"burn-autodiff",
"rayon",
"ndarray/std",
"ndarray/rayon",
"burn-common/std",
"burn-tensor/std",
"matrixmultiply/std",
"matrixmultiply/threading",
"ndarray/rayon",
"ndarray/std",
"rand/std",
"rayon",
]
doc = ["default"]

blas-accelerate = [
"blas-src/accelerate", # Accelerate framework (macOS only)
"ndarray/blas",
"blas-src/accelerate",
] # Accelerate framework (macOS only)
blas-netlib = ["ndarray/blas", "blas-src/netlib"]
blas-openblas = ["ndarray/blas", "blas-src/openblas", "openblas-src"]
blas-openblas-system = [
]
blas-netlib = [
"blas-src/netlib",
"ndarray/blas",
]
blas-openblas = [
"blas-src/openblas",
"ndarray/blas",
"openblas-src",
]
blas-openblas-system = [
"blas-src/openblas",
"ndarray/blas",
"openblas-src/system",
]

Expand All @@ -59,3 +66,6 @@ num-traits = { workspace = true }
openblas-src = { workspace = true, optional = true }
rand = { workspace = true }
spin = { workspace = true } # using in place of use std::sync::Mutex;

[package.metadata.docs.rs]
features = ["doc"]
2 changes: 1 addition & 1 deletion burn-tch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ burn-tensor = { path = "../burn-tensor", version = "0.12.1", default-features =
] }

[package.metadata.docs.rs]
features = [ "doc" ]
features = ["doc"]
4 changes: 4 additions & 0 deletions burn-tensor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version.workspace = true

[features]
default = ["std"]
doc = ["default"]
experimental-named-tensor = []
export_tests = ["burn-tensor-testgen"]
std = ["rand/std", "half/std"]
Expand All @@ -36,3 +37,6 @@ serde = { workspace = true }

[dev-dependencies]
rand = { workspace = true, features = ["std", "std_rng"] } # Default enables std

[package.metadata.docs.rs]
features = ["doc"]
6 changes: 5 additions & 1 deletion burn-train/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version.workspace = true

[features]
default = ["metrics", "tui"]
doc = ["default"]
metrics = ["nvml-wrapper", "sysinfo", "systemstat"]
tui = ["ratatui", "crossterm"]

Expand All @@ -37,4 +38,7 @@ derive-new = { workspace = true }
serde = { workspace = true, features = ["std", "derive"] }

[dev-dependencies]
burn-ndarray = { path = "../burn-ndarray", version = "0.12.0" }
burn-ndarray = { path = "../burn-ndarray", version = "0.12.1" }

[package.metadata.docs.rs]
features = ["doc"]
4 changes: 4 additions & 0 deletions burn-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version.workspace = true
[features]
default = ["autotune", "std", "burn-compute/default"]
std = []
doc = ["default"]
autotune = []
fusion = ["burn-fusion"]

Expand Down Expand Up @@ -66,3 +67,6 @@ harness = false
[[bench]]
name = "reduction"
harness = false

[package.metadata.docs.rs]
features = ["doc"]
21 changes: 6 additions & 15 deletions burn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ rust-version = "1.71"
[features]
default = ["burn-core/default", "burn-train?/default", "std"]
std = ["burn-core/std"]
doc = [
"default",
"burn-core/doc",
"burn-train/doc",
]

# Training with full features
train = ["burn-train", "autodiff", "dataset"]
Expand Down Expand Up @@ -66,18 +71,4 @@ burn-core = { path = "../burn-core", version = "0.12.1", default-features = fals
burn-train = { path = "../burn-train", version = "0.12.1", optional = true, default-features = false }

[package.metadata.docs.rs]
features = [
"dataset",
"default",
"std",
"train",
"tui",
"metrics",
"sqlite",
"ndarray",
"tch",
"wgpu",
"candle",
"fusion",
"experimental-named-tensor",
]
features = ["doc"]

0 comments on commit 7a8589e

Please sign in to comment.