"src/vscode:/vscode.git/clone" did not exist on "f07a16e09bb5b1cf4fa2306bfa4ea791f24fa968"
Commit 69f59517 authored by rusty1s's avatar rusty1s
Browse files

graclus gpu done

parent 8c15ed64
......@@ -22,14 +22,10 @@ void THCTensor_graclus(THCState *state, THCudaLongTensor *self, THCudaLongTensor
THCudaLongTensor *cumDegree = THCudaLongTensor_newWithSize1d(state, nNodes);
THCudaLongTensor_cumsum(state, cumDegree, degree, 0);
THCTensor_color(state, self);
THCTensor_propose(state, self, prop, row, col, degree, cumDegree);
THCTensor_response(state, self, prop, row, col, degree, cumDegree);
/* while(!THCTensor_assignColor(state, self)) { */
/* THCTensor_propose(state, self, prop, row, col, degree, cumDegree); */
/* THCTensor_response(state, self, prop, row, col, degree, cumDegree); */
/* }; */
while(!THCTensor_color(state, self)) {
THCTensor_propose(state, self, prop, row, col, degree, cumDegree);
THCTensor_response(state, self, prop, row, col, degree, cumDegree);
};
THCudaLongTensor_free(state, prop);
THCudaLongTensor_free(state, degree);
......
......@@ -16,20 +16,18 @@ __global__ void responseKernel(int64_t *color, int64_t *prop, int64_t *row, int6
int64_t *degree, int64_t *cumDegree, ptrdiff_t nNodes) {
KERNEL_LOOP(i, nNodes) {
if (color[i] != -2) { continue; } // Only visit red nodes.
/* ptrdiff_t c; // int64_t neighborColor, minValue; */
/* bool isDead = true; */
ptrdiff_t c; // int64_t neighborColor, minValue;
bool isDead = true;
for (ptrdiff_t e = cumDegree[i] - degree[i]; e < cumDegree[i]; e++) {
/* c = col[e]; */
/* neighborColor = color[c]; */
/* if (neighborColor == -1 && prop[c] == i) { // Blue neighbor found which proposed to node i. */
/* minValue = min(i, c); */
/* color[i] = minValue; */
/* color[c] = minValue; */
/* break; */
/* } */
/* if (neighborColor < 0) isDead = false; */
c = col[e];
if (isDead && color[c] < 0) { isDead = false; } // Unmatched neighbor found.
if (color[c] == -1 && prop[c] == i) { // Match first blue neighbor who proposed to i.
color[i] = min(i, c);
color[c] = min(i, c);
break;
}
}
/* if (isDead && color[i] < 0) color[i] = i; // Mark node as dead. */
if (isDead) { color[i] = i; } // Mark node as dead.
}
}
......
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