Skip to content

Commit 6abd08f

Browse files
authored
refactor!: flatten crate organization to use workspace properly (#321)
* refactor!: flatten crate organization to use workspace properly * fix: update code to build using common deps versions some subcrates were using outdated deps, which required code updates to build. `cargo build --all-targets` now works, with many warnings * fix: format `toml` file * fix: fix clippy lints * fix: format
1 parent 373ff86 commit 6abd08f

82 files changed

Lines changed: 1176 additions & 1380 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 131 additions & 456 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,63 @@
11
[workspace]
2-
members = [
3-
".",
4-
"ffi",
5-
"tools",
6-
"tools/mesh-io",
7-
"tools/mesh-io/ffi",
8-
"tools/num-part",
9-
]
2+
members = ["coupe", "coupe-ffi", "mesh-io", "mesh-io-ffi", "tools"]
3+
resolver = "3"
104

11-
[package]
5+
[workspace.package]
126
authors = [
137
"Armand Touminet <armand.touminet@protonmail.com>",
148
"Hubert Hirtz <hubert@hirtz.pm>",
159
"Cédric Chevalier",
1610
"Sébastien Morais",
1711
]
18-
autobenches = false
1912
categories = ["algorithms", "mathematics"]
20-
description = """
21-
Coupe is a mesh partitioning library. It implements composable
22-
geometric and topologic algorithms.
23-
"""
13+
description = "coupe, a parallel mesh partitioning library"
2414
edition = "2024"
2515
keywords = ["mesh", "partitioning"]
2616
license = "MIT OR Apache-2.0"
27-
name = "coupe"
2817
readme = "README.md"
2918
repository = "https://github.com/LIHPC-Computational-Geometry/coupe"
3019
version = "0.1.0"
3120

32-
[features]
33-
default = ["sprs"]
3421

35-
# Enable the nightly `stdsimd` feature and AVX512-accelerated algorithms.
36-
# Requires rust nightly.
37-
avx512 = []
22+
[workspace.dependencies]
23+
# members
24+
coupe = { version = "0.1.0", path = "./coupe" }
25+
coupe-ffi = { version = "0.1.0", path = "./coupe-ffi" }
26+
mesh-io = { version = "0.1.0", path = "./mesh-io" }
27+
mesh-io-ffi = { version = "0.1.0", path = "./mesh-io-ffi" }
28+
tools = { version = "0.1.0", path = "./tools" }
3829

39-
[dependencies]
30+
# deps
31+
anyhow = { version = "1", default-features = false, features = ["std"] }
4032
approx = "0.5.1"
41-
itertools = "0.14.0"
33+
core_affinity = "0.8.3"
34+
criterion = { version = "0.8.0", default-features = false }
35+
getopts = { version = "0.2", default-features = false }
36+
itertools = { version = "0.14.0", default-features = false }
4237
ittapi = "0.5.0"
38+
metis = "0.2"
4339
nalgebra = { version = "0.34.1", default-features = false, features = [
4440
"rand",
4541
"std",
4642
] }
4743
num-traits = "0.2.19"
48-
rand = "0.9.2"
49-
rayon = "1.11.0"
50-
sprs = { version = "0.11.4", optional = true, default-features = false, features = [
51-
"multi_thread",
52-
] }
53-
tracing = { version = "0.1.43", default-features = false, features = ["std"] }
54-
55-
[dev-dependencies]
56-
core_affinity = "0.8.3"
57-
criterion = "0.8.0"
5844
num_cpus = "1.17.0"
45+
once_cell = "1.21"
5946
proptest = { version = "1.9.0", default-features = false, features = [
6047
"std",
6148
"timeout",
6249
] }
63-
tracing-chrome = "0.7.2"
64-
tracing-subscriber = "0.3.22"
65-
tracing-tree = "0.4.1"
66-
67-
68-
[[bench]]
69-
harness = false
70-
name = "rcb_cartesian"
50+
rand = { version = "0.9.2", default-features = false }
51+
rand_distr = { version = "0.5.1", default-features = false }
52+
rand_pcg = { version = "0.9.0", default-features = false }
53+
rayon = "1.11.0"
54+
rusqlite = { version = "0.38.0", default-features = false }
55+
scotch = "0.2.1"
56+
sprs = { version = "0.11.4", default-features = false, features = [
57+
"multi_thread",
58+
] }
59+
tracing = { version = "0.1.43", default-features = false, features = ["std"] }
60+
tracing-chrome = { version = "0.7.2", default-features = false }
61+
tracing-subscriber = { version = "0.3.22", default-features = false }
62+
tracing-tree = { version = "0.4.1", default-features = false }
63+
vtkio = { version = "0.6", default-features = false }

coupe-ffi/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
categories.workspace = true
3+
edition.workspace = true
4+
keywords.workspace = true
5+
license.workspace = true
6+
readme.workspace = true
7+
repository.workspace = true
8+
version.workspace = true
9+
10+
description = "C bindings to coupe"
11+
name = "coupe-ffi"
12+
13+
14+
[lib]
15+
crate-type = ["cdylib", "staticlib"]
16+
doc = false # name conflicts with the rust lib
17+
name = "coupe"
18+
19+
20+
[dependencies]
21+
coupe.workspace = true
File renamed without changes.
File renamed without changes.
File renamed without changes.

ffi/src/data.rs renamed to coupe-ffi/src/data.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,24 @@ impl Constant {
3333
{
3434
let mut v = Vec::new();
3535
v.try_reserve_exact(self.len)?;
36-
let value = *(self.value as *const T);
36+
let value = unsafe { *(self.value as *const T) };
3737
v.resize(self.len, value);
3838
Ok(v)
3939
}
4040

41-
pub unsafe fn iter<'a, T>(&'a self) -> impl Iterator<Item = T> + ExactSizeIterator + 'a
41+
pub unsafe fn iter<'a, T>(&'a self) -> impl ExactSizeIterator<Item = T> + 'a
4242
where
4343
T: 'a + Copy,
4444
{
45-
let value = *(self.value as *const T);
45+
let value = unsafe { *(self.value as *const T) };
4646
(0..self.len).map(move |_| value)
4747
}
4848

