diff --git a/.dockerignore b/.dockerignore index a76cf400..b220ea20 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,10 @@ target/ *.md !README*.md .github/ -benches/ -examples/ scripts/ +# NB: benches/ and examples/ are intentionally NOT ignored. Cargo.toml declares +# explicit [[bench]] and [[example]] targets, and cargo validates that every +# declared target's source file exists when it parses the manifest — even for a +# lib-only build. Excluding these dirs makes `cargo build` fail at manifest +# parse with "can't find example/bench". They are not compiled by the +# default build, so the cost of shipping them in the context is just their size. diff --git a/Dockerfile b/Dockerfile index bfe45160..5e8f1788 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,16 @@ COPY crates/ crates/ COPY src/ src/ COPY ndarray-rand/src/ ndarray-rand/src/ +# Cargo.toml (root) and ndarray-rand/Cargo.toml (a workspace member) declare +# explicit [[example]]/[[bench]] targets. Cargo validates that every declared +# target's source file exists while parsing the manifest — even for a lib-only +# build — so these dirs must be in the context or `cargo build` fails at parse +# with "can't find example/bench". They are NOT compiled here (the default +# build skips examples/benches), so this only adds source bytes, not build time. +COPY examples/ examples/ +COPY benches/ benches/ +COPY ndarray-rand/benches/ ndarray-rand/benches/ + # Default target: x86-64-v3 (AVX2) — runs on GitHub CI and most servers. # Use Dockerfile.avx512 for x86-64-v4 (AVX-512). ndarray's simd.rs polyfill # detects AVX-512 at runtime via LazyLock even when compiled for v3; diff --git a/Dockerfile.avx512 b/Dockerfile.avx512 index 102773c3..b1ebe529 100644 --- a/Dockerfile.avx512 +++ b/Dockerfile.avx512 @@ -32,6 +32,16 @@ COPY crates/ crates/ COPY src/ src/ COPY ndarray-rand/src/ ndarray-rand/src/ +# Cargo.toml (root) and ndarray-rand/Cargo.toml (a workspace member) declare +# explicit [[example]]/[[bench]] targets. Cargo validates that every declared +# target's source file exists while parsing the manifest — even for a lib-only +# build — so these dirs must be in the context or `cargo build` fails at parse +# with "can't find example/bench". They are NOT compiled here (the default +# build skips examples/benches), so this only adds source bytes, not build time. +COPY examples/ examples/ +COPY benches/ benches/ +COPY ndarray-rand/benches/ ndarray-rand/benches/ + # AVX-512 pinned: compile-time dispatch, everything inlined ENV RUSTFLAGS="-C target-cpu=x86-64-v4"