Commit 8e7c4346 authored by traveller59's avatar traveller59
Browse files

build torch jit don't need libtorch? remove it.

parent ca8ef7c0
...@@ -22,7 +22,7 @@ endif() ...@@ -22,7 +22,7 @@ endif()
find_package(Torch REQUIRED) find_package(Torch REQUIRED)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) # add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
add_compile_definitions(SPCONV_CUDA) add_compile_definitions(SPCONV_CUDA)
add_subdirectory(third_party/pybind11) add_subdirectory(third_party/pybind11)
......
...@@ -6,19 +6,17 @@ If you need more kinds of spatial layers such as avg pool, please implement it b ...@@ -6,19 +6,17 @@ If you need more kinds of spatial layers such as avg pool, please implement it b
The GPU Indice Generation algorithm is a unofficial implementation of paper [SECOND](http://www.mdpi.com/1424-8220/18/10/3337). That algorithm (don't include GPU SubM indice generation algorithm) may be protected by patent. The GPU Indice Generation algorithm is a unofficial implementation of paper [SECOND](http://www.mdpi.com/1424-8220/18/10/3337). That algorithm (don't include GPU SubM indice generation algorithm) may be protected by patent.
This project only support CUDA 9.0+. If you are using cuda 8.0, please update it to 9.0.
## Install ## Install
0. Use ```git clone xxx.git --recursive``` to clone this repo. 0. Use ```git clone xxx.git --recursive``` to clone this repo.
1. Download stable LibTorch from pytorch [website](https://pytorch.org/). 1. Install boost headers to your system include path, you can use either ```sudo apt-get install libboostall-dev``` or download compressed files from boost official website and copy headers to include path.
2. Set an environment variable ```LIBTORCH_ROOT``` to the root path of LibTorch.
3. Install boost headers to your system include path, you can use either ```sudo apt-get install libboostall-dev``` or download compressed files from boost official website and copy headers to include path.
4. Download cmake >= 3.13.2, then add cmake executables to PATH. 2. Download cmake >= 3.13.2, then add cmake executables to PATH.
5. run ```python setup.py install```. 3. Ensure you have install pytorch 1.0 in your environment, run ```python setup.py install```.
## Compare with SparseConvNet ## Compare with SparseConvNet
......
...@@ -3,13 +3,17 @@ import re ...@@ -3,13 +3,17 @@ import re
import sys import sys
import platform import platform
import subprocess import subprocess
import torch
from setuptools import setup, Extension, find_packages from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion from distutils.version import LooseVersion
if 'LIBTORCH_ROOT' not in os.environ: from pathlib import Path
raise ValueError("You must set LIBTORCH_ROOT to your torch c++ library.")
# if 'LIBTORCH_ROOT' not in os.environ:
# raise ValueError("You must set LIBTORCH_ROOT to your torch c++ library.")
LIBTORCH_ROOT = str(Path(torch.__file__).parent)
PYTHON_VERSION = "{}.{}".format(sys.version_info.major, sys.version_info.minor) PYTHON_VERSION = "{}.{}".format(sys.version_info.major, sys.version_info.minor)
...@@ -38,7 +42,7 @@ class CMakeBuild(build_ext): ...@@ -38,7 +42,7 @@ class CMakeBuild(build_ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
print(extdir) print(extdir)
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir + "/spconv", cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir + "/spconv",
'-DCMAKE_PREFIX_PATH=' + os.environ["LIBTORCH_ROOT"], '-DCMAKE_PREFIX_PATH=' + LIBTORCH_ROOT,
'-DPYBIND11_PYTHON_VERSION={}'.format(PYTHON_VERSION), '-DPYBIND11_PYTHON_VERSION={}'.format(PYTHON_VERSION),
'-DSPCONV_BuildTests=OFF', '-DSPCONV_BuildTests=OFF',
'-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr"'] '-DCMAKE_CUDA_FLAGS="--expt-relaxed-constexpr"']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment