Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-cluster
Commits
69f59517
Commit
69f59517
authored
Apr 06, 2018
by
rusty1s
Browse files
graclus gpu done
parent
8c15ed64
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
20 deletions
+14
-20
aten/THC/THCGraclus.cu
aten/THC/THCGraclus.cu
+4
-8
aten/THC/THCResponse.cuh
aten/THC/THCResponse.cuh
+10
-12
No files found.
aten/THC/THCGraclus.cu
View file @
69f59517
...
...
@@ -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
)
;
while
(
!
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); */
/* }; */
};
THCudaLongTensor_free
(
state
,
prop
);
THCudaLongTensor_free
(
state
,
degree
);
...
...
aten/THC/THCResponse.cuh
View file @
69f59517
...
...
@@ -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.
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment