Skip to content

Commit 1a7cff3

Browse files
fix: upgrade hwloc (#1766)
* fix: upgrade hwloc * feat: re-enable CI for pull requests --------- Co-authored-by: nemo <[email protected]>
1 parent 3c83391 commit 1a7cff3

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22

3-
#on: [pull_request, push]
4-
on: [push]
3+
on: [pull_request, push]
4+
#on: [push]
55

66
# Cancel a job if there's a new on on the same branch started.
77
# Based on https://stackoverflow.com/questions/58895283/stop-already-running-workflow-job-in-github-actions/67223051#67223051

storage-proofs-porep/Cargo.toml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/filecoin-project/rust-fil-proofs"
99
readme = "README.md"
1010

1111
[dependencies]
12-
filecoin-hashers = { workspace = true, features = ["poseidon", "sha256"]}
12+
filecoin-hashers = { workspace = true, features = ["poseidon", "sha256"] }
1313
fr32.workspace = true
1414
sha2raw.workspace = true
1515
storage-proofs-core.workspace = true
@@ -28,7 +28,7 @@ ff.workspace = true
2828
generic-array.workspace = true
2929
glob = "0.3.0"
3030
hex.workspace = true
31-
hwloc = { version = "0.5.0", optional = true }
31+
hwloc = { version = "2.2.0", optional = true, package = "hwloc2" }
3232
lazy_static.workspace = true
3333
libc = "0.2"
3434
log.workspace = true
@@ -53,7 +53,11 @@ sha2 = { workspace = true, features = ["compress", "asm"] }
5353
sha2 = { workspace = true, features = ["compress"] }
5454

5555
[dev-dependencies]
56-
filecoin-hashers = { workspace = true, features = ["poseidon", "sha256", "blake2s"]}
56+
filecoin-hashers = { workspace = true, features = [
57+
"poseidon",
58+
"sha256",
59+
"blake2s",
60+
] }
5761
# Sorted alphabetically
5862
criterion.workspace = true
5963
fil_logger.workspace = true
@@ -63,8 +67,18 @@ tempfile.workspace = true
6367

6468
[features]
6569
default = ["opencl", "multicore-sdr"]
66-
cuda = ["storage-proofs-core/cuda", "filecoin-hashers/cuda", "neptune/cuda", "bellperson/cuda"]
67-
opencl = ["storage-proofs-core/opencl", "filecoin-hashers/opencl", "neptune/opencl", "bellperson/opencl"]
70+
cuda = [
71+
"storage-proofs-core/cuda",
72+
"filecoin-hashers/cuda",
73+
"neptune/cuda",
74+
"bellperson/cuda",
75+
]
76+
opencl = [
77+
"storage-proofs-core/opencl",
78+
"filecoin-hashers/opencl",
79+
"neptune/opencl",
80+
"bellperson/opencl",
81+
]
6882
isolated-testing = []
6983
multicore-sdr = ["hwloc"]
7084
# This feature enables a fixed number of discarded rows for TreeR. The `FIL_PROOFS_ROWS_TO_DISCARD`

storage-proofs-porep/src/stacked/vanilla/cores.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ use std::convert::TryInto;
22
use std::sync::{Mutex, MutexGuard};
33

44
use anyhow::{format_err, Result};
5-
use hwloc::{Bitmap, ObjectType, Topology, TopologyObject, CPUBIND_THREAD};
5+
use hwloc::{Bitmap, CpuBindFlags, ObjectType, Topology, TopologyObject};
66
use lazy_static::lazy_static;
77
use log::{debug, warn};
88
use storage_proofs_core::settings::SETTINGS;
99

1010
type CoreUnit = Vec<CoreIndex>;
1111
lazy_static! {
12-
pub static ref TOPOLOGY: Mutex<Topology> = Mutex::new(Topology::new());
12+
pub static ref TOPOLOGY: Mutex<Topology> =
13+
Mutex::new(Topology::new().expect("failed to initialize and load cpu topology"));
1314
pub static ref CORE_GROUPS: Option<Vec<Mutex<CoreUnit>>> = {
1415
let num_producers = &SETTINGS.multicore_sdr_producers;
1516
let cores_per_unit = num_producers + 1;
@@ -69,7 +70,8 @@ impl Drop for Cleanup {
6970
if let Some(prior) = self.prior_state.take() {
7071
let child_topo = &TOPOLOGY;
7172
let mut locked_topo = child_topo.lock().expect("poisded lock");
72-
let _ = locked_topo.set_cpubind_for_thread(self.tid, prior, CPUBIND_THREAD);
73+
let _ =
74+
locked_topo.set_cpubind_for_thread(self.tid, prior, CpuBindFlags::CPUBIND_THREAD);
7375
}
7476
}
7577
}
@@ -82,7 +84,7 @@ pub fn bind_core(core_index: CoreIndex) -> Result<Cleanup> {
8284
.map_err(|err| format_err!("failed to get core at index {}: {:?}", core_index.0, err))?;
8385

8486
let cpuset = core
85-
.allowed_cpuset()
87+
.cpuset()
8688
.ok_or_else(|| format_err!("no allowed cpuset for core at index {}", core_index.0,))?;
8789
debug!("allowed cpuset: {:?}", cpuset);
8890
let mut bind_to = cpuset;
@@ -91,12 +93,12 @@ pub fn bind_core(core_index: CoreIndex) -> Result<Cleanup> {
9193
bind_to.singlify();
9294

9395
// Thread binding before explicit set.
94-
let before = locked_topo.get_cpubind_for_thread(tid, CPUBIND_THREAD);
96+
let before = locked_topo.get_cpubind_for_thread(tid, CpuBindFlags::CPUBIND_THREAD);
9597

9698
debug!("binding to {:?}", bind_to);
9799
// Set the binding.
98100
let result = locked_topo
99-
.set_cpubind_for_thread(tid, bind_to, CPUBIND_THREAD)
101+
.set_cpubind_for_thread(tid, bind_to, CpuBindFlags::CPUBIND_THREAD)
100102
.map_err(|err| format_err!("failed to bind CPU: {:?}", err));
101103

102104
if result.is_err() {
@@ -239,7 +241,7 @@ fn core_units(cores_per_unit: usize) -> Option<Vec<Mutex<CoreUnit>>> {
239241
.get_cpubind(hwloc::CpuBindFlags::empty())
240242
.unwrap_or_else(|| {
241243
topo.object_at_root()
242-
.allowed_cpuset()
244+
.cpuset()
243245
.unwrap_or_else(hwloc::CpuSet::full)
244246
});
245247

0 commit comments

Comments
 (0)