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
bebd72f3
Commit
bebd72f3
authored
Apr 03, 2018
by
rusty1s
Browse files
rename
parent
78342c6a
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
71 additions
and
65 deletions
+71
-65
aten/TH/THGraclus.h
aten/TH/THGraclus.h
+1
-1
aten/THCC/THCCGraclus.c
aten/THCC/THCCGraclus.c
+14
-0
aten/THCC/THCCGraclus.h
aten/THCC/THCCGraclus.h
+10
-0
aten/THCC/THCCGreedy.c
aten/THCC/THCCGreedy.c
+0
-15
aten/THCC/THCCGreedy.h
aten/THCC/THCCGreedy.h
+0
-10
aten/THCC/THCCGrid.c
aten/THCC/THCCGrid.c
+2
-3
aten/THCC/THCCGrid.h
aten/THCC/THCCGrid.h
+8
-8
aten/THCC/generic/THCCGraclus.c
aten/THCC/generic/THCCGraclus.c
+10
-0
aten/THCC/generic/THCCGreedy.c
aten/THCC/generic/THCCGreedy.c
+0
-10
aten/THCC/generic/THCCGrid.c
aten/THCC/generic/THCCGrid.c
+3
-3
benchmark/ffi.py
benchmark/ffi.py
+14
-6
build.py
build.py
+9
-9
No files found.
aten/TH/THGraclus.h
View file @
bebd72f3
void
THTensor_graclus
(
THLongTensor
*
self
,
THLongTensor
*
row
,
THLongTensor
*
col
);
void
THTensor_graclus
(
THLongTensor
*
self
,
THLongTensor
*
row
,
THLongTensor
*
col
);
void
THByteTensor_graclus
(
THLongTensor
*
self
,
THLongTensor
*
row
,
THLongTensor
*
col
,
THByteTensor
*
weight
);
void
THByteTensor_graclus
(
THLongTensor
*
self
,
THLongTensor
*
row
,
THLongTensor
*
col
,
THByteTensor
*
weight
);
void
THCharTensor_graclus
(
THLongTensor
*
self
,
THLongTensor
*
row
,
THLongTensor
*
col
,
THCharTensor
*
weight
);
void
THCharTensor_graclus
(
THLongTensor
*
self
,
THLongTensor
*
row
,
THLongTensor
*
col
,
THCharTensor
*
weight
);
...
...
aten/THCC/THCCGraclus.c
0 → 100644
View file @
bebd72f3
#include <THC/THC.h>
#include "THC.h"
#define THCCTensor_(NAME) TH_CONCAT_4(THCC,Real,Tensor_,NAME)
extern
THCState
*
state
;
void
THCCTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
)
{
THCTensor_graclus
(
state
,
self
,
row
,
col
);
}
#include "generic/THCCGraclus.c"
#include "THCGenerateAllTypes.h"
aten/THCC/THCCGraclus.h
0 → 100644
View file @
bebd72f3
void
THCCTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
);
void
THCCByteTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaByteTensor
*
weight
);
void
THCCCharTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaCharTensor
*
weight
);
void
THCCShortTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaShortTensor
*
weight
);
void
THCCIntTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaIntTensor
*
weight
);
void
THCCLongTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaLongTensor
*
weight
);
void
THCCHalfTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaHalfTensor
*
weight
);
void
THCCFloatTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaTensor
*
weight
);
void
THCCDoubleTensor_graclus
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaDoubleTensor
*
weight
);
aten/THCC/THCCGreedy.c
deleted
100644 → 0
View file @
78342c6a
#include <THC/THC.h>
#include "THCGreedy.h"
#define THCCGreedy_ TH_CONCAT_3(THCC,Real,Greedy)
#define THCGreedy_ TH_CONCAT_3(TH,CReal,Greedy)
extern
THCState
*
state
;
void
THCCGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
)
{
THCGreedy
(
state
,
cluster
,
row
,
col
);
}
#include "generic/THCCGreedy.c"
#include "THCGenerateAllTypes.h"
aten/THCC/THCCGreedy.h
deleted
100644 → 0
View file @
78342c6a
void
THCCGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
);
void
THCCByteGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaByteTensor
*
weight
);
void
THCCCharGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaCharTensor
*
weight
);
void
THCCShortGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaShortTensor
*
weight
);
void
THCCIntGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaIntTensor
*
weight
);
void
THCCLongGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaLongTensor
*
weight
);
void
THCCHalfGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaHalfTensor
*
weight
);
void
THCCFloatGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaTensor
*
weight
);
void
THCCDoubleGreedy
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCudaDoubleTensor
*
weight
);
aten/THCC/THCCGrid.c
View file @
bebd72f3
#include <THC/THC.h>
#include <THC/THC.h>
#include "THC
Grid
.h"
#include "THC.h"
#define THCCGrid_ TH_CONCAT_3(THCC,Real,Grid)
#define THCCTensor_(NAME) TH_CONCAT_4(THCC,Real,Tensor_,NAME)
#define THCGrid_ TH_CONCAT_3(TH,CReal,Grid)
extern
THCState
*
state
;
extern
THCState
*
state
;
...
...
aten/THCC/THCCGrid.h
View file @
bebd72f3
void
THCCByte
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaByteTensor
*
pos
,
THCudaByteTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCByte
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaByteTensor
*
pos
,
THCudaByteTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCChar
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaCharTensor
*
pos
,
THCudaCharTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCChar
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaCharTensor
*
pos
,
THCudaCharTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCShort
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaShortTensor
*
pos
,
THCudaShortTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCShort
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaShortTensor
*
pos
,
THCudaShortTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCInt
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaIntTensor
*
pos
,
THCudaIntTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCInt
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaIntTensor
*
pos
,
THCudaIntTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCLong
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
pos
,
THCudaLongTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCLong
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
pos
,
THCudaLongTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCHalf
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaHalfTensor
*
pos
,
THCudaHalfTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCHalf
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaHalfTensor
*
pos
,
THCudaHalfTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCFloat
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaTensor
*
pos
,
THCudaTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCFloat
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaTensor
*
pos
,
THCudaTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCDouble
G
rid
(
THCudaLongTensor
*
cluster
,
THCudaDoubleTensor
*
pos
,
THCudaDoubleTensor
*
size
,
THCudaLongTensor
*
count
);
void
THCCDouble
Tensor_g
rid
(
THCudaLongTensor
*
self
,
THCudaDoubleTensor
*
pos
,
THCudaDoubleTensor
*
size
,
THCudaLongTensor
*
count
);
aten/THCC/generic/THCCGraclus.c
0 → 100644
View file @
bebd72f3
#ifndef THC_GENERIC_FILE
#define THC_GENERIC_FILE "generic/THCCGraclus.c"
#else
void
THCCTensor_
(
graclus
)(
THCudaLongTensor
*
self
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCTensor
*
weight
)
{
THCTensor_
(
graclus
)(
state
,
self
,
row
,
col
,
weight
);
}
#endif
aten/THCC/generic/THCCGreedy.c
deleted
100644 → 0
View file @
78342c6a
#ifndef THC_GENERIC_FILE
#define THC_GENERIC_FILE "generic/THCCGreedy.c"
#else
void
THCCGreedy_
(
THCudaLongTensor
*
cluster
,
THCudaLongTensor
*
row
,
THCudaLongTensor
*
col
,
THCTensor
*
weight
)
{
THCGreedy_
(
state
,
cluster
,
row
,
col
,
weight
);
}
#endif
aten/THCC/generic/THCCGrid.c
View file @
bebd72f3
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
#define THC_GENERIC_FILE "generic/THCCGrid.c"
#define THC_GENERIC_FILE "generic/THCCGrid.c"
#else
#else
void
THCC
G
rid
_
(
THCudaLongTensor
*
cluster
,
THCTensor
*
pos
,
THCTensor
*
size
,
void
THCC
Tensor_
(
g
rid
)
(
THCudaLongTensor
*
self
,
THCTensor
*
pos
,
THCTensor
*
size
,
THCudaLongTensor
*
count
)
{
THCudaLongTensor
*
count
)
{
THC
G
rid
_
(
state
,
cluster
,
pos
,
size
,
count
);
THC
Tensor_
(
g
rid
)
(
state
,
self
,
pos
,
size
,
count
);
}
}
#endif
#endif
...
...
benchmark/ffi.py
View file @
bebd72f3
import
time
import
torch
import
torch
from
torch_cluster._ext
import
ffi
from
torch_cluster._ext
import
ffi
cluster
=
torch
.
cuda
.
LongTensor
(
5
)
cluster
=
torch
.
cuda
.
LongTensor
(
4
)
pos
=
torch
.
cuda
.
Float
Tensor
([
[
1
,
1
],
[
3
,
3
]
,
[
1
,
1
],
[
5
,
5
]
,
[
3
,
3
]
]
)
row
=
torch
.
cuda
.
Long
Tensor
([
0
,
0
,
1
,
1
,
1
,
2
,
2
,
2
,
3
,
3
])
size
=
torch
.
cuda
.
Float
Tensor
([
2
,
2
])
col
=
torch
.
cuda
.
Long
Tensor
([
1
,
2
,
0
,
2
,
3
,
0
,
1
,
3
,
1
,
2
])
count
=
torch
.
cuda
.
LongTensor
([
3
,
3
])
# deg
= torch.cuda.LongTensor([
2,
3, 3
, 2
])
func
=
ffi
.
THCC
FloatGrid
func
=
ffi
.
THCC
Greedy
print
(
func
)
print
(
func
)
func
(
cluster
,
pos
,
size
,
count
)
a
=
0
torch
.
cuda
.
synchronize
()
t
=
time
.
perf_counter
()
# for i in range(100):
func
(
cluster
,
row
,
col
)
# a += cluster.sum() / cluster.size(0)
torch
.
cuda
.
synchronize
()
print
(
time
.
perf_counter
()
-
t
)
print
(
cluster
)
print
(
cluster
)
build.py
View file @
bebd72f3
...
@@ -17,15 +17,15 @@ define_macros = []
...
@@ -17,15 +17,15 @@ define_macros = []
extra_objects
=
[]
extra_objects
=
[]
with_cuda
=
False
with_cuda
=
False
if
torch
.
cuda
.
is_available
():
#
if torch.cuda.is_available():
subprocess
.
call
([
'./build_new.sh'
,
osp
.
dirname
(
torch
.
__file__
)])
#
subprocess.call(['./build_new.sh', osp.dirname(torch.__file__)])
headers
+=
[
'aten/THCC/THCC{}.h'
.
format
(
f
)
for
f
in
files
]
#
headers += ['aten/THCC/THCC{}.h'.format(f) for f in files]
sources
+=
[
'aten/THCC/THCC{}.c'
.
format
(
f
)
for
f
in
files
]
#
sources += ['aten/THCC/THCC{}.c'.format(f) for f in files]
include_dirs
+=
[
'aten/THC'
,
'aten/THCC'
]
#
include_dirs += ['aten/THC', 'aten/THCC']
define_macros
+=
[(
'WITH_CUDA'
,
None
)]
#
define_macros += [('WITH_CUDA', None)]
extra_objects
+=
[
'aten/build/THC.so'
]
#
extra_objects += ['aten/build/THC.so']
with_cuda
=
True
#
with_cuda = True
ffi
=
create_extension
(
ffi
=
create_extension
(
name
=
'torch_cluster._ext.ffi'
,
name
=
'torch_cluster._ext.ffi'
,
...
...
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