Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyTorch custom operators for graph operations #9094

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmssw-tool-conf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Requires: xtensor
Requires: xtl
Requires: xgboost
Requires: pytorch
Requires: pytorch-custom-ops

## INCLUDE cmssw-vectorization
## INCLUDE cmssw-drop-tools
Expand Down
43 changes: 43 additions & 0 deletions pytorch-cluster.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
### RPM external pytorch-cluster 1.6.3
## INCLUDE compilation_flags
## INCLUDE cpp-standard
%define tag f2d99195a0003ca2d2ba9ed50d0117e2f23360e0
%define branch master
%define github_user rusty1s

Source: git+https://github.com/%{github_user}/pytorch_cluster.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz

BuildRequires: cmake
Requires: pytorch cudnn
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}

%prep
%setup -n %{n}-%{realversion}
# Make sure the default c++sdt stand is c++14
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt

%build

rm -rf ../build && mkdir ../build && cd ../build


cmake ../%{n}-%{realversion} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{i} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
-DCMAKE_CXX_FLAGS="%{build_flags}" \
-DBUILD_TEST=OFF \
-DWITH_PYTHON=OFF \
-DWITH_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_SHARED_LIBS=ON


make %{makeprocesses} VERBOSE=1

%install
cd ../build
make %{makeprocesses} install VERBOSE=1
8 changes: 8 additions & 0 deletions pytorch-custom-ops.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### RPM external pytorch-custom-ops 1.0
Source: none
Requires: pytorch-scatter
Requires: pytorch-cluster
Requires: pytorch-sparse
%prep
%build
%install
43 changes: 43 additions & 0 deletions pytorch-scatter.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
### RPM external pytorch-scatter 2.1.2
## INCLUDE compilation_flags
## INCLUDE cpp-standard
%define tag c095c62e4334fcd05e4ac3c4bb09d285960d6be6
%define branch master
%define github_user rusty1s

Source: git+https://github.com/%{github_user}/pytorch_scatter.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz

BuildRequires: cmake
Requires: pytorch cudnn
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}

%prep
%setup -n %{n}-%{realversion}
# Make sure the default c++sdt stand is c++14
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt

%build

rm -rf ../build && mkdir ../build && cd ../build


cmake ../%{n}-%{realversion} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{i} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
-DCMAKE_CXX_FLAGS="%{build_flags}" \
-DBUILD_TEST=OFF \
-DWITH_PYTHON=OFF \
-DWITH_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_SHARED_LIBS=ON


make %{makeprocesses} VERBOSE=1

%install
cd ../build
make %{makeprocesses} install VERBOSE=1
43 changes: 43 additions & 0 deletions pytorch-sparse.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
### RPM external pytorch-sparse 0.6.18
## INCLUDE compilation_flags
## INCLUDE cpp-standard
%define tag 2d559810c6af7f8b2cf88553dd5a5824a667a07d
%define branch master
%define github_user rusty1s

Source: git+https://github.com/%{github_user}/pytorch_sparse.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz

BuildRequires: cmake
Requires: pytorch cudnn
%define build_flags -Wall -Wextra -pedantic %{?arch_build_flags}

%prep
%setup -n %{n}-%{realversion}
# Make sure the default c++sdt stand is c++14
grep -q 'CMAKE_CXX_STANDARD *14' CMakeLists.txt
sed -i -e 's|CMAKE_CXX_STANDARD *14|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt

%build

rm -rf ../build && mkdir ../build && cd ../build


cmake ../%{n}-%{realversion} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{i} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
-DCMAKE_CXX_FLAGS="%{build_flags}" \
-DBUILD_TEST=OFF \
-DWITH_PYTHON=OFF \
-DWITH_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_SHARED_LIBS=ON


make %{makeprocesses} VERBOSE=1

%install
cd ../build
make %{makeprocesses} install VERBOSE=1
10 changes: 10 additions & 0 deletions scram-tools.file/tools/pytorch-cluster/pytorch-cluster.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<tool name="pytorch-cluster" version="@TOOL_VERSION@">
<client>
<environment name="PYTORCH_CLUSTER_BASE" default="@TOOL_ROOT@"/>
<environment name="INCLUDE" default="$PYTORCH_CLUSTER_BASE/include"/>
<environment name="INCLUDE" default="$PYTORCH_CLUSTER_BASE/include/torchcluster/"/>
<environment name="LIBDIR" default="$PYTORCH_CLUSTER_BASE/lib"/>
</client>
<use name="pytorch"/>
<lib name="torchcluster"/>
</tool>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<tool name="pytorch-custom-ops" version="1.0">
<use name="pytorch"/>
<use name="pytorch-scatter"/>
<use name="pytorch-cluster"/>
<use name="pytorch-sparse"/>
</tool>
10 changes: 10 additions & 0 deletions scram-tools.file/tools/pytorch-scatter/pytorch-scatter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<tool name="pytorch-scatter" version="@TOOL_VERSION@">
<client>
<environment name="PYTORCH_SCATTER_BASE" default="@TOOL_ROOT@"/>
<environment name="INCLUDE" default="$PYTORCH_SCATTER_BASE/include"/>
<environment name="INCLUDE" default="$PYTORCH_SCATTER_BASE/include/torchscatter/"/>
<environment name="LIBDIR" default="$PYTORCH_SCATTER_BASE/lib"/>
</client>
<use name="pytorch"/>
<lib name="torchscatter"/>
</tool>
10 changes: 10 additions & 0 deletions scram-tools.file/tools/pytorch-sparse/pytorch-sparse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<tool name="pytorch-sparse" version="@TOOL_VERSION@">
<client>
<environment name="PYTORCH_SPARSE_BASE" default="@TOOL_ROOT@"/>
<environment name="INCLUDE" default="$PYTORCH_SPARSE_BASE/include"/>
<environment name="INCLUDE" default="$PYTORCH_SPARSE_BASE/include/torchsparse/"/>
<environment name="LIBDIR" default="$PYTORCH_SPARSE_BASE/lib"/>
</client>
<use name="pytorch"/>
<lib name="torchsparse"/>
</tool>