Skip to content

Commit

Permalink
Updates for rsmpi 0.7.0 (#50)
Browse files Browse the repository at this point in the history
* Rename UserCommunicator -> SimpleCommunicator

* use rsmpi version (#23)

* Revert "use rsmpi version (#23)"

This reverts commit cc5e19d.

* try_

* FromRaw trait

* remove unwrap()

* add version consistency test

* ignore pyc

* fix doc build
  • Loading branch information
mscroggs authored Oct 24, 2023
1 parent c56bdf7 commit fce30b2
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
cargo clippy -- -D warnings
cargo clippy --tests -- -D warnings
cargo clippy --examples -- -D warnings
- name: Check dependency versions
run: |
python3 -m pip install pytest
python3 -m pytest _test
- name: Run unit tests (debug)
run: cargo test --lib --features "mpi,strict"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ examples.sh

.vscode
.*.swp

*.pyc
46 changes: 46 additions & 0 deletions _test/test_dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
try:
import tomllib
except ImportError:
import tomli as tomllib
import os
import pytest


def walk_dirs(dir, file):
out = []
if os.path.isfile(os.path.join(dir, file)):
out.append(os.path.join(dir, file))
for f in os.listdir(dir):
if not f.startswith(".") and os.path.isdir(os.path.join(dir, f)):
out += walk_dirs(os.path.join(dir, f), file)
return out


def test_dependencies():
root_dir = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "..")
if not os.path.isfile(os.path.join(root_dir, "Cargo.toml")):
pytest.skip("Test must be run from source folder")

cargos = walk_dirs(root_dir, "Cargo.toml")

deps = {}
errors = []
for c in cargos:
with open(c, "rb") as f:
data = tomllib.load(f)
if "dependencies" in data:
for d, info in data["dependencies"].items():
if isinstance(info, dict):
if "version" not in info:
info = None
else:
info = info["version"]
if d not in deps:
deps[d] = (info, c)
elif deps[d][0] != info:
errors.append(
f"Version of {d} in {c} ({info}) does not agree "
f"with version in {deps[d][1]} ({deps[d][0]})")
if len(errors) > 0:
raise ValueError("\n".join(errors))
2 changes: 1 addition & 1 deletion dense/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name = "rlst_dense"
num = "0.4"
cauchy = "0.4"
rand = "0.8"
itertools = "0.10"
itertools = "0.11"
rand_distr = "0.4"
rlst-blis = { path = "../blis"}
approx = { version = "0.5", features=["num-complex"] }
Expand Down
2 changes: 1 addition & 1 deletion dense/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! The library is early stage. The core data structures are implemented
//! and functionality is continuously being added.
//!
//! The core of `householder` is the [Matrix](crate::matrix::Matrix) type,
//! The core of `householder` is the [Matrix] type,
//! which supports fixed size implementations, dynamic size implementations,
//! and specialises also to vectors. It is agnostic to underlying storage
//! layouts (i.e. row or column major) and also supports layouts with
Expand Down
3 changes: 1 addition & 2 deletions dense/src/matrix/constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ impl<Item: Scalar, S: SizeIdentifier, Data: DataContainer<Item = Item>>

impl<Item: Scalar> MatrixD<Item> {
/// Create a new matrix from another object that
/// provides [RandomAccessByValue](rlst_common::traits::RandomAccessByValue) and
/// [Shape](rlst_common::traits::Shape) traits.
/// provides [RandomAccessByValue] and [Shape] traits.
pub fn from_other<Other: RandomAccessByValue<Item = Item> + Shape>(other: &Other) -> Self {
let mut mat = crate::rlst_dynamic_mat![Item, other.shape()];

Expand Down
4 changes: 2 additions & 2 deletions dense/src/traits/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
//! are typical identical. But for more complex types (e.g. with arbitrary stride vectors) they
//! are typically different from each other.
//!
//! The main trait in this module is the [LayoutType](crate::traits::LayoutType) trait.
//! If this is implemented for a matrix the [Layout](crate::traits::Layout) is auto-implemented.
//! The main trait in this module is the [LayoutType] trait.
//! If this is implemented for a matrix the [Layout] is auto-implemented.
//! This latter trait only provides a method to return the [LayoutType] implementation.
//! This crate also provides a number of other traits.
//!
Expand Down
2 changes: 1 addition & 1 deletion io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ num = "0.4"
cauchy = "0.4"
ndarray = "0.15"
rand = "0.8"
itertools = "0.10"
itertools = "0.11"
rand_distr = "0.4"
matrixmultiply = "0.3"
approx = { version = "0.5", features=["num-complex"] }
Expand Down
2 changes: 1 addition & 1 deletion netlib-lapack-src/lapack
Submodule lapack updated 2788 files
2 changes: 1 addition & 1 deletion operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2021"
rlst-common = {path = "../common"}
num = "0.4"
cauchy = "0.4"
thiserror = "1"
thiserror = "1.0.40"

[lib]
name = "rlst_operator"
8 changes: 4 additions & 4 deletions sparse/src/ghost_communicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use std::os::raw::c_void;

use mpi::topology::UserCommunicator;
use mpi::traits::{AsRaw, Communicator, CommunicatorCollectives, Equivalence};
use mpi::topology::SimpleCommunicator;
use mpi::traits::{AsRaw, Communicator, CommunicatorCollectives, Equivalence, FromRaw};
use mpi_sys;
use rlst_common::types::Scalar;

Expand All @@ -18,7 +18,7 @@ pub struct GhostCommunicator {
pub neighborhood_receive_displacements: Vec<i32>,
pub total_send_count: usize,
pub total_receive_count: usize,
neighbor_comm: UserCommunicator,
neighbor_comm: SimpleCommunicator,
}

impl GhostCommunicator {
Expand Down Expand Up @@ -114,7 +114,7 @@ impl GhostCommunicator {
&mut raw_comm,
);

mpi::topology::UserCommunicator::from_raw(raw_comm).unwrap()
mpi::topology::SimpleCommunicator::from_raw(raw_comm)
};

// We now communicate the global indices back from the receivers to the senders.
Expand Down

0 comments on commit fce30b2

Please sign in to comment.