Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SMP Support #31

Merged
merged 56 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
06b4b01
Curent Prog
jw1912 Jul 12, 2024
93ecd8b
Current again
jw1912 Jul 12, 2024
b448d63
Bench: 2130284
jw1912 Jul 12, 2024
fa6b628
Bench: 2130284
jw1912 Jul 12, 2024
1bb4353
Bench: 2130284
jw1912 Jul 13, 2024
b7aebaa
Bench: 2130284
jw1912 Jul 14, 2024
8eaa9ed
Merge branch 'master' into atomics
jw1912 Jul 14, 2024
1179e25
Use relaxed ordering
jw1912 Jul 14, 2024
7f05a00
Merge branch 'master' into atomics
jw1912 Jul 15, 2024
5e03471
Technically ready for SMP
jw1912 Jul 15, 2024
90716d4
.
jw1912 Jul 16, 2024
8f6d1f6
save bytes in node
jw1912 Jul 16, 2024
5ec4799
Bench: 2261080
jw1912 Jul 16, 2024
1864b6e
Save space in hash table
jw1912 Jul 16, 2024
730778a
`AtomicVec`
jw1912 Jul 17, 2024
5d665d2
Bench: 2261080
jw1912 Jul 17, 2024
af94337
Start work on lrc
jw1912 Jul 18, 2024
42cdeb7
.
jw1912 Jul 19, 2024
4fd985b
.
jw1912 Jul 20, 2024
d95e937
.
jw1912 Jul 20, 2024
5f1e646
Merge branch 'master' into lrc
jw1912 Jul 20, 2024
66d1a1c
progress!
jw1912 Jul 20, 2024
509e2bc
almost there
jw1912 Jul 21, 2024
4a4574d
i done broke normal mcts
jw1912 Jul 21, 2024
e58ba4d
.
jw1912 Jul 21, 2024
3f22e20
Merge branch 'master' into lrc
jw1912 Jul 21, 2024
d2f5806
.
jw1912 Jul 21, 2024
9117e13
.
jw1912 Jul 21, 2024
e9672a8
.
jw1912 Jul 21, 2024
4c47ddc
.
jw1912 Jul 21, 2024
88d8250
.
jw1912 Jul 21, 2024
63233a6
Bench: 1682532
jw1912 Jul 21, 2024
23e30dc
.
jw1912 Jul 21, 2024
c2c6711
fix
jw1912 Jul 21, 2024
c038e0e
Cleanup all the garbage
jw1912 Jul 21, 2024
00ea181
fix one issue, another arises
jw1912 Jul 21, 2024
0b6c7cf
.
jw1912 Jul 21, 2024
84064a6
Merge branch 'official-monty:master' into lrc
jw1912 Jul 28, 2024
3df4365
no age
jw1912 Jul 28, 2024
5892700
Fixed?
jw1912 Aug 1, 2024
b1abdf9
Merge branch 'master' into lrc
jw1912 Aug 1, 2024
b6e4177
Fix OOM on Workers
jw1912 Aug 2, 2024
0607d46
Merge branch 'master' into lrc
jw1912 Aug 2, 2024
89213f4
.
jw1912 Aug 4, 2024
3572ef0
Bench: 1954267
jw1912 Aug 4, 2024
8029e1c
Bench: 1954267
jw1912 Aug 4, 2024
c20fd69
Bench: 1954267
jw1912 Aug 4, 2024
c5d0cd4
Bench: 1954267
jw1912 Aug 4, 2024
2f07aba
Working?
jw1912 Aug 4, 2024
0180c27
Merge branch 'master' into smp
jw1912 Aug 4, 2024
c9ffc9b
fix
jw1912 Aug 4, 2024
ff15098
cleanup
jw1912 Aug 4, 2024
0a04069
Enforce invariant in `Tree::copy_across`
jw1912 Aug 4, 2024
0d1c819
Basic fix
jw1912 Aug 4, 2024
1861d05
Fix + Small Cleanup
jw1912 Aug 4, 2024
e2bfed0
Format
jw1912 Aug 5, 2024
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
4 changes: 2 additions & 2 deletions datagen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct Destination {

impl Destination {
pub fn push(&mut self, game: &Binpack, stop: &AtomicBool) {
if stop.load(Ordering::SeqCst) {
if stop.load(Ordering::Relaxed) {
return;
}

Expand All @@ -51,7 +51,7 @@ impl Destination {
game.serialise_into(&mut self.writer).unwrap();

if self.games >= self.limit {
stop.store(true, Ordering::SeqCst);
stop.store(true, Ordering::Relaxed);
return;
}

Expand Down
17 changes: 5 additions & 12 deletions datagen/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,22 @@ impl<'a> DatagenThread<'a> {
}

let abort = AtomicBool::new(false);
let mut searcher = Searcher::new(
position.clone(),
tree,
self.params.clone(),
policy,
value,
&abort,
);
tree.try_use_subtree(&position, &None);
let searcher =
Searcher::new(position.clone(), &tree, &self.params, policy, value, &abort);

let (bm, score) = searcher.search(limits, false, &mut 0, &None);
let (bm, score) = searcher.search(1, limits, false, &mut 0);

game.push(position.stm(), bm, score);

tree = searcher.tree_and_board().0;

let mut root_count = 0;
position.map_legal_moves(|_| root_count += 1);

// disallow positions with >106 moves and moves when in check
if root_count <= 112 {
let mut policy_pos = PolicyData::new(position.clone(), bm, score);

for action in tree[tree.root_node()].actions() {
for action in tree[tree.root_node()].actions().iter() {
policy_pos.push(action.mov().into(), action.visits());
}

Expand Down
26 changes: 26 additions & 0 deletions src/chess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,32 @@ pub enum GameState {
Won(u8),
}

impl From<GameState> for u16 {
fn from(value: GameState) -> Self {
match value {
GameState::Ongoing => 0,
GameState::Draw => 1 << 8,
GameState::Lost(x) => (2 << 8) ^ u16::from(x),
GameState::Won(x) => (3 << 8) ^ u16::from(x),
}
}
}

impl From<u16> for GameState {
fn from(value: u16) -> Self {
let discr = value >> 8;
let x = value as u8;

match discr {
0 => GameState::Ongoing,
1 => GameState::Draw,
2 => GameState::Lost(x),
3 => GameState::Won(x),
_ => unreachable!(),
}
}
}

impl std::fmt::Display for GameState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
Loading
Loading