diff --git a/.github/workflows/torch-tests.yml b/.github/workflows/torch-tests.yml index e362acb83..79ec93e2d 100644 --- a/.github/workflows/torch-tests.yml +++ b/.github/workflows/torch-tests.yml @@ -23,18 +23,18 @@ jobs: cargo-test-flags: --release - os: ubuntu-20.04 - torch-version: 2.0.* + torch-version: 2.1.* python-version: "3.11" cargo-test-flags: --release do-valgrind: true - os: macos-11 - torch-version: 2.0.* + torch-version: 2.1.* python-version: "3.11" cargo-test-flags: --release - os: windows-2019 - torch-version: 2.0.* + torch-version: 2.1.* python-version: "3.11" cargo-test-flags: --release diff --git a/docs/requirements.txt b/docs/requirements.txt index 6047c6435..7d63ac552 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -10,7 +10,7 @@ myst-parser # markdown => rst translation, used in extensions/rascaline_json # dependencies for the tutorials --extra-index-url https://download.pytorch.org/whl/cpu -metatensor[torch] @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip +metatensor[torch] @ git+https://github.com/lab-cosmo/metatensor@ae10944 torch chemfiles matplotlib diff --git a/pyproject.toml b/pyproject.toml index f436d2495..e088915fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] dependencies = [ - "metatensor-core @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip#subdirectory=python/metatensor-core", + "metatensor-core @ git+https://github.com/lab-cosmo/metatensor@ae10944#subdirectory=python/metatensor-core", ] [project.urls] diff --git a/python/rascaline-torch/pyproject.toml b/python/rascaline-torch/pyproject.toml index 2769faa93..5545f32bd 100644 --- a/python/rascaline-torch/pyproject.toml +++ b/python/rascaline-torch/pyproject.toml @@ -38,7 +38,7 @@ requires = [ "wheel >=0.38", "cmake", "torch >= 1.11", - "metatensor-torch @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip#subdirectory=python/metatensor-torch", + "metatensor-torch @git+https://github.com/lab-cosmo/metatensor@ae10944#subdirectory=python/metatensor-torch", ] # use a custom build backend to add a dependency on the right version of rascaline diff --git a/rascaline-c-api/CMakeLists.txt b/rascaline-c-api/CMakeLists.txt index e4e340076..b7073c400 100644 --- a/rascaline-c-api/CMakeLists.txt +++ b/rascaline-c-api/CMakeLists.txt @@ -217,7 +217,7 @@ endif() # ============================================================================ # # Setup metatensor -set(METATENSOR_GIT_VERSION "2248a3c") +set(METATENSOR_GIT_VERSION "ae10944") set(METATENSOR_REQUIRED_VERSION "0.1") if (RASCALINE_FETCH_METATENSOR) message(STATUS "Fetching metatensor @ ${METATENSOR_GIT_VERSION} from github") @@ -226,7 +226,7 @@ if (RASCALINE_FETCH_METATENSOR) FetchContent_Declare( metatensor URL https://github.com/lab-cosmo/metatensor/archive/${METATENSOR_GIT_VERSION}.zip - URL_HASH MD5=50e70a2e74246a985e1520260a74205c + URL_HASH MD5=1de1208bd96fa9acda0b835d1c9e2c5d SOURCE_SUBDIR metatensor-core VERBOSE ) diff --git a/rascaline-c-api/Cargo.toml b/rascaline-c-api/Cargo.toml index 0521fec19..e82a58bac 100644 --- a/rascaline-c-api/Cargo.toml +++ b/rascaline-c-api/Cargo.toml @@ -18,7 +18,7 @@ chemfiles = ["rascaline/chemfiles"] [dependencies] rascaline = {path = "../rascaline", version = "0.1.0", default-features = false} -metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "2248a3c"} +metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "ae10944"} ndarray = "0.15" log = { version = "0.4", features = ["std"] } @@ -29,7 +29,7 @@ libc = "0.2" [build-dependencies] cbindgen = { version = "0.24", default-features = false } fs_extra = "1" -metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "2248a3c"} +metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "ae10944"} [dev-dependencies] which = "4" diff --git a/rascaline-c-api/src/calculator.rs b/rascaline-c-api/src/calculator.rs index 8a512f05a..234a2aba0 100644 --- a/rascaline-c-api/src/calculator.rs +++ b/rascaline-c-api/src/calculator.rs @@ -54,14 +54,13 @@ pub unsafe extern fn rascal_calculator(name: *const c_char, parameters: *const c let mut raw = std::ptr::null_mut(); let unwind_wrapper = std::panic::AssertUnwindSafe(&mut raw); let status = catch_unwind(move || { - let unwind_wrapper = unwind_wrapper; - check_pointers!(name, parameters); let name = CStr::from_ptr(name).to_str()?; let parameters = CStr::from_ptr(parameters).to_str()?; let calculator = Calculator::new(name, parameters.to_owned())?; let boxed = Box::new(rascal_calculator_t(calculator)); + let _ = &unwind_wrapper; *unwind_wrapper.0 = Box::into_raw(boxed); Ok(()) }); diff --git a/rascaline-c-api/src/status.rs b/rascaline-c-api/src/status.rs index a861323bc..2dd255a67 100644 --- a/rascaline-c-api/src/status.rs +++ b/rascaline-c-api/src/status.rs @@ -84,7 +84,7 @@ impl From for rascal_status_t { /// the error into `rascal_status_t`. pub fn catch_unwind(function: F) -> rascal_status_t where F: FnOnce() -> Result<(), Error> + UnwindSafe { match std::panic::catch_unwind(function) { - Ok(Ok(_)) => rascal_status_t(RASCAL_SUCCESS), + Ok(Ok(())) => rascal_status_t(RASCAL_SUCCESS), Ok(Err(error)) => error.into(), Err(error) => Error::from(error).into() } diff --git a/rascaline-c-api/tests/catch/CMakeLists.txt b/rascaline-c-api/tests/catch/CMakeLists.txt index 4c6184820..c783b584e 100644 --- a/rascaline-c-api/tests/catch/CMakeLists.txt +++ b/rascaline-c-api/tests/catch/CMakeLists.txt @@ -1,3 +1,3 @@ add_library(catch STATIC catch.cpp) target_include_directories(catch PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_features(catch PUBLIC cxx_std_11) +target_compile_features(catch PUBLIC cxx_std_17) diff --git a/rascaline-torch/CMakeLists.txt b/rascaline-torch/CMakeLists.txt index b14fb7210..f1f343809 100644 --- a/rascaline-torch/CMakeLists.txt +++ b/rascaline-torch/CMakeLists.txt @@ -58,7 +58,7 @@ find_package(Torch 1.11 REQUIRED) # ============================================================================ # # Setup metatensor_torch -set(METATENSOR_GIT_VERSION "2248a3c") +set(METATENSOR_GIT_VERSION "ae10944") set(REQUIRED_METATENSOR_TORCH_VERSION "0.1") if (RASCALINE_TORCH_FETCH_METATENSOR_TORCH) message(STATUS "Fetching metatensor_torch @ ${METATENSOR_GIT_VERSION} from github") @@ -67,7 +67,7 @@ if (RASCALINE_TORCH_FETCH_METATENSOR_TORCH) FetchContent_Declare( metatensor_torch URL https://github.com/lab-cosmo/metatensor/archive/${METATENSOR_GIT_VERSION}.zip - URL_HASH MD5=50e70a2e74246a985e1520260a74205c + URL_HASH MD5=1de1208bd96fa9acda0b835d1c9e2c5d SOURCE_SUBDIR metatensor-torch VERBOSE ) @@ -106,7 +106,7 @@ add_library(rascaline_torch SHARED ) target_link_libraries(rascaline_torch PUBLIC torch metatensor_torch rascaline) -target_compile_features(rascaline_torch PUBLIC cxx_std_14) +target_compile_features(rascaline_torch PUBLIC cxx_std_17) target_include_directories(rascaline_torch PUBLIC $ $ diff --git a/rascaline-torch/tests/utils/mod.rs b/rascaline-torch/tests/utils/mod.rs index fb2213c34..008e06b72 100644 --- a/rascaline-torch/tests/utils/mod.rs +++ b/rascaline-torch/tests/utils/mod.rs @@ -84,7 +84,7 @@ pub fn setup_pytorch(build_dir: PathBuf) -> PathBuf { .expect("failed to run python"); assert!(status.success(), "failed to run `python -m pip install --upgrade pip`"); - let torch_version = std::env::var("RASCALINE_TORCH_TEST_VERSION").unwrap_or("2.0.*".into()); + let torch_version = std::env::var("RASCALINE_TORCH_TEST_VERSION").unwrap_or("2.1.*".into()); let status = Command::new(&python) .arg("-m") .arg("pip") diff --git a/rascaline/Cargo.toml b/rascaline/Cargo.toml index 885007351..26b975bf6 100644 --- a/rascaline/Cargo.toml +++ b/rascaline/Cargo.toml @@ -36,7 +36,7 @@ name = "soap-power-spectrum" harness = false [dependencies] -metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "2248a3c", features = ["rayon"]} +metatensor = {git = "https://github.com/lab-cosmo/metatensor", rev = "ae10944", features = ["rayon"]} ndarray = {version = "0.15", features = ["approx-0_5", "rayon", "serde"]} num-traits = "0.2" diff --git a/rascaline/src/calculators/neighbor_list.rs b/rascaline/src/calculators/neighbor_list.rs index c092b4753..fc19c22cb 100644 --- a/rascaline/src/calculators/neighbor_list.rs +++ b/rascaline/src/calculators/neighbor_list.rs @@ -500,7 +500,7 @@ impl FullNeighborList { system.compute_neighbors(self.cutoff)?; let species = system.species()?; - for pair in system.pairs()?.iter() { + for pair in system.pairs()? { let first_block_i = descriptor.keys().position(&[ species[pair.first].into(), species[pair.second].into() ]); diff --git a/rascaline/src/calculators/soap/spherical_expansion.rs b/rascaline/src/calculators/soap/spherical_expansion.rs index 1601e2f35..b62cfa37d 100644 --- a/rascaline/src/calculators/soap/spherical_expansion.rs +++ b/rascaline/src/calculators/soap/spherical_expansion.rs @@ -189,7 +189,7 @@ impl SphericalExpansion { let neighbor_i = pair.second; result.pair_to_pair_ids.entry((pair.first, pair.second)) - .or_insert_with(Vec::new) + .or_default() .push(pair_id); let species_neighbor_i = result.species_mapping[&species[neighbor_i]]; @@ -253,7 +253,7 @@ impl SphericalExpansion { let neighbor_i = pair.first; result.pair_to_pair_ids.entry((pair.second, pair.first)) - .or_insert_with(Vec::new) + .or_default() .push(pair_id); diff --git a/tox.ini b/tox.ini index 9331a771e..351f8da60 100644 --- a/tox.ini +++ b/tox.ini @@ -19,10 +19,10 @@ lint-folders = "{toxinidir}/python" "{toxinidir}/setup.py" # we need to manually install dependencies for rascaline, since tox will install # the fresh wheel with `--no-deps` after building it. metatensor-core-requirement = - metatensor-core @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip\#subdirectory=python/metatensor-core + metatensor-core @ git+https://github.com/lab-cosmo/metatensor@ae10944\#subdirectory=python/metatensor-core metatensor-torch-requirement = - metatensor-torch @ https://github.com/lab-cosmo/metatensor/archive/2248a3c.zip\#subdirectory=python/metatensor-torch + metatensor-torch @ git+https://github.com/lab-cosmo/metatensor@ae10944\#subdirectory=python/metatensor-torch build-single-wheel = --no-deps --no-build-isolation --check-build-dependencies