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
29b58696
Commit
29b58696
authored
3 months ago
by
Guillaume-Helbecque
Browse files
Options
Downloads
Patches
Plain Diff
lock pool once for all children
parent
a3947840
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
lib/common/Pool_par.chpl
+22
-0
22 additions, 0 deletions
lib/common/Pool_par.chpl
nqueens_multigpu_chpl.chpl
+10
-9
10 additions, 9 deletions
nqueens_multigpu_chpl.chpl
with
32 additions
and
9 deletions
lib/common/Pool_par.chpl
+
22
−
0
View file @
29b58696
...
...
@@ -25,6 +25,18 @@ module Pool_par
this.lock = false;
}
proc ref acquireLock() {
while true {
if this.lock.compareAndSwap(false, true) {
return;
}
}
}
proc ref releaseLock() {
this.lock.write(false);
}
// Parallel-safe insertion to the end of the deque.
proc ref pushBack(node: eltType) {
while true {
...
...
@@ -44,6 +56,16 @@ module Pool_par
}
}
proc ref pushBackFree(node: eltType) {
if (this.front + this.size >= this.capacity) {
this.capacity *= 2;
this.dom = {0..#this.capacity};
}
this.elements[this.front + this.size] = node;
this.size += 1;
}
// Insertion to the end of the deque. Parallel-safety is not guaranteed.
proc ref pushBackFree(node: eltType) {
if (this.front + this.size >= this.capacity) {
...
...
This diff is collapsed.
Click to expand it.
nqueens_multigpu_chpl.chpl
+
10
−
9
View file @
29b58696
...
...
@@ -126,6 +126,8 @@ proc evaluate_gpu(const parents_d: [] Node, const size, ref labels_d)
proc generate_children(const ref parents: [] Node, const size: int, const ref labels: [] uint(8),
ref exploredTree: uint, ref exploredSol: uint, ref pool)
{
pool.acquireLock();
for i in 0..#size {
const parent = parents[i];
const depth = parent.depth;
...
...
@@ -139,11 +141,13 @@ proc generate_children(const ref parents: [] Node, const size: int, const ref la
child.depth = depth + 1;
child.board = parent.board;
child.board[depth] <=> child.board[j];
pool.pushBack(child);
pool.pushBack
Free
(child);
exploredTree += 1;
}
}
}
pool.releaseLock();
}
// Multi-GPU N-Queens search.
...
...
@@ -318,15 +322,12 @@ proc nqueens_search(ref exploredTree: uint, ref exploredSol: uint, ref elapsedTi
}
}
if lock.compareAndSwap(false, true) {
const poolLocSize = pool_loc.size;
for p in 0..#poolLocSize {
var hasWork = 0;
pool.pushBack(pool_loc.popBack(hasWork));
if !hasWork then break;
}
lock.write(false);
}
eachExploredTree[gpuID] = tree;
eachExploredSol[gpuID] = sol;
...
...
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