Skip to content

Commit

Permalink
Require rustc v1.74 to build the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Luthaf committed Sep 25, 2024
1 parent 83f4ae3 commit 75eeea3
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

# check the build on a stock Ubuntu 20.04, including cmake 3.16
- os: ubuntu-22.04
rust-version: "1.65"
rust-version: "1.74"
container: ubuntu:20.04
rust-target: x86_64-unknown-linux-gnu
build-type: debug
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ on rascaline:
- **the rust compiler**: you will need both ``rustc`` (the compiler) and
``cargo`` (associated build tool). You can install both using `rustup`_, or
use a version provided by your operating system. We need at least Rust version
1.65 to build rascaline.
1.74 to build rascaline.
- **Python**: you can install ``Python`` and ``pip`` from your operating system.
We require a Python version of at least 3.6.
- **tox**: a Python test runner, cf https://tox.readthedocs.io/en/latest/. You
Expand Down
2 changes: 1 addition & 1 deletion docs/rascaline-json-schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Luthaf <[email protected]>"]
edition = "2021"
publish = false
rust-version = "1.65"
rust-version = "1.74"

[[bin]]
name = "rascaline-json-schema"
Expand Down
4 changes: 0 additions & 4 deletions python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,5 @@ doctest = false
[dev-dependencies]
which = "5"

# This is the last version supporting rustc 1.65
home = "=0.5.5"


[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] }
14 changes: 5 additions & 9 deletions rascaline-c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "rascaline-c-api"
version = "0.1.0"
authors = ["Luthaf <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.74"

[lib]
# when https://github.com/rust-lang/cargo/pull/8789 lands, use it here!
Expand All @@ -18,25 +18,21 @@ chemfiles = ["rascaline/chemfiles"]

[dependencies]
rascaline = {path = "../rascaline", version = "0.1.0", default-features = false}
metatensor = "0.1"
metatensor = "0.2"

ndarray = "0.15"
ndarray = "0.16"
log = { version = "0.4", features = ["std"] }
once_cell = "1"
time-graph = {version = "0.3.0", features = ["table", "json"]}
libc = "0.2"

[build-dependencies]
cbindgen = { version = "0.26", default-features = false }
cbindgen = { version = "0.27", default-features = false }
fs_extra = "1"
metatensor = "0.1"
metatensor = "0.2"

[dev-dependencies]
which = "5"

# This is the last version supporting rustc 1.65
home = "=0.5.5"


[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] }
2 changes: 2 additions & 0 deletions rascaline-c-api/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::field_reassign_with_default)]

use std::path::PathBuf;

fn main() {
Expand Down
6 changes: 3 additions & 3 deletions rascaline-c-api/include/rascaline.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ rascal_status_t rascal_profiling_enable(bool enabled);
rascal_status_t rascal_profiling_get(const char *format, char *buffer, uintptr_t bufflen);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
} // extern "C"
#endif // __cplusplus

#endif /* RASCALINE_H */
#endif /* RASCALINE_H */
4 changes: 0 additions & 4 deletions rascaline-torch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,5 @@ doctest = false
[dev-dependencies]
which = "5"

# This is the last version supporting rustc 1.65
home = "=0.5.5"


[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)'] }
12 changes: 4 additions & 8 deletions rascaline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "rascaline"
version = "0.1.0"
authors = ["Luthaf <[email protected]>"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.74"

[lib]
bench = false
Expand Down Expand Up @@ -36,9 +36,9 @@ name = "soap-power-spectrum"
harness = false

[dependencies]
metatensor = {version = "0.1.6", features = ["rayon"]}
metatensor = {version = "0.2", features = ["rayon"]}

ndarray = {version = "0.15", features = ["approx-0_5", "rayon", "serde"]}
ndarray = {version = "0.16", features = ["rayon", "serde", "approx"]}
num-traits = "0.2"
rayon = "1.5"

Expand All @@ -59,11 +59,7 @@ approx = "0.5"
[dev-dependencies]
criterion = "0.5"

# These are the last versions supporting rustc 1.65
clap = "=4.2.1"
half = "=2.2.1"

glob = "0.3"
ndarray-npy = "0.8"
ndarray-npy = "0.9"
flate2 = "1.0.20"
time-graph = {version = "0.3.0", features = ["table", "json"]}
2 changes: 1 addition & 1 deletion rascaline/benches/lode-spherical-expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn run_spherical_expansion(mut group: BenchmarkGroup<WallTime>,
}}"#);
let mut calculator = Calculator::new("lode_spherical_expansion", parameters).unwrap();

group.bench_function(&format!("gaussian_width = {}", atomic_gaussian_width), |b| b.iter_custom(|repeat| {
group.bench_function(format!("gaussian_width = {}", atomic_gaussian_width), |b| b.iter_custom(|repeat| {
let start = std::time::Instant::now();

let options = CalculationOptions {
Expand Down
2 changes: 1 addition & 1 deletion rascaline/benches/soap-power-spectrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn run_soap_power_spectrum(
}}"#);
let mut calculator = Calculator::new("soap_power_spectrum", parameters).unwrap();

group.bench_function(&format!("n_max = {}, l_max = {}", max_radial, max_angular), |b| b.iter_custom(|repeat| {
group.bench_function(format!("n_max = {}, l_max = {}", max_radial, max_angular), |b| b.iter_custom(|repeat| {
let start = std::time::Instant::now();

let options = CalculationOptions {
Expand Down
2 changes: 1 addition & 1 deletion rascaline/benches/soap-radial-integral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn benchmark_radial_integral(
2.109, 2.266, 2.852, 2.942, 3.021, 3.247, 3.859, 4.462,
];

group.bench_function(&format!("n_max = {}, l_max = {}", max_radial, max_angular), |b| b.iter_custom(|repeat| {
group.bench_function(format!("n_max = {}, l_max = {}", max_radial, max_angular), |b| b.iter_custom(|repeat| {
let start = std::time::Instant::now();
for _ in 0..repeat {
for &distance in &distances {
Expand Down
2 changes: 1 addition & 1 deletion rascaline/benches/soap-spherical-expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn run_spherical_expansion(mut group: BenchmarkGroup<WallTime>,
}}"#);
let mut calculator = Calculator::new("spherical_expansion", parameters).unwrap();

group.bench_function(&format!("n_max = {}, l_max = {}", max_radial, max_angular), |b| b.iter_custom(|repeat| {
group.bench_function(format!("n_max = {}, l_max = {}", max_radial, max_angular), |b| b.iter_custom(|repeat| {
let start = std::time::Instant::now();

let options = CalculationOptions {
Expand Down
4 changes: 2 additions & 2 deletions rascaline/benches/spherical-harmonics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn spherical_harmonics(c: &mut Criterion) {
*d /= d.norm();
}

group.bench_function(&format!("l_max = {}", max_angular), |b| b.iter_custom(|repeat| {
group.bench_function(format!("l_max = {}", max_angular), |b| b.iter_custom(|repeat| {
let start = std::time::Instant::now();
for _ in 0..repeat {
for &direction in &directions {
Expand Down Expand Up @@ -78,7 +78,7 @@ fn spherical_harmonics_with_gradients(c: &mut Criterion) {
*d /= d.norm();
}

group.bench_function(&format!("l_max = {}", max_angular), |b| b.iter_custom(|repeat| {
group.bench_function(format!("l_max = {}", max_angular), |b| b.iter_custom(|repeat| {
let start = std::time::Instant::now();
for _ in 0..repeat {
for &direction in &directions {
Expand Down
8 changes: 6 additions & 2 deletions rascaline/src/calculators/lode/spherical_expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ impl std::fmt::Debug for LodeSphericalExpansion {
fn resize_array3(array: &mut ndarray::Array3<f64>, shape: (usize, usize, usize)) {
let tmp_array = std::mem::take(array);

let mut data = tmp_array.into_raw_vec();
let (mut data, offset) = tmp_array.into_raw_vec_and_offset();
debug_assert!(matches!(offset, Some(0) | None));

data.resize(shape.0 * shape.1 * shape.2, 0.0);
*array = Array3::from_shape_vec(shape, data).expect("wrong shape");
}
Expand All @@ -187,7 +189,9 @@ fn resize_array3(array: &mut ndarray::Array3<f64>, shape: (usize, usize, usize))
fn resize_array1(array: &mut ndarray::Array1<f64>, shape: usize) {
let tmp_array = std::mem::take(array);

let mut data = tmp_array.into_raw_vec();
let (mut data, offset) = tmp_array.into_raw_vec_and_offset();
debug_assert!(matches!(offset, Some(0) | None));

data.resize(shape, 0.0);
*array = Array1::from_shape_vec(shape, data).expect("wrong shape");
}
Expand Down
8 changes: 4 additions & 4 deletions rascaline/src/calculators/soap/radial_spectrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl CalculatorBase for SoapRadialSpectrum {
let shape = array_spx.shape();
// shape[1] is the m component
debug_assert_eq!(shape[1], 1);
let array_spx_reshaped = array_spx.view().into_shape(
let array_spx_reshaped = array_spx.view().into_shape_with_order(
(shape[0], shape[2])
).expect("wrong shape");
array.assign(&array_spx_reshaped);
Expand All @@ -258,7 +258,7 @@ impl CalculatorBase for SoapRadialSpectrum {
// shape[2] is the m component
debug_assert_eq!(shape[2], 1);

let array_spx_reshaped = array_spx.view().into_shape(
let array_spx_reshaped = array_spx.view().into_shape_with_order(
(shape[0], shape[1], shape[3])
).expect("wrong shape");
array.assign(&array_spx_reshaped);
Expand All @@ -274,7 +274,7 @@ impl CalculatorBase for SoapRadialSpectrum {
// shape[2] is the m component
debug_assert_eq!(shape[3], 1);

let array_spx_reshaped = array_spx.view().into_shape(
let array_spx_reshaped = array_spx.view().into_shape_with_order(
(shape[0], shape[1], shape[2], shape[4])
).expect("wrong shape");
array.assign(&array_spx_reshaped);
Expand All @@ -290,7 +290,7 @@ impl CalculatorBase for SoapRadialSpectrum {
// shape[2] is the m component
debug_assert_eq!(shape[3], 1);

let array_spx_reshaped = array_spx.view().into_shape(
let array_spx_reshaped = array_spx.view().into_shape_with_order(
(shape[0], shape[1], shape[2], shape[4])
).expect("wrong shape");
array.assign(&array_spx_reshaped);
Expand Down

0 comments on commit 75eeea3

Please sign in to comment.