Skip to content

Commit

Permalink
multi gpu workload size never exceeds buffer size
Browse files Browse the repository at this point in the history
[trigger-nightly-build]
  • Loading branch information
[email protected] committed Feb 16, 2024
1 parent 5c3dffe commit e24a8e3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/de/nqueensfaf/impl/GpuSolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -524,16 +524,19 @@ private void multiGpu(List<Constellation> constellations) {
int workloadSize = (int) (remaining / gpuPortions[finalGpuIdx]);
if(workloadSize < 4096)
workloadSize = 4096;
for(int i = 0; i < workloadSize; i++) {
synchronized(queue) {
if(queue.isEmpty())

synchronized(queue) {
for(int i = 0; i < workloadSize; i++) {
if(queue.isEmpty() || workload.size() == workloadSize)
break;
workload.add(queue.remove());
}
}

if(workload.size() > 0) {
while(workload.size() > firstWorkload.size() * gpuPortions[finalGpuIdx])
workload.remove(workload.size() - 1);

workload = new ArrayList<>(fillWithPseudoConstellations(workload, gpu.workgroupSize));
runGpu(gpu, workload);
}
Expand Down

0 comments on commit e24a8e3

Please sign in to comment.