Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GPU Accelerated Tree Search Chapel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UltraBO
GPU Accelerated Tree Search Chapel
Commits
00f2324d
Commit
00f2324d
authored
2 months ago
by
Guillaume-Helbecque
Browse files
Options
Downloads
Patches
Plain Diff
minor changes
parent
6ef3541f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
nqueens_chpl.chpl
+11
-12
11 additions, 12 deletions
nqueens_chpl.chpl
nqueens_multigpu_chpl.chpl
+5
-6
5 additions, 6 deletions
nqueens_multigpu_chpl.chpl
with
16 additions
and
18 deletions
nqueens_chpl.chpl
+
11
−
12
View file @
00f2324d
...
...
@@ -6,7 +6,6 @@ use Time;
use util;
use Pool;
use NQueens_node;
/*******************************************************************************
...
...
@@ -68,25 +67,26 @@ proc isSafe(const board, const queen_num, const row_pos): uint(8)
}
// Evaluate and generate children nodes on CPU.
proc decompose(const parent: Node, ref tree_loc: uint, ref num_sol: uint, ref pool
: SinglePool(Node)
)
proc decompose(const parent: Node, ref tree_loc: uint, ref num_sol: uint, ref pool)
{
const depth = parent.depth;
if (depth == N) {
num_sol += 1;
}
else {
for j in depth..(N-1) {
if isSafe(parent.board, depth, parent.board[j]) {
var child = new Node();
child.depth =
parent.
depth;
child.depth = depth
+ 1
;
child.board = parent.board;
child.board[depth] <=> child.board[j];
child.depth += 1;
pool.pushBack(child);
tree_loc += 1;
}
}
}
}
// Sequential N-Queens search.
proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTime: real)
...
...
@@ -94,7 +94,6 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
var root = new Node(N);
var pool = new SinglePool(Node);
pool.pushBack(root);
var timer: stopwatch;
...
...
This diff is collapsed.
Click to expand it.
nqueens_multigpu_chpl.chpl
+
5
−
6
View file @
00f2324d
...
...
@@ -88,7 +88,7 @@ proc decompose(const parent: Node, ref tree_loc: uint, ref num_sol: uint, ref po
child.depth = depth + 1;
child.board = parent.board;
child.board[depth] <=> child.board[j];
pool.pushBack(child);
pool.pushBack
Free
(child);
tree_loc += 1;
}
}
...
...
@@ -162,9 +162,6 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
var pool = new SinglePool_par(Node);
pool.pushBack(root);
var allTasksIdleFlag: atomic bool = false;
var eachTaskState: [0..#D] atomic bool = BUSY; // one task per GPU
var timer: stopwatch;
/*
...
...
@@ -196,12 +193,13 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
timer.start();
var eachExploredTree, eachExploredSol: [0..#D] uint;
var eachTaskState: [0..#D] atomic bool = BUSY; // one task per GPU
var allTasksIdleFlag: atomic bool = false;
const poolSize = pool.size;
const c = poolSize / D;
const l = poolSize - (D-1)*c;
const f = pool.front;
var lock: atomic bool;
pool.front = 0;
pool.size = 0;
...
...
@@ -254,7 +252,7 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
generate_children(parents, poolSize, labels, tree, sol, pool_loc);
}
else {
// work stealing
// work stealing
attempts
var tries = 0;
var steal = false;
const victims = permute(0..#D);
...
...
@@ -296,6 +294,7 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
}
tries += 1;
}
if (steal == false) {
// termination
if (taskState == BUSY) {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment