Commit 89f69c8d authored by rusty1s's avatar rusty1s
Browse files

fixed kernel build

parent c483a663
import os import os.path as osp
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_cluster/src/cpu.h'] headers = ['torch_cluster/src/cpu.h']
...@@ -16,7 +16,7 @@ extra_objects = [] ...@@ -16,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') subprocess.call(['./build.sh', osp.dirname(torch.__file__)])
headers += ['torch_cluster/src/cuda.h'] headers += ['torch_cluster/src/cuda.h']
sources += ['torch_cluster/src/cuda.c'] sources += ['torch_cluster/src/cuda.c']
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
echo "Compiling kernel..." echo "Compiling kernel..."
TORCH=$(python -c "import os; import torch; print(os.path.dirname(torch.__file__))") if [ -z "$1" ]; then TORCH=$(python -c "import os; import torch; print(os.path.dirname(torch.__file__))"); else TORCH="$1"; fi
SRC_DIR=torch_cluster/kernel SRC_DIR=torch_cluster/kernel
BUILD_DIR=torch_cluster/build BUILD_DIR=torch_cluster/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