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
c77ed131
"src/diffusers/schedulers/scheduling_ddpm_flax.py" did not exist on "ad9d252596c33ce80275a866d970dd4242fd56f0"
Unverified
Commit
c77ed131
authored
Jul 23, 2022
by
Gerico Vidanes
Committed by
GitHub
Jul 23, 2022
Browse files
add capability to optionally include python during compile (#136)
parent
113e8a6a
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
48 additions
and
7 deletions
+48
-7
CMakeLists.txt
CMakeLists.txt
+9
-2
csrc/cluster.h
csrc/cluster.h
+1
-3
csrc/extensions.h
csrc/extensions.h
+1
-1
csrc/fps.cpp
csrc/fps.cpp
+4
-0
csrc/graclus.cpp
csrc/graclus.cpp
+4
-0
csrc/grid.cpp
csrc/grid.cpp
+4
-0
csrc/knn.cpp
csrc/knn.cpp
+4
-0
csrc/nearest.cpp
csrc/nearest.cpp
+4
-0
csrc/radius.cpp
csrc/radius.cpp
+4
-0
csrc/rw.cpp
csrc/rw.cpp
+4
-0
csrc/sampler.cpp
csrc/sampler.cpp
+4
-0
csrc/version.cpp
csrc/version.cpp
+4
-0
setup.py
setup.py
+1
-1
No files found.
CMakeLists.txt
View file @
c77ed131
...
@@ -4,6 +4,7 @@ set(CMAKE_CXX_STANDARD 14)
...
@@ -4,6 +4,7 @@ set(CMAKE_CXX_STANDARD 14)
set
(
TORCHCLUSTER_VERSION 1.6.0
)
set
(
TORCHCLUSTER_VERSION 1.6.0
)
option
(
WITH_CUDA
"Enable CUDA support"
OFF
)
option
(
WITH_CUDA
"Enable CUDA support"
OFF
)
option
(
WITH_PYTHON
"Link to Python when building"
ON
)
if
(
WITH_CUDA
)
if
(
WITH_CUDA
)
enable_language
(
CUDA
)
enable_language
(
CUDA
)
...
@@ -12,7 +13,10 @@ if(WITH_CUDA)
...
@@ -12,7 +13,10 @@ if(WITH_CUDA)
set
(
CMAKE_CUDA_FLAGS
"
${
CMAKE_CUDA_FLAGS
}
--expt-relaxed-constexpr"
)
set
(
CMAKE_CUDA_FLAGS
"
${
CMAKE_CUDA_FLAGS
}
--expt-relaxed-constexpr"
)
endif
()
endif
()
find_package
(
Python3 COMPONENTS Development
)
if
(
WITH_PYTHON
)
add_definitions
(
-DWITH_PYTHON
)
find_package
(
Python3 COMPONENTS Development
)
endif
()
find_package
(
Torch REQUIRED
)
find_package
(
Torch REQUIRED
)
file
(
GLOB HEADERS csrc/*.h
)
file
(
GLOB HEADERS csrc/*.h
)
...
@@ -22,7 +26,10 @@ if(WITH_CUDA)
...
@@ -22,7 +26,10 @@ if(WITH_CUDA)
endif
()
endif
()
add_library
(
${
PROJECT_NAME
}
SHARED
${
OPERATOR_SOURCES
}
)
add_library
(
${
PROJECT_NAME
}
SHARED
${
OPERATOR_SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE
${
TORCH_LIBRARIES
}
Python3::Python
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE
${
TORCH_LIBRARIES
}
)
if
(
WITH_PYTHON
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE Python3::Python
)
endif
()
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES EXPORT_NAME TorchCluster
)
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES EXPORT_NAME TorchCluster
)
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE
...
...
csrc/cluster.h
View file @
c77ed131
#pragma once
#pragma once
#include <torch/extension.h>
#include "extensions.h"
#include "macros.h"
namespace
cluster
{
namespace
cluster
{
CLUSTER_API
int64_t
cuda_version
()
noexcept
;
CLUSTER_API
int64_t
cuda_version
()
noexcept
;
...
...
csrc/extensions.h
View file @
c77ed131
#include "macros.h"
#include "macros.h"
#include <torch/
extension
.h>
#include <torch/
torch
.h>
csrc/fps.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/fps_cpu.h"
#include "cpu/fps_cpu.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__fps_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__fps_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__fps_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__fps_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
fps
(
torch
::
Tensor
src
,
torch
::
Tensor
ptr
,
torch
::
Tensor
ratio
,
CLUSTER_API
torch
::
Tensor
fps
(
torch
::
Tensor
src
,
torch
::
Tensor
ptr
,
torch
::
Tensor
ratio
,
bool
random_start
)
{
bool
random_start
)
{
...
...
csrc/graclus.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/graclus_cpu.h"
#include "cpu/graclus_cpu.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__graclus_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__graclus_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__graclus_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__graclus_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
graclus
(
torch
::
Tensor
rowptr
,
torch
::
Tensor
col
,
CLUSTER_API
torch
::
Tensor
graclus
(
torch
::
Tensor
rowptr
,
torch
::
Tensor
col
,
torch
::
optional
<
torch
::
Tensor
>
optional_weight
)
{
torch
::
optional
<
torch
::
Tensor
>
optional_weight
)
{
...
...
csrc/grid.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/grid_cpu.h"
#include "cpu/grid_cpu.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__grid_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__grid_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__grid_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__grid_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
grid
(
torch
::
Tensor
pos
,
torch
::
Tensor
size
,
CLUSTER_API
torch
::
Tensor
grid
(
torch
::
Tensor
pos
,
torch
::
Tensor
size
,
torch
::
optional
<
torch
::
Tensor
>
optional_start
,
torch
::
optional
<
torch
::
Tensor
>
optional_start
,
...
...
csrc/knn.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/knn_cpu.h"
#include "cpu/knn_cpu.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__knn_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__knn_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__knn_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__knn_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
knn
(
torch
::
Tensor
x
,
torch
::
Tensor
y
,
CLUSTER_API
torch
::
Tensor
knn
(
torch
::
Tensor
x
,
torch
::
Tensor
y
,
torch
::
optional
<
torch
::
Tensor
>
ptr_x
,
torch
::
optional
<
torch
::
Tensor
>
ptr_x
,
...
...
csrc/nearest.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "extensions.h"
#include "extensions.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__nearest_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__nearest_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__nearest_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__nearest_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
nearest
(
torch
::
Tensor
x
,
torch
::
Tensor
y
,
torch
::
Tensor
ptr_x
,
CLUSTER_API
torch
::
Tensor
nearest
(
torch
::
Tensor
x
,
torch
::
Tensor
y
,
torch
::
Tensor
ptr_x
,
torch
::
Tensor
ptr_y
)
{
torch
::
Tensor
ptr_y
)
{
...
...
csrc/radius.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/radius_cpu.h"
#include "cpu/radius_cpu.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__radius_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__radius_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__radius_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__radius_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
radius
(
torch
::
Tensor
x
,
torch
::
Tensor
y
,
CLUSTER_API
torch
::
Tensor
radius
(
torch
::
Tensor
x
,
torch
::
Tensor
y
,
torch
::
optional
<
torch
::
Tensor
>
ptr_x
,
torch
::
optional
<
torch
::
Tensor
>
ptr_x
,
...
...
csrc/rw.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/rw_cpu.h"
#include "cpu/rw_cpu.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__rw_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__rw_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__rw_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__rw_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
std
::
tuple
<
torch
::
Tensor
,
torch
::
Tensor
>
CLUSTER_API
std
::
tuple
<
torch
::
Tensor
,
torch
::
Tensor
>
random_walk
(
torch
::
Tensor
rowptr
,
torch
::
Tensor
col
,
torch
::
Tensor
start
,
random_walk
(
torch
::
Tensor
rowptr
,
torch
::
Tensor
col
,
torch
::
Tensor
start
,
...
...
csrc/sampler.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cpu/sampler_cpu.h"
#include "cpu/sampler_cpu.h"
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__sampler_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__sampler_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__sampler_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__sampler_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
CLUSTER_API
torch
::
Tensor
neighbor_sampler
(
torch
::
Tensor
start
,
torch
::
Tensor
rowptr
,
CLUSTER_API
torch
::
Tensor
neighbor_sampler
(
torch
::
Tensor
start
,
torch
::
Tensor
rowptr
,
int64_t
count
,
double
factor
)
{
int64_t
count
,
double
factor
)
{
...
...
csrc/version.cpp
View file @
c77ed131
#ifdef WITH_PYTHON
#include <Python.h>
#include <Python.h>
#endif
#include <torch/script.h>
#include <torch/script.h>
#include "cluster.h"
#include "cluster.h"
#include "macros.h"
#include "macros.h"
...
@@ -8,12 +10,14 @@
...
@@ -8,12 +10,14 @@
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#ifdef WITH_PYTHON
#ifdef WITH_CUDA
#ifdef WITH_CUDA
PyMODINIT_FUNC
PyInit__version_cuda
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__version_cuda
(
void
)
{
return
NULL
;
}
#else
#else
PyMODINIT_FUNC
PyInit__version_cpu
(
void
)
{
return
NULL
;
}
PyMODINIT_FUNC
PyInit__version_cpu
(
void
)
{
return
NULL
;
}
#endif
#endif
#endif
#endif
#endif
namespace
cluster
{
namespace
cluster
{
...
...
setup.py
View file @
c77ed131
...
@@ -33,7 +33,7 @@ def get_extensions():
...
@@ -33,7 +33,7 @@ def get_extensions():
main_files
=
glob
.
glob
(
osp
.
join
(
extensions_dir
,
'*.cpp'
))
main_files
=
glob
.
glob
(
osp
.
join
(
extensions_dir
,
'*.cpp'
))
for
main
,
suffix
in
product
(
main_files
,
suffices
):
for
main
,
suffix
in
product
(
main_files
,
suffices
):
define_macros
=
[]
define_macros
=
[
(
'WITH_PYTHON'
,
None
)
]
if
sys
.
platform
==
'win32'
:
if
sys
.
platform
==
'win32'
:
define_macros
+=
[(
'torchcluster_EXPORTS'
,
None
)]
define_macros
+=
[(
'torchcluster_EXPORTS'
,
None
)]
...
...
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