loom icon indicating copy to clipboard operation
loom copied to clipboard

Raising the MAX_THREADS limit?

Open rw opened this issue 4 years ago • 1 comments

Would it be feasible to raise the MAX_THREADS limit? Perhaps it can by a typenum provided as a type parameter of the runtime, or a crate-level config variable? I need more threads so that I can do the "choice" operator as described in https://github.com/tokio-rs/loom/issues/84#issuecomment-657879201

Thanks!

rw avatar Jul 14 '20 01:07 rw

I had the same need, and ended up just patching a vendored copy of loom in the meantime:

diff -adupwr /Users/parasyte/other-projects/loom/src/model.rs loom/src/model.rs
--- /Users/parasyte/other-projects/loom/src/model.rs	2020-09-21 02:58:40.000000000 -0700
+++ loom/src/model.rs	2020-09-21 02:06:02.000000000 -0700
@@ -5,7 +5,7 @@ use std::path::PathBuf;
 use std::sync::Arc;
 use std::time::{Duration, Instant};

-const DEFAULT_MAX_THREADS: usize = 4;
+const DEFAULT_MAX_THREADS: usize = 8;
 const DEFAULT_MAX_BRANCHES: usize = 1_000;

 /// Configure a model
diff -adupwr /Users/parasyte/other-projects/loom/src/rt/mod.rs loom/src/rt/mod.rs
--- /Users/parasyte/other-projects/loom/src/rt/mod.rs	2020-10-21 23:40:59.000000000 -0700
+++ loom/src/rt/mod.rs	2020-09-21 02:06:02.000000000 -0700
@@ -57,7 +57,7 @@ mod vv;
 pub(crate) use self::vv::VersionVec;

 /// Maximum number of threads that can be included in a model.
-pub(crate) const MAX_THREADS: usize = 4;
+pub(crate) const MAX_THREADS: usize = 8;

 /// Maximum number of atomic store history to track per-cell.
 pub(crate) const MAX_ATOMIC_HISTORY: usize = 7;

parasyte avatar Oct 22 '20 06:10 parasyte