Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ jobs:
cc: clang
cmake-generator: Unix Makefiles

# - os: windows-2022
# rust-version: stable
# rust-target: x86_64-pc-windows-msvc
# extra-name: " / MSVC"
# cxx: cl.exe
# cc: cl.exe
# cmake-generator: Visual Studio 17 2022

# - os: windows-2022
# rust-version: stable
# rust-target: x86_64-pc-windows-gnu
# extra-name: " / MinGW"
# cxx: g++.exe
# cc: gcc.exe
# cmake-generator: MinGW Makefiles
- os: windows-2022
rust-version: stable
rust-target: x86_64-pc-windows-msvc
extra-name: " / MSVC"
cxx: cl.exe
cc: cl.exe
cmake-generator: Visual Studio 17 2022

- os: windows-2022
rust-version: stable
rust-target: x86_64-pc-windows-gnu
extra-name: " / MinGW"
cxx: g++.exe
cc: gcc.exe
cmake-generator: MinGW Makefiles
steps:
- name: install dependencies in container
if: matrix.container == 'ubuntu:22.04'
Expand Down
2 changes: 1 addition & 1 deletion metatomic-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name = "metatomic"
bench = false

[dependencies]
metatensor = { version = "0.3.0" }
metatensor = { version = "0.4.1" }
once_cell = "1"
dlpk = { version = "0.3", features = ["ndarray"]}
json = "0.12"
Expand Down
12 changes: 6 additions & 6 deletions metatomic-core/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,10 @@ use ndarray::{Array1, Array2};
fn valid_pair_block(dtype: &str) -> TensorBlock {
let samples = Labels::new(
["first_atom", "second_atom", "cell_shift_a", "cell_shift_b", "cell_shift_c"],
&[[0i32, 1, 0, 0, 0]],
[[0i32, 1, 0, 0, 0]],
);
let components = vec![Labels::new(["xyz"], &[[0i32], [1], [2]])];
let properties = Labels::new(["distance"], &[[0i32]]);
let components = vec![Labels::new(["xyz"], [[0i32], [1], [2]])];
let properties = Labels::new(["distance"], [[0i32]]);

match dtype {
"f32" => {
Expand All @@ -459,9 +459,9 @@ use ndarray::{Array1, Array2};
}

fn valid_custom_data(dtype: &str) -> TensorMap {
let keys = Labels::new(["key"], &[[0i32]]);
let samples = Labels::new(["sample"], &[[0i32]]);
let properties = Labels::new(["property"], &[[0i32]]);
let keys = Labels::new(["key"], [[0i32]]);
let samples = Labels::new(["sample"], [[0i32]]);
let properties = Labels::new(["property"], [[0i32]]);

let block = match dtype {
"f32" => {
Expand Down
18 changes: 14 additions & 4 deletions metatomic-core/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ endif()
enable_testing()
add_subdirectory(test-plugins)

if (TARGET metatensor::shared)
get_target_property(METATENSOR_LOCATION metatensor::shared IMPORTED_LOCATION)
get_filename_component(METATENSOR_DIR ${METATENSOR_LOCATION} DIRECTORY)
elseif (TARGET metatensor)
get_target_property(METATENSOR_LOCATION metatensor LOCATION)
get_filename_component(METATENSOR_DIR ${METATENSOR_LOCATION} DIRECTORY)
else()
set(METATENSOR_DIR "")
endif()

file(GLOB ALL_TESTS *.cpp)
foreach(_file_ ${ALL_TESTS})
get_filename_component(_name_ ${_file_} NAME_WE)
Expand All @@ -71,19 +81,19 @@ foreach(_file_ ${ALL_TESTS})
NO_SYSTEM_FROM_IMPORTED ON
)

target_compile_definitions(${_name_} PRIVATE PLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/test-plugins")
target_compile_definitions(${_name_} PRIVATE PLUGIN_DIR="$<TARGET_FILE_DIR:test-c-plugin>")

add_test(
NAME ${_name_}
COMMAND ${TEST_COMMAND} $<TARGET_FILE:${_name_}>
)

if(WIN32)
# We need to set the path to allow access to metatomic.dll
# this does a similar job to the BUILD_RPATH above
# We need to set the path to allow access to metatomic.dll and
# metatensor.dll. This does a similar job to the BUILD_RPATH above.
STRING(REPLACE ";" "\\;" PATH_STRING "$ENV{PATH}")
set_tests_properties(${_name_} PROPERTIES
ENVIRONMENT "PATH=${PATH_STRING}\;$<TARGET_FILE_DIR:metatomic>"
ENVIRONMENT "PATH=${PATH_STRING}\;$<TARGET_FILE_DIR:metatomic>\;${METATENSOR_DIR}"
)
endif()
endforeach()
4 changes: 2 additions & 2 deletions metatomic-core/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ pub fn setup_torch_pip(python: &Path) -> PathBuf {
/// Install metatensor in a Python virtualenv with pip, and return the
/// CMAKE_PREFIX_PATH for the installed libmetatensor.
pub fn setup_metatensor_pip(python: &Path) -> PathBuf {
pip_install(python, &["metatensor-core >=0.2.0,<0.3"], PipInstallOptions::default());
pip_install(python, &["metatensor-core >=0.2.2,<0.3"], PipInstallOptions::default());

let mut cmd = Command::new(python);
cmd.arg("-c");
Expand All @@ -275,7 +275,7 @@ pub fn setup_metatensor_pip(python: &Path) -> PathBuf {
/// Install metatensor-torch in a Python virtualenv with pip, and return the
/// CMAKE_PREFIX_PATH for the installed libmetatensor_torch.
pub fn setup_metatensor_torch_pip(python: &Path) -> PathBuf {
pip_install(python, &["metatensor-torch >=0.9.0,<0.10"], PipInstallOptions::default());
pip_install(python, &["metatensor-torch >=0.10.0,<0.11"], PipInstallOptions::default());

let mut cmd = Command::new(python);
cmd.arg("-c");
Expand Down
2 changes: 1 addition & 1 deletion python/metatomic_core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requires = [
"setuptools >=77",
"packaging >=26",
"cmake",
"metatensor-core >=0.2.0,<0.3",
"metatensor-core >=0.2.2,<0.3",
]

build-backend = "setuptools.build_meta"
Expand Down
2 changes: 1 addition & 1 deletion python/metatomic_core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def create_version_number(version):
authors = fd.read().splitlines()

install_requires = [
"metatensor-core >=0.2.0,<0.3",
"metatensor-core >=0.2.2,<0.3",
]

setup(
Expand Down
Loading