Commit 77728ba9 authored by rusty1s's avatar rusty1s
Browse files

pass torch path

parent 6e1243b3
import sys import os.path as osp
import os
import shutil import shutil
import subprocess import subprocess
import torch import torch
from torch.utils.ffi import create_extension from torch.utils.ffi import create_extension
if os.path.exists('build'): if osp.exists('build'):
shutil.rmtree('build') shutil.rmtree('build')
headers = ['torch_spline_conv/src/cpu.h'] headers = ['torch_spline_conv/src/cpu.h']
...@@ -17,7 +16,7 @@ extra_objects = [] ...@@ -17,7 +16,7 @@ extra_objects = []
with_cuda = False with_cuda = False
if torch.cuda.is_available(): if torch.cuda.is_available():
subprocess.call('./build.sh {}'.format(sys.executable)) subprocess.call('./build.sh {}'.format(osp.dirname(torch.__file__)))
headers += ['torch_spline_conv/src/cuda.h'] headers += ['torch_spline_conv/src/cuda.h']
sources += ['torch_spline_conv/src/cuda.c'] sources += ['torch_spline_conv/src/cuda.c']
......
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
echo "Compiling kernel..." echo "Compiling kernel..."
PYTHON=${1:-python}
TORCH=$($PYTHON -c "import os; import torch; print(os.path.dirname(torch.__file__))")
SRC_DIR=torch_spline_conv/kernel SRC_DIR=torch_spline_conv/kernel
BUILD_DIR=torch_spline_conv/build BUILD_DIR=torch_spline_conv/build
mkdir -p $BUILD_DIR mkdir -p "$BUILD_DIR"
$(which nvcc) -c -o $BUILD_DIR/kernel.so $SRC_DIR/kernel.cu -arch=sm_35 -Xcompiler -fPIC -shared -I$TORCH/lib/include/TH -I$TORCH/lib/include/THC -I$SRC_DIR $(which nvcc) -c -o "$BUILD_DIR/kernel.so" "$SRC_DIR/kernel.cu" -arch=sm_35 -Xcompiler -fPIC -shared "-I$1/lib/include/TH" "-I$1/lib/include/THC" "-I$SRC_DIR"
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