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-scatter
Commits
2aa89004
Commit
2aa89004
authored
Dec 19, 2017
by
rusty1s
Browse files
first cuda kernel try
parent
5a2fc4bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
build.sh
build.sh
+8
-0
torch_scatter/kernel/generic/kernel.cu
torch_scatter/kernel/generic/kernel.cu
+29
-0
torch_scatter/kernel/kernel.cu
torch_scatter/kernel/kernel.cu
+7
-0
No files found.
build.sh
0 → 100755
View file @
2aa89004
#!/bin/sh
TORCH
=
$(
python
-c
"import os; import torch; print(os.path.dirname(torch.__file__))"
)
SRC_DIR
=
torch_scatter/kernel
BUILD_DIR
=
torch_scatter/build
mkdir
-p
$BUILD_DIR
nvcc
-c
-o
$BUILD_DIR
/kernel.so
$SRC_DIR
/kernel.cu
-Xcompiler
-fPIC
-shared
-I
$TORCH
/lib/include/TH
-I
$TORCH
/lib/include/THC
-I
$TORCH
/lib/include
-I
$SRC_DIR
torch_scatter/kernel/generic/kernel.cu
0 → 100644
View file @
2aa89004
#ifndef THC_GENERIC_FILE
#define THC_GENERIC_FILE "generic/kernel.cu"
#else
void
scatter_
(
mul
)(
THCState
*
state
,
int
dim
,
THCTensor
*
output
,
THCudaLongTensor
*
index
,
THCTensor
*
input
)
{
printf
(
"mul"
);
}
void
scatter_
(
div
)(
THCState
*
state
,
int
dim
,
THCTensor
*
output
,
THCudaLongTensor
*
index
,
THCTensor
*
input
)
{
printf
(
"div"
);
}
void
scatter_
(
mean
)(
THCState
*
state
,
int
dim
,
THCTensor
*
output
,
THCudaLongTensor
*
index
,
THCTensor
*
input
,
THCTensor
*
num_output
)
{
printf
(
"mean"
);
}
void
scatter_
(
max
)(
THCState
*
state
,
int
dim
,
THCTensor
*
output
,
THCudaLongTensor
*
index
,
THCTensor
*
input
,
THCudaLongTensor
*
arg_output
)
{
printf
(
"max"
);
}
void
scatter_
(
min
)(
THCState
*
state
,
int
dim
,
THCTensor
*
output
,
THCudaLongTensor
*
index
,
THCTensor
*
input
,
THCudaLongTensor
*
arg_output
)
{
printf
(
"min"
);
}
void
index_backward
(
THCState
*
state
,
int
dim
,
THCTensor
*
output
,
THCudaLongTensor
*
index
,
THCTensor
*
grad
,
THCudaLongTensor
*
arg_grad
)
{
printf
(
"index_backward"
);
}
#endif
torch_scatter/kernel/kernel.cu
0 → 100644
View file @
2aa89004
#include <THC/THC.h>
#define scatter_(NAME) TH_CONCAT_4(scatter_, NAME, _kernel_, Real)
#define index_backward TH_CONCAT_2(index_backward_kernel_, Real)
#include "generic/kernel.cu"
#include "THCGenerateAllTypes.h"
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