Skip to content

Instantly share code, notes, and snippets.

@walsvid
Last active September 7, 2018 06:22
Show Gist options
  • Save walsvid/960d54d350182c8524947e201d0da101 to your computer and use it in GitHub Desktop.
Save walsvid/960d54d350182c8524947e201d0da101 to your computer and use it in GitHub Desktop.
build tf op
#!/usr/bin/env bash
cd ../lib/nndistance
CUDA_ROOT=/home/wc/lib/cuda
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
nvcc -std=c++11 -c -o tf_nndistance_g.cu.o tf_nndistance_g.cu \
-I $TF_INC -I$TF_INC/external/nsync/public -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
g++ -std=c++11 -shared -o tf_nndistance_so.so tf_nndistance.cpp \
tf_nndistance_g.cu.o -I $TF_INC -I${CUDA_ROOT}/include -I$TF_INC/external/nsync/public -fPIC -L${CUDA_ROOT}/lib64/ -L$TF_LIB # -ltensorflow_framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment