Commit 11726e3d authored by rusty1s's avatar rusty1s
Browse files

bugfix

parent 68ed8ead
...@@ -25,11 +25,9 @@ __global__ void weightedProposeKernel(int64_t *color, int64_t *prop, int64_t *ro ...@@ -25,11 +25,9 @@ __global__ void weightedProposeKernel(int64_t *color, int64_t *prop, int64_t *ro
KERNEL_LOOP(i, nNodes) { KERNEL_LOOP(i, nNodes) {
if (color[i] != -1) { continue; } // Only visit blue nodes. if (color[i] != -1) { continue; } // Only visit blue nodes.
ptrdiff_t c; bool isDead = true; ptrdiff_t c; bool isDead = true;
T maxWeight, tmp; T maxWeight = ScalarConvert<int, T>::to(0), tmp;
int64_t matchedValue; int64_t matchedValue = -1;
for (ptrdiff_t e = cumDegree[i] - degree[i]; e < cumDegree[i]; e++) { for (ptrdiff_t e = cumDegree[i] - degree[i]; e < cumDegree[i]; e++) {
maxWeight = ScalarConvert<int, T>::to(0);
matchedValue = -1;
c = col[e]; c = col[e];
tmp = weight[e]; tmp = weight[e];
if (isDead && color[c] < 0) { isDead = false; } // Unmatched neighbor found. if (isDead && color[c] < 0) { isDead = false; } // Unmatched neighbor found.
...@@ -39,12 +37,11 @@ __global__ void weightedProposeKernel(int64_t *color, int64_t *prop, int64_t *ro ...@@ -39,12 +37,11 @@ __global__ void weightedProposeKernel(int64_t *color, int64_t *prop, int64_t *ro
maxWeight = tmp; maxWeight = tmp;
} }
} }
if (matchedValue >= 0) { prop[i] = matchedValue; } prop[i] = matchedValue;
if (isDead) { color[i] = i; } // Mark node as dead. if (isDead) { color[i] = i; } // Mark node as dead.
} }
} }
void THCTensor_propose(THCState *state, THCudaLongTensor *color, THCudaLongTensor *prop, void THCTensor_propose(THCState *state, THCudaLongTensor *color, THCudaLongTensor *prop,
THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree, THCudaLongTensor *row, THCudaLongTensor *col, THCudaLongTensor *degree,
THCudaLongTensor *cumDegree) { THCudaLongTensor *cumDegree) {
......
...@@ -28,11 +28,9 @@ __global__ void weightedResponseKernel(int64_t *color, int64_t *prop, int64_t *r ...@@ -28,11 +28,9 @@ __global__ void weightedResponseKernel(int64_t *color, int64_t *prop, int64_t *r
KERNEL_LOOP(i, nNodes) { KERNEL_LOOP(i, nNodes) {
if (color[i] != -2) { continue; } // Only visit red nodes. if (color[i] != -2) { continue; } // Only visit red nodes.
ptrdiff_t c; bool isDead = true; ptrdiff_t c; bool isDead = true;
T maxWeight, tmp; T maxWeight = ScalarConvert<int, T>::to(0), tmp;
ptrdiff_t matchedValue; ptrdiff_t matchedValue = -1;
for (ptrdiff_t e = cumDegree[i] - degree[i]; e < cumDegree[i]; e++) { for (ptrdiff_t e = cumDegree[i] - degree[i]; e < cumDegree[i]; e++) {
maxWeight = ScalarConvert<int, T>::to(0);
matchedValue = -1;
c = col[e]; c = col[e];
tmp = weight[e]; tmp = weight[e];
if (isDead && color[c] < 0) { isDead = false; } // Unmatched neighbor found. if (isDead && color[c] < 0) { isDead = false; } // Unmatched neighbor found.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment