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
ae1fce51
Unverified
Commit
ae1fce51
authored
Mar 21, 2022
by
Matthias Fey
Committed by
GitHub
Mar 21, 2022
Browse files
cmake fixes (#278)
parent
e60840dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
csrc/scatter.h
csrc/scatter.h
+17
-1
csrc/version.cpp
csrc/version.cpp
+5
-3
No files found.
csrc/scatter.h
View file @
ae1fce51
...
@@ -2,7 +2,23 @@
...
@@ -2,7 +2,23 @@
#include <torch/extension.h>
#include <torch/extension.h>
int64_t
cuda_version
();
#if (defined __cpp_inline_variables) || __cplusplus >= 201703L
#define SCATTER_INLINE_VARIABLE inline
#else
#ifdef _MSC_VER
#define SCATTER_INLINE_VARIABLE __declspec(selectany)
#else
#define SCATTER_INLINE_VARIABLE __attribute__((weak))
#endif
#endif
namespace
scatter
{
int64_t
cuda_version
()
noexcept
;
namespace
detail
{
SCATTER_INLINE_VARIABLE
int64_t
_cuda_version
=
cuda_version
();
}
// namespace detail
}
// namespace scatter
torch
::
Tensor
scatter_sum
(
torch
::
Tensor
src
,
torch
::
Tensor
index
,
int64_t
dim
,
torch
::
Tensor
scatter_sum
(
torch
::
Tensor
src
,
torch
::
Tensor
index
,
int64_t
dim
,
torch
::
optional
<
torch
::
Tensor
>
optional_out
,
torch
::
optional
<
torch
::
Tensor
>
optional_out
,
...
...
csrc/version.cpp
View file @
ae1fce51
...
@@ -13,13 +13,15 @@ PyMODINIT_FUNC PyInit__version_cpu(void) { return NULL; }
...
@@ -13,13 +13,15 @@ PyMODINIT_FUNC PyInit__version_cpu(void) { return NULL; }
#endif
#endif
#endif
#endif
int64_t
cuda_version
()
{
namespace
scatter
{
int64_t
cuda_version
()
noexcept
{
#ifdef WITH_CUDA
#ifdef WITH_CUDA
return
CUDA_VERSION
;
return
CUDA_VERSION
;
#else
#else
return
-
1
;
return
-
1
;
#endif
#endif
}
}
}
// namespace scatter
static
auto
registry
=
static
auto
registry
=
torch
::
RegisterOperators
().
op
(
torch
::
RegisterOperators
().
op
(
"torch_scatter::cuda_version"
,
&
cuda_version
);
"torch_scatter::cuda_version"
,
&
scatter
::
cuda_version
);
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