Open main menu

CDOT Wiki β

Changes

TriForce

68 bytes removed, 13:07, 8 April 2019
Kernel Optimization Attempts
{| class="wikitable mw-collapsible mw-collapsed"
! Countdown Boolean Array(EDITED - now 4.28ms)
|-
|
int count = 0; //Number of values which can fit in this square
bool int notSeen[N]= 0; //Boolean Array as an Integer for (int i = 0; i < N; ++i) notSeen[i] = false;
if (gridIdx == 0)
changed = true;
rowHas[col][row] = false;
colHas[col][row] = false;
__syncthreads();
int guess;
int b_shuttle = 1;
for (int idx = 0; idx < N; ++idx) {
int num = (idx + offset) % N;
if (at == UNASSIGNED && !(rowHas[row][num] || boxHas[box][num] || colHas[col][num])) {
notSeen[num] |= trueb_shuttle; //this value can go here ++count; //how many values this square can have
guess = num;
//how many values this section can have
}
__syncthreads();
b_shuttle <<= 1;
}
if (count == 1) {
at = guess + 1;
notSeen = count = 0;
rowHas[row][guess] = true;
colHas[col][guess] = true;
}
// Previous loop has not changed any values
while (changed) {
__syncthreads();
if (gridIdx == 0) // forget previous change
changed = false;
bool inSection int b_shuttle = true1; for (int idx = 0; idx < N; ++idx) {
// Ensures that every square in each section is working on a different number in the section
int num = (idx + offset) % N;
if (at == UNASSIGNED b_shuttle & notSeen && notSeen[num]) { if (at != UNASSIGNED || rowHas[row][num] || boxHas[box][num] || colHas[col][num])) { notSeen[num] = false; --count;
rowCount[row][num]--;
colCount[col][num]--;
boxCount[box][num]--;
} else if (inSection) { guess notSeen ^= numb_shuttle; } --count;
}
__syncthreads();
if (at == UNASSIGNED &b_shuttle & notSeen[num] && (count == 1 || rowCount[row][num] == 1 || boxCount[box][num] == 1 || colCount[col][num] == 1)){ rowHas[row][num] = true; colHas[col][num] = true; boxHas[box][num] = true; changed = true; inSection notSeen ^= falseb_shuttle; at = num + 1; count = 0; }
} if (count == 1 || !inSection) { at b_shuttle <<= guess + 1; count = 0; rowHas[row][guess] = true; colHas[col][guess] = true; boxHas[box][guess] = true; changed = true;
}
__syncthreads();
if (!(rowHas[row][col] && colHas[row][col] && boxHas[box][col]))
changed = true; //HAVE NOT SOLVED the sudoku
__syncthreads();
if (changed && gridIdx == 0)
at = 0;
d_a[gridIdx] = at;
}