4949
pub unsafe fn par_iter<'a, T>(&'a self) -> impl IndexedParallelIterator<Item = T> + Clone + 'a
5050
where
5151
T: 'a + Copy + Send + Sync,
5252
{
53-
let value = *(self.value as *const T);
53+
let value = unsafe { *(self.value as *const T) };
5454
coupe::rayon::iter::repeat_n(value, self.len)
5555
}
5656
}
@@ -70,14 +70,14 @@ impl Array {
7070
where
7171
T: 'a,
7272
{
73-
slice::from_raw_parts(self.array as *const T, self.len)
73+
unsafe { slice::from_raw_parts(self.array as *const T, self.len) }
7474
}
7575

76-
pub unsafe fn iter<'a, T>(&'a self) -> impl Iterator<Item = T> + ExactSizeIterator + 'a
76+
pub unsafe fn iter<'a, T>(&'a self) -> impl ExactSizeIterator<Item = T> + 'a
7777
where
7878
T: 'a + Copy,
7979
{
80-
slice::from_raw_parts(self.array as *const T, self.len)
80+
unsafe { slice::from_raw_parts(self.array as *const T, self.len) }
8181
.iter()
8282
.cloned()
8383
}
@@ -86,7 +86,7 @@ impl Array {
8686
where
8787
T: 'a + Copy + Send + Sync,
8888
{
89-
slice::from_raw_parts(self.array as *const T, self.len)
89+
unsafe { slice::from_raw_parts(self.array as *const T, self.len) }
9090
.par_iter()
9191
.cloned()
9292
}
@@ -113,15 +113,15 @@ impl Fn {
113113
{
114114
let mut v = Vec::new();
115115
v.try_reserve_exact(self.len)?;
116-
v.par_extend(self.par_iter::<T>());
116+
v.par_extend(unsafe { self.par_iter::<T>() });
117117
Ok(v)
118118
}
119119

120-
pub unsafe fn iter<'a, T>(&'a self) -> impl Iterator<Item = T> + ExactSizeIterator + 'a
120+
pub unsafe fn iter<'a, T>(&'a self) -> impl ExactSizeIterator<Item = T> + 'a
121121
where
122122
T: 'a + Copy,
123123
{
124-
(0..self.len).map(|i| {
124+
(0..self.len).map(|i| unsafe {
125125
let ptr = (self.i_th)(self.context, i) as *const T;
126126
*ptr
127127
})
@@ -131,7 +131,7 @@ impl Fn {
131131
where
132132
T: 'a + Copy + Send,
133133
{
134-
(0..self.len).into_par_iter().map(|i| {
134+
(0..self.len).into_par_iter().map(|i| unsafe {
135135
let ptr = (self.i_th)(self.context, i) as *const T;
136136
*ptr
137137
})
@@ -158,9 +158,9 @@ impl Data {
158158
T: Copy + Send,
159159
{
160160
Ok(match self {
161-
Self::Array(iter) => Cow::from(iter.to_slice()),
162-
Self::Constant(iter) => Cow::from(iter.to_slice()?),
163-
Self::Fn(iter) => Cow::from(iter.to_slice()?),
161+
Self::Array(iter) => Cow::from(unsafe { iter.to_slice() }),
162+
Self::Constant(iter) => Cow::from(unsafe { iter.to_slice()? }),
163+
Self::Fn(iter) => Cow::from(unsafe { iter.to_slice()? }),
164164
})
165165
}
166166

0 commit comments

Comments
 (0)