diff --git a/crates/rattler_solve/Cargo.toml b/crates/rattler_solve/Cargo.toml index f3be2183c..3e1f648f9 100644 --- a/crates/rattler_solve/Cargo.toml +++ b/crates/rattler_solve/Cargo.toml @@ -11,8 +11,8 @@ license.workspace = true readme.workspace = true [dependencies] -rattler_conda_types = { path="../rattler_conda_types", version = "0.28.1", default-features = false } -rattler_digest = { path="../rattler_digest", version = "1.0.2", default-features = false } +rattler_conda_types = { path = "../rattler_conda_types", version = "0.28.1", default-features = false } +rattler_digest = { path = "../rattler_digest", version = "1.0.2", default-features = false } libc = { workspace = true, optional = true } chrono = { workspace = true } thiserror = { workspace = true } @@ -20,7 +20,7 @@ tracing = { workspace = true } itertools = { workspace = true } url = { workspace = true } tempfile = { workspace = true } -rattler_libsolv_c = { path="../rattler_libsolv_c", version = "1.0.2", default-features = false, optional = true } +rattler_libsolv_c = { path = "../rattler_libsolv_c", version = "1.0.2", default-features = false, optional = true } resolvo = { workspace = true, optional = true } futures = { workspace = true, optional = true } serde = { workspace = true, optional = true } @@ -29,7 +29,9 @@ serde = { workspace = true, optional = true } criterion = { workspace = true } insta = { workspace = true, features = ["yaml"] } once_cell = { workspace = true } -rattler_repodata_gateway = { path = "../rattler_repodata_gateway", default-features = false, features = ["sparse"] } +rattler_repodata_gateway = { path = "../rattler_repodata_gateway", default-features = false, features = [ + "sparse", +] } rstest = { workspace = true } serde_json = { workspace = true } similar-asserts = { workspace = true } @@ -46,5 +48,9 @@ resolvo = ["dep:resolvo", "dep:futures"] name = "bench" harness = false +[[bench]] +name = "sorting_bench" +harness = false + [package.metadata.docs.rs] all-features = true diff --git a/crates/rattler_solve/benches/sorting_bench.rs b/crates/rattler_solve/benches/sorting_bench.rs new file mode 100644 index 000000000..73f0431a5 --- /dev/null +++ b/crates/rattler_solve/benches/sorting_bench.rs @@ -0,0 +1,79 @@ +use std::path::Path; + +use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion}; +use futures::FutureExt; +use rattler_conda_types::{Channel, MatchSpec}; +use rattler_repodata_gateway::sparse::SparseRepoData; +use rattler_solve::resolvo::CondaDependencyProvider; +use rattler_solve::ChannelPriority; +use resolvo::SolverCache; + +fn bench_sort(c: &mut Criterion, sparse_repo_data: &SparseRepoData, spec: &str) { + let match_spec = + MatchSpec::from_str(spec, rattler_conda_types::ParseStrictness::Lenient).unwrap(); + let package_name = match_spec.name.clone().unwrap(); + + let repodata = + SparseRepoData::load_records_recursive([sparse_repo_data], [package_name.clone()], None) + .expect("failed to load records"); + + // Construct a cache + c.bench_function(&format!("sort {}", spec), |b| { + // Get the candidates for the package + b.iter_batched( + || (package_name.clone(), match_spec.clone()), + |(package_name, match_spec)| { + // Construct dependency provider + let dependency_provider = CondaDependencyProvider::new( + repodata.iter().map(|r| r.iter().collect()), + &[], + &[], + &[], + &[match_spec.clone()], + None, + ChannelPriority::default(), + None, + rattler_solve::SolveStrategy::Highest, + ) + .expect("failed to create dependency provider"); + + let name = dependency_provider + .pool + .intern_package_name(package_name.as_normalized()); + let version_set = dependency_provider + .pool + .intern_version_set(name, match_spec.into_nameless().1.into()); + + let cache = SolverCache::new(dependency_provider); + + let deps = cache + .get_or_cache_sorted_candidates(version_set.into()) + .now_or_never() + .expect("failed to get candidates") + .expect("solver requested cancellation"); + black_box(deps); + }, + BatchSize::SmallInput, + ); + }); +} + +fn criterion_benchmark(c: &mut Criterion) { + let channel_path = Path::new(env!("CARGO_MANIFEST_DIR")) + .join("../..") + .join("test-data") + .join("channels") + .join("conda-forge"); + let repodata_json_path = channel_path.join("linux-64").join("repodata.json"); + let channel = Channel::from_directory(&channel_path); + + let sparse_repo_data = SparseRepoData::new(channel, "linux-64", repodata_json_path, None) + .expect("failed to load sparse repodata"); + + bench_sort(c, &sparse_repo_data, "pytorch"); + bench_sort(c, &sparse_repo_data, "python"); + bench_sort(c, &sparse_repo_data, "tensorflow"); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess_highest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess_highest.snap new file mode 100644 index 000000000..82d257441 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess_highest.snap @@ -0,0 +1,17 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +abess=0.4.5=py310hc4a4660_1 +abess=0.4.5=py39hac2352c_1 +abess=0.4.5=py38h514daf8_1 +abess=0.4.5=py37h48bf904_1 +abess=0.4.5=py39hac2352c_0 +abess=0.4.5=py38h514daf8_0 +abess=0.4.5=py37h48bf904_0 +abess=0.4.4=py39hac2352c_1 +abess=0.4.4=py38h514daf8_1 +abess=0.4.4=py37h48bf904_1 +abess=0.4.4=py39hac2352c_0 +abess=0.4.4=py38h514daf8_0 +abess=0.4.4=py37h48bf904_0 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_certifi_highest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_certifi_highest.snap new file mode 100644 index 000000000..752c70756 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_certifi_highest.snap @@ -0,0 +1,150 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +certifi=2022.6.15=py310hff52083_0 +certifi=2022.6.15=py39hf3d152e_0 +certifi=2022.6.15=py38h578d9bd_0 +certifi=2022.6.15=py37h89c1867_0 +certifi=2022.6.15=py39h4162558_0 +certifi=2022.6.15=py38h373033e_0 +certifi=2022.5.18.1=py310hff52083_0 +certifi=2022.5.18.1=py39hf3d152e_0 +certifi=2022.5.18.1=py38h578d9bd_0 +certifi=2022.5.18.1=py37h89c1867_0 +certifi=2022.5.18.1=py39h4162558_0 +certifi=2022.5.18.1=py38h373033e_0 +certifi=2022.5.18=py310hff52083_0 +certifi=2022.5.18=py39hf3d152e_0 +certifi=2022.5.18=py38h578d9bd_0 +certifi=2022.5.18=py37h89c1867_0 +certifi=2022.5.18=py39h4162558_0 +certifi=2022.5.18=py38h373033e_0 +certifi=2021.10.8=py310hff52083_2 +certifi=2021.10.8=py39hf3d152e_2 +certifi=2021.10.8=py38h578d9bd_2 +certifi=2021.10.8=py37h89c1867_2 +certifi=2021.10.8=py39h4162558_2 +certifi=2021.10.8=py38h373033e_2 +certifi=2021.10.8=py310hff52083_1 +certifi=2021.10.8=py39hf3d152e_1 +certifi=2021.10.8=py38h578d9bd_1 +certifi=2021.10.8=py37h89c1867_1 +certifi=2021.10.8=py37h9c2f6ca_1 +certifi=2021.10.8=py39hf3d152e_0 +certifi=2021.10.8=py38h578d9bd_0 +certifi=2021.10.8=py37h89c1867_0 +certifi=2021.10.8=py37h9c2f6ca_0 +certifi=2021.5.30=py39hf3d152e_0 +certifi=2021.5.30=py38h578d9bd_0 +certifi=2021.5.30=py37h89c1867_0 +certifi=2021.5.30=py36h5fab9bb_0 +certifi=2021.5.30=py37h9c2f6ca_0 +certifi=2021.5.30=py36hd000896_0 +certifi=2020.12.5=py39hf3d152e_1 +certifi=2020.12.5=py38h578d9bd_1 +certifi=2020.12.5=py37h89c1867_1 +certifi=2020.12.5=py36h5fab9bb_1 +certifi=2020.12.5=py37h9c2f6ca_1 +certifi=2020.12.5=py36hd000896_1 +certifi=2020.12.5=py39hf3d152e_0 +certifi=2020.12.5=py38h578d9bd_0 +certifi=2020.12.5=py37h89c1867_0 +certifi=2020.12.5=py36h5fab9bb_0 +certifi=2020.12.5=py36hd000896_0 +certifi=2020.11.8=py39hf3d152e_0 +certifi=2020.11.8=py38h578d9bd_0 +certifi=2020.11.8=py37h89c1867_0 +certifi=2020.11.8=py36h5fab9bb_0 +certifi=2020.11.8=py36hd000896_0 +certifi=2020.6.20=py39h079e4ff_2 +certifi=2020.6.20=py38h924ce5b_2 +certifi=2020.6.20=py37he5f6b98_2 +certifi=2020.6.20=py36h9880bd3_2 +certifi=2020.6.20=py36ha6c21b1_2 +certifi=2020.6.20=py38h924ce5b_1 +certifi=2020.6.20=py37he5f6b98_1 +certifi=2020.6.20=py36h9880bd3_1 +certifi=2020.6.20=py36ha6c21b1_1 +certifi=2020.6.20=py38h32f6830_0 +certifi=2020.6.20=py37hc8dfbb8_0 +certifi=2020.6.20=py36h9f0ad1d_0 +certifi=2020.6.20=py36hc560c46_0 +certifi=2020.4.5.2=py38h32f6830_0 +certifi=2020.4.5.2=py37hc8dfbb8_0 +certifi=2020.4.5.2=py36h9f0ad1d_0 +certifi=2020.4.5.2=py36hc560c46_0 +certifi=2020.4.5.1=py38h32f6830_0 +certifi=2020.4.5.1=py37hc8dfbb8_0 +certifi=2020.4.5.1=py36h9f0ad1d_0 +certifi=2020.4.5.1=py36hc560c46_0 +certifi=2019.11.28=py38h32f6830_1 +certifi=2019.11.28=py37hc8dfbb8_1 +certifi=2019.11.28=py36h9f0ad1d_1 +certifi=2019.11.28=py27h8c360ce_1 +certifi=2019.11.28=py36hc560c46_1 +certifi=2019.11.28=py38h32f6830_0 +certifi=2019.11.28=py38_0 +certifi=2019.11.28=py37hc8dfbb8_0 +certifi=2019.11.28=py37_0 +certifi=2019.11.28=py36h9f0ad1d_0 +certifi=2019.11.28=py36hc560c46_0 +certifi=2019.11.28=py36_0 +certifi=2019.11.28=py27h8c360ce_0 +certifi=2019.11.28=py27_0 +certifi=2019.9.11=py38_0 +certifi=2019.9.11=py37_0 +certifi=2019.9.11=py36_0 +certifi=2019.9.11=py27_0 +certifi=2019.6.16=py37_1 +certifi=2019.6.16=py36_1 +certifi=2019.6.16=py27_1 +certifi=2019.6.16=py37_0 +certifi=2019.6.16=py36_0 +certifi=2019.6.16=py27_0 +certifi=2019.3.9=py37_0 +certifi=2019.3.9=py36_0 +certifi=2019.3.9=py27_0 +certifi=2018.11.29=py37_1000 +certifi=2018.11.29=py36_1000 +certifi=2018.11.29=py27_1000 +certifi=2018.10.15=py37_1000 +certifi=2018.10.15=py36_1000 +certifi=2018.10.15=py27_1000 +certifi=2018.8.24=py37_1001 +certifi=2018.8.24=py36_1001 +certifi=2018.8.24=py35_1001 +certifi=2018.8.24=py27_1001 +certifi=2018.8.24=py36_1 +certifi=2018.8.24=py35_1 +certifi=2018.8.24=py27_1 +certifi=2018.8.24=py36_0 +certifi=2018.8.24=py35_0 +certifi=2018.8.24=py27_0 +certifi=2018.8.13=py36_0 +certifi=2018.8.13=py35_0 +certifi=2018.8.13=py27_0 +certifi=2018.4.16=py37_0 +certifi=2018.4.16=py36_0 +certifi=2018.4.16=py35_0 +certifi=2018.4.16=py27_0 +certifi=2018.1.18=py36_0 +certifi=2018.1.18=py35_0 +certifi=2018.1.18=py27_0 +certifi=2017.11.5=py36_0 +certifi=2017.11.5=py35_0 +certifi=2017.11.5=py27_0 +certifi=2017.7.27.1=py36_0 +certifi=2017.7.27.1=py35_0 +certifi=2017.7.27.1=py27_0 +certifi=2017.4.17=py36_0 +certifi=2017.4.17=py35_0 +certifi=2017.4.17=py27_0 +certifi=2017.1.23=py36_0 +certifi=2017.1.23=py35_0 +certifi=2017.1.23=py34_0 +certifi=2017.1.23=py27_0 +certifi=2016.9.26=py36_0 +certifi=2016.9.26=py35_0 +certifi=2016.9.26=py34_0 +certifi=2016.9.26=py27_0 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_libgcc-ng_highest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_libgcc-ng_highest.snap new file mode 100644 index 000000000..12b97b4ec --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_libgcc-ng_highest.snap @@ -0,0 +1,92 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +libgcc-ng=12.1.0=h8d9b700_16 +libgcc-ng=11.3.0=h36d3e0d_16 +libgcc-ng=11.2.0=h1d223b6_16 +libgcc-ng=11.2.0=h1d223b6_15 +libgcc-ng=11.2.0=h1d223b6_14 +libgcc-ng=11.2.0=h1d223b6_13 +libgcc-ng=11.2.0=h1d223b6_12 +libgcc-ng=11.2.0=h1d223b6_11 +libgcc-ng=11.2.0=h1d223b6_10 +libgcc-ng=11.2.0=h1d223b6_9 +libgcc-ng=11.2.0=h1d223b6_8 +libgcc-ng=11.1.0=hc902ee8_8 +libgcc-ng=11.1.0=hc902ee8_7 +libgcc-ng=11.1.0=hc902ee8_6 +libgcc-ng=11.1.0=hc902ee8_5 +libgcc-ng=11.1.0=hc902ee8_4 +libgcc-ng=11.1.0=hc902ee8_3 +libgcc-ng=10.4.0=hffabe06_16 +libgcc-ng=10.3.0=hb27ad48_16 +libgcc-ng=10.3.0=hb27ad48_15 +libgcc-ng=10.3.0=hb27ad48_14 +libgcc-ng=10.3.0=hb27ad48_13 +libgcc-ng=10.3.0=hb27ad48_12 +libgcc-ng=10.3.0=hb27ad48_11 +libgcc-ng=10.3.0=hb27ad48_10 +libgcc-ng=10.3.0=hb27ad48_9 +libgcc-ng=10.3.0=hb27ad48_8 +libgcc-ng=10.3.0=hb27ad48_7 +libgcc-ng=10.3.0=hb27ad48_6 +libgcc-ng=10.3.0=hb27ad48_5 +libgcc-ng=10.3.0=hb27ad48_4 +libgcc-ng=10.3.0=hb27ad48_3 +libgcc-ng=9.5.0=hea2341a_16 +libgcc-ng=9.4.0=hfa6338b_16 +libgcc-ng=9.4.0=hfa6338b_15 +libgcc-ng=9.4.0=hfa6338b_14 +libgcc-ng=9.4.0=hfa6338b_13 +libgcc-ng=9.4.0=hfa6338b_12 +libgcc-ng=9.4.0=hfa6338b_11 +libgcc-ng=9.4.0=hfa6338b_10 +libgcc-ng=9.4.0=hfa6338b_9 +libgcc-ng=9.4.0=hfa6338b_8 +libgcc-ng=9.4.0=hfa6338b_7 +libgcc-ng=9.4.0=hfa6338b_6 +libgcc-ng=9.4.0=hfa6338b_5 +libgcc-ng=9.4.0=hfa6338b_4 +libgcc-ng=9.4.0=hfa6338b_3 +libgcc-ng=9.3.0=h2828fa1_19 +libgcc-ng=9.3.0=h2828fa1_18 +libgcc-ng=9.3.0=h5dbcf3e_17 +libgcc-ng=9.3.0=h24d8f2e_16 +libgcc-ng=9.3.0=h24d8f2e_15 +libgcc-ng=9.3.0=h24d8f2e_14 +libgcc-ng=9.3.0=h24d8f2e_13 +libgcc-ng=9.3.0=h24d8f2e_12 +libgcc-ng=9.3.0=h24d8f2e_11 +libgcc-ng=9.2.0=h24d8f2e_2 +libgcc-ng=9.2.0=hdf63c60_0 +libgcc-ng=8.5.0=h9c19199_16 +libgcc-ng=8.5.0=h9c19199_15 +libgcc-ng=8.5.0=h9c19199_14 +libgcc-ng=8.5.0=h9c19199_13 +libgcc-ng=8.5.0=h9c19199_12 +libgcc-ng=8.5.0=h9c19199_11 +libgcc-ng=8.5.0=h9c19199_10 +libgcc-ng=8.5.0=h9c19199_9 +libgcc-ng=8.5.0=h9c19199_8 +libgcc-ng=8.4.0=h2828fa1_19 +libgcc-ng=8.4.0=h2828fa1_18 +libgcc-ng=8.4.0=h5dbcf3e_17 +libgcc-ng=8.4.0=h24d8f2e_16 +libgcc-ng=8.4.0=h24d8f2e_15 +libgcc-ng=8.4.0=h24d8f2e_14 +libgcc-ng=7.5.0=h2828fa1_20 +libgcc-ng=7.5.0=h2828fa1_19 +libgcc-ng=7.5.0=h2828fa1_18 +libgcc-ng=7.5.0=h5dbcf3e_17 +libgcc-ng=7.5.0=h24d8f2e_16 +libgcc-ng=7.5.0=h24d8f2e_15 +libgcc-ng=7.5.0=h24d8f2e_14 +libgcc-ng=7.5.0=h24d8f2e_13 +libgcc-ng=7.5.0=h24d8f2e_12 +libgcc-ng=7.5.0=h24d8f2e_11 +libgcc-ng=7.5.0=h24d8f2e_10 +libgcc-ng=7.5.0=h24d8f2e_9 +libgcc-ng=7.3.0=h24d8f2e_5 +libgcc-ng=7.3.0=h24d8f2e_4 +libgcc-ng=7.3.0=hdf63c60_2 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_libuuid_highest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_libuuid_highest.snap new file mode 100644 index 000000000..4cc60d240 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_libuuid_highest.snap @@ -0,0 +1,6 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +libuuid=2.32.1=h7f98852_1000 +libuuid=2.32.1=h14c3975_1000 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python_highest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python_highest.snap new file mode 100644 index 000000000..e745b2f9a --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python_highest.snap @@ -0,0 +1,30 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +python=3.10.5=ha86cf86_0_cpython +python=3.10.5=h582c2e5_0_cpython +python=3.10.4=h2660328_0_cpython +python=3.10.4=h9a8a25e_0_cpython +python=3.10.2=hc74c709_4_cpython +python=3.10.2=h85951f9_4_cpython +python=3.10.2=hc74c709_3_cpython +python=3.10.2=h85951f9_3_cpython +python=3.10.2=hc74c709_2_cpython +python=3.10.2=h85951f9_2_cpython +python=3.10.2=hc74c709_1_cpython +python=3.10.2=h85951f9_1_cpython +python=3.10.2=h543edf9_0_cpython +python=3.10.2=h62f1059_0_cpython +python=3.10.1=h543edf9_2_cpython +python=3.10.1=h62f1059_2_cpython +python=3.10.1=h543edf9_1_cpython +python=3.10.1=h62f1059_1_cpython +python=3.10.1=h543edf9_0_cpython +python=3.10.1=h62f1059_0_cpython +python=3.10.0=h543edf9_3_cpython +python=3.10.0=h62f1059_3_cpython +python=3.10.0=h543edf9_2_cpython +python=3.10.0=h62f1059_2_cpython +python=3.10.0=h543edf9_1_cpython +python=3.10.0=h62f1059_1_cpython diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_highest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_highest.snap new file mode 100644 index 000000000..40691f62c --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_highest.snap @@ -0,0 +1,68 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +pytorch=1.12.1=cuda112py310h51fe464_200 +pytorch=1.12.1=cuda111py310h385535d_200 +pytorch=1.12.1=cuda110py310hfdf97d1_200 +pytorch=1.12.1=cuda112py39ha0cca9b_200 +pytorch=1.12.1=cuda111py39h9f128c5_200 +pytorch=1.12.1=cuda110py39h0a9da28_200 +pytorch=1.12.1=cuda112py38habe9d5a_200 +pytorch=1.12.1=cuda111py38h2d04dd0_200 +pytorch=1.12.1=cuda110py38h386aa8f_200 +pytorch=1.12.1=cuda111py37hdb2541a_200 +pytorch=1.12.1=cuda110py37h0def887_200 +pytorch=1.12.1=cuda102py310hdf4a2db_200 +pytorch=1.12.1=cuda102py39hbbcd3cb_200 +pytorch=1.12.1=cuda102py38hfdb21e3_200 +pytorch=1.12.1=cuda112py37hfcfbd4c_200 +pytorch=1.12.1=cuda102py37haad9b4f_200 +pytorch=1.12.1=cpu_py310h75c9ab6_0 +pytorch=1.12.1=cpu_py39h5d22d69_0 +pytorch=1.12.1=cpu_py38h39c826d_0 +pytorch=1.12.1=cpu_py37h14e09b7_0 +pytorch=1.12.0=cuda112py310h51fe464_202 +pytorch=1.12.0=cuda111py310h385535d_202 +pytorch=1.12.0=cuda110py310hfdf97d1_202 +pytorch=1.12.0=cuda112py39ha0cca9b_202 +pytorch=1.12.0=cuda111py39h9f128c5_202 +pytorch=1.12.0=cuda110py39h0a9da28_202 +pytorch=1.12.0=cuda111py38h2d04dd0_202 +pytorch=1.12.0=cuda110py38h386aa8f_202 +pytorch=1.12.0=cuda112py37hfcfbd4c_202 +pytorch=1.12.0=cuda111py37hdb2541a_202 +pytorch=1.12.0=cuda110py37h0def887_202 +pytorch=1.12.0=cuda102py310hdf4a2db_202 +pytorch=1.12.0=cuda102py39hbbcd3cb_202 +pytorch=1.12.0=cuda112py38habe9d5a_202 +pytorch=1.12.0=cuda102py38hfdb21e3_202 +pytorch=1.12.0=cuda102py37haad9b4f_202 +pytorch=1.12.0=cuda112py310h51fe464_200 +pytorch=1.12.0=cuda111py310h385535d_200 +pytorch=1.12.0=cuda110py310hfdf97d1_200 +pytorch=1.12.0=cuda112py39ha0cca9b_200 +pytorch=1.12.0=cuda111py39h9f128c5_200 +pytorch=1.12.0=cuda110py39h0a9da28_200 +pytorch=1.12.0=cuda111py38h2d04dd0_200 +pytorch=1.12.0=cuda110py38h386aa8f_200 +pytorch=1.12.0=cuda112py37hfcfbd4c_200 +pytorch=1.12.0=cuda111py37hdb2541a_200 +pytorch=1.12.0=cuda110py37h0def887_200 +pytorch=1.12.0=cuda102py310hdf4a2db_200 +pytorch=1.12.0=cuda102py39hbbcd3cb_200 +pytorch=1.12.0=cuda112py38habe9d5a_200 +pytorch=1.12.0=cuda102py38hfdb21e3_200 +pytorch=1.12.0=cuda102py37haad9b4f_200 +pytorch=1.12.0=cpu_py310h75c9ab6_2 +pytorch=1.12.0=cpu_py39h5d22d69_2 +pytorch=1.12.0=cpu_py38h39c826d_2 +pytorch=1.12.0=cpu_py37h14e09b7_2 +pytorch=1.12.0=cpu_py310h75c9ab6_1 +pytorch=1.12.0=cpu_py39h5d22d69_1 +pytorch=1.12.0=cpu_py38h39c826d_1 +pytorch=1.12.0=cpu_py37h14e09b7_1 +pytorch=1.12.0=cpu_py310h75c9ab6_0 +pytorch=1.12.0=cpu_py39h5d22d69_0 +pytorch=1.12.0=cpu_py38h39c826d_0 +pytorch=1.12.0=cpu_py37h14e09b7_0 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_lowest.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_lowest.snap new file mode 100644 index 000000000..b0e998e79 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_lowest.snap @@ -0,0 +1,68 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +pytorch=1.12.0=cuda112py310h51fe464_202 +pytorch=1.12.0=cuda111py310h385535d_202 +pytorch=1.12.0=cuda110py310hfdf97d1_202 +pytorch=1.12.0=cuda112py39ha0cca9b_202 +pytorch=1.12.0=cuda111py39h9f128c5_202 +pytorch=1.12.0=cuda110py39h0a9da28_202 +pytorch=1.12.0=cuda111py38h2d04dd0_202 +pytorch=1.12.0=cuda110py38h386aa8f_202 +pytorch=1.12.0=cuda112py37hfcfbd4c_202 +pytorch=1.12.0=cuda111py37hdb2541a_202 +pytorch=1.12.0=cuda110py37h0def887_202 +pytorch=1.12.0=cuda102py310hdf4a2db_202 +pytorch=1.12.0=cuda102py39hbbcd3cb_202 +pytorch=1.12.0=cuda112py38habe9d5a_202 +pytorch=1.12.0=cuda102py38hfdb21e3_202 +pytorch=1.12.0=cuda102py37haad9b4f_202 +pytorch=1.12.0=cuda112py310h51fe464_200 +pytorch=1.12.0=cuda111py310h385535d_200 +pytorch=1.12.0=cuda110py310hfdf97d1_200 +pytorch=1.12.0=cuda112py39ha0cca9b_200 +pytorch=1.12.0=cuda111py39h9f128c5_200 +pytorch=1.12.0=cuda110py39h0a9da28_200 +pytorch=1.12.0=cuda111py38h2d04dd0_200 +pytorch=1.12.0=cuda110py38h386aa8f_200 +pytorch=1.12.0=cuda112py37hfcfbd4c_200 +pytorch=1.12.0=cuda111py37hdb2541a_200 +pytorch=1.12.0=cuda110py37h0def887_200 +pytorch=1.12.0=cuda102py310hdf4a2db_200 +pytorch=1.12.0=cuda102py39hbbcd3cb_200 +pytorch=1.12.0=cuda112py38habe9d5a_200 +pytorch=1.12.0=cuda102py38hfdb21e3_200 +pytorch=1.12.0=cuda102py37haad9b4f_200 +pytorch=1.12.0=cpu_py310h75c9ab6_2 +pytorch=1.12.0=cpu_py39h5d22d69_2 +pytorch=1.12.0=cpu_py38h39c826d_2 +pytorch=1.12.0=cpu_py37h14e09b7_2 +pytorch=1.12.0=cpu_py310h75c9ab6_1 +pytorch=1.12.0=cpu_py39h5d22d69_1 +pytorch=1.12.0=cpu_py38h39c826d_1 +pytorch=1.12.0=cpu_py37h14e09b7_1 +pytorch=1.12.0=cpu_py310h75c9ab6_0 +pytorch=1.12.0=cpu_py39h5d22d69_0 +pytorch=1.12.0=cpu_py38h39c826d_0 +pytorch=1.12.0=cpu_py37h14e09b7_0 +pytorch=1.12.1=cuda112py310h51fe464_200 +pytorch=1.12.1=cuda111py310h385535d_200 +pytorch=1.12.1=cuda110py310hfdf97d1_200 +pytorch=1.12.1=cuda112py39ha0cca9b_200 +pytorch=1.12.1=cuda111py39h9f128c5_200 +pytorch=1.12.1=cuda110py39h0a9da28_200 +pytorch=1.12.1=cuda112py38habe9d5a_200 +pytorch=1.12.1=cuda111py38h2d04dd0_200 +pytorch=1.12.1=cuda110py38h386aa8f_200 +pytorch=1.12.1=cuda111py37hdb2541a_200 +pytorch=1.12.1=cuda110py37h0def887_200 +pytorch=1.12.1=cuda102py310hdf4a2db_200 +pytorch=1.12.1=cuda102py39hbbcd3cb_200 +pytorch=1.12.1=cuda102py38hfdb21e3_200 +pytorch=1.12.1=cuda112py37hfcfbd4c_200 +pytorch=1.12.1=cuda102py37haad9b4f_200 +pytorch=1.12.1=cpu_py310h75c9ab6_0 +pytorch=1.12.1=cpu_py39h5d22d69_0 +pytorch=1.12.1=cpu_py38h39c826d_0 +pytorch=1.12.1=cpu_py37h14e09b7_0 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_lowest_direct.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_lowest_direct.snap new file mode 100644 index 000000000..b0e998e79 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch_lowest_direct.snap @@ -0,0 +1,68 @@ +--- +source: crates/rattler_solve/tests/sorting.rs +expression: "create_sorting_snapshot(spec, solve_strategy)" +--- +pytorch=1.12.0=cuda112py310h51fe464_202 +pytorch=1.12.0=cuda111py310h385535d_202 +pytorch=1.12.0=cuda110py310hfdf97d1_202 +pytorch=1.12.0=cuda112py39ha0cca9b_202 +pytorch=1.12.0=cuda111py39h9f128c5_202 +pytorch=1.12.0=cuda110py39h0a9da28_202 +pytorch=1.12.0=cuda111py38h2d04dd0_202 +pytorch=1.12.0=cuda110py38h386aa8f_202 +pytorch=1.12.0=cuda112py37hfcfbd4c_202 +pytorch=1.12.0=cuda111py37hdb2541a_202 +pytorch=1.12.0=cuda110py37h0def887_202 +pytorch=1.12.0=cuda102py310hdf4a2db_202 +pytorch=1.12.0=cuda102py39hbbcd3cb_202 +pytorch=1.12.0=cuda112py38habe9d5a_202 +pytorch=1.12.0=cuda102py38hfdb21e3_202 +pytorch=1.12.0=cuda102py37haad9b4f_202 +pytorch=1.12.0=cuda112py310h51fe464_200 +pytorch=1.12.0=cuda111py310h385535d_200 +pytorch=1.12.0=cuda110py310hfdf97d1_200 +pytorch=1.12.0=cuda112py39ha0cca9b_200 +pytorch=1.12.0=cuda111py39h9f128c5_200 +pytorch=1.12.0=cuda110py39h0a9da28_200 +pytorch=1.12.0=cuda111py38h2d04dd0_200 +pytorch=1.12.0=cuda110py38h386aa8f_200 +pytorch=1.12.0=cuda112py37hfcfbd4c_200 +pytorch=1.12.0=cuda111py37hdb2541a_200 +pytorch=1.12.0=cuda110py37h0def887_200 +pytorch=1.12.0=cuda102py310hdf4a2db_200 +pytorch=1.12.0=cuda102py39hbbcd3cb_200 +pytorch=1.12.0=cuda112py38habe9d5a_200 +pytorch=1.12.0=cuda102py38hfdb21e3_200 +pytorch=1.12.0=cuda102py37haad9b4f_200 +pytorch=1.12.0=cpu_py310h75c9ab6_2 +pytorch=1.12.0=cpu_py39h5d22d69_2 +pytorch=1.12.0=cpu_py38h39c826d_2 +pytorch=1.12.0=cpu_py37h14e09b7_2 +pytorch=1.12.0=cpu_py310h75c9ab6_1 +pytorch=1.12.0=cpu_py39h5d22d69_1 +pytorch=1.12.0=cpu_py38h39c826d_1 +pytorch=1.12.0=cpu_py37h14e09b7_1 +pytorch=1.12.0=cpu_py310h75c9ab6_0 +pytorch=1.12.0=cpu_py39h5d22d69_0 +pytorch=1.12.0=cpu_py38h39c826d_0 +pytorch=1.12.0=cpu_py37h14e09b7_0 +pytorch=1.12.1=cuda112py310h51fe464_200 +pytorch=1.12.1=cuda111py310h385535d_200 +pytorch=1.12.1=cuda110py310hfdf97d1_200 +pytorch=1.12.1=cuda112py39ha0cca9b_200 +pytorch=1.12.1=cuda111py39h9f128c5_200 +pytorch=1.12.1=cuda110py39h0a9da28_200 +pytorch=1.12.1=cuda112py38habe9d5a_200 +pytorch=1.12.1=cuda111py38h2d04dd0_200 +pytorch=1.12.1=cuda110py38h386aa8f_200 +pytorch=1.12.1=cuda111py37hdb2541a_200 +pytorch=1.12.1=cuda110py37h0def887_200 +pytorch=1.12.1=cuda102py310hdf4a2db_200 +pytorch=1.12.1=cuda102py39hbbcd3cb_200 +pytorch=1.12.1=cuda102py38hfdb21e3_200 +pytorch=1.12.1=cuda112py37hfcfbd4c_200 +pytorch=1.12.1=cuda102py37haad9b4f_200 +pytorch=1.12.1=cpu_py310h75c9ab6_0 +pytorch=1.12.1=cpu_py39h5d22d69_0 +pytorch=1.12.1=cpu_py38h39c826d_0 +pytorch=1.12.1=cpu_py37h14e09b7_0 diff --git a/crates/rattler_solve/tests/sorting.rs b/crates/rattler_solve/tests/sorting.rs index 842f33d72..da903472a 100644 --- a/crates/rattler_solve/tests/sorting.rs +++ b/crates/rattler_solve/tests/sorting.rs @@ -28,7 +28,7 @@ fn load_repodata(package_name: &PackageName) -> Vec> { .expect("failed to load records") } -fn create_sorting_snapshot(package_name: &str) -> String { +fn create_sorting_snapshot(package_name: &str, strategy: SolveStrategy) -> String { let match_spec = MatchSpec::from_str(package_name, Lenient).unwrap(); let package_name = match_spec.name.clone().unwrap(); @@ -41,11 +41,11 @@ fn create_sorting_snapshot(package_name: &str) -> String { &[], &[], &[], - &[], + &[match_spec.clone()], None, ChannelPriority::default(), None, - SolveStrategy::default(), + strategy, ) .expect("failed to create dependency provider"); @@ -74,17 +74,25 @@ fn create_sorting_snapshot(package_name: &str) -> String { } #[rstest] -#[case::pytorch("pytorch >=1.12.0")] -#[case::python("python ~=3.10.*")] -#[case::libuuid("libuuid")] -#[case::abess("abess")] -// #[case::certifi("certifi >=2016.9.26")] -fn test_ordering(#[case] spec: &str) { +#[case::pytorch("pytorch >=1.12.0", SolveStrategy::Highest)] +#[case::pytorch("pytorch >=1.12.0", SolveStrategy::LowestVersion)] +#[case::pytorch("pytorch >=1.12.0", SolveStrategy::LowestVersionDirect)] +#[case::python("python ~=3.10.*", SolveStrategy::Highest)] +#[case::libuuid("libuuid", SolveStrategy::Highest)] +#[case::abess("abess", SolveStrategy::Highest)] +#[case::libgcc("libgcc-ng", SolveStrategy::Highest)] +#[case::certifi("certifi >=2016.9.26", SolveStrategy::Highest)] +fn test_ordering(#[case] spec: &str, #[case] solve_strategy: SolveStrategy) { insta::assert_snapshot!( format!( - "test_ordering_{}", - spec.split_whitespace().next().unwrap_or(spec) + "test_ordering_{}_{}", + spec.split_whitespace().next().unwrap_or(spec), + match solve_strategy { + SolveStrategy::Highest => "highest", + SolveStrategy::LowestVersion => "lowest", + SolveStrategy::LowestVersionDirect => "lowest_direct", + } ), - create_sorting_snapshot(spec) + create_sorting_snapshot(spec, solve_strategy) ); }