From 9268ac0baec205ea087b1dc89c5853fce89c1e47 Mon Sep 17 00:00:00 2001 From: irfan798 Date: Sat, 16 May 2020 19:35:52 +0300 Subject: [PATCH] tf_ops compile scripts for Tensorflow 1.15.0 - Ubuntu 18.04 - CUDA 10.2 --- tf_ops/3d_interpolation/tf_interpolate_compile.sh | 8 +++++++- tf_ops/grouping/tf_grouping_compile.sh | 11 +++++++++-- tf_ops/sampling/tf_sampling_compile.sh | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/tf_ops/3d_interpolation/tf_interpolate_compile.sh b/tf_ops/3d_interpolation/tf_interpolate_compile.sh index 34c9fdac..3a516ae2 100644 --- a/tf_ops/3d_interpolation/tf_interpolate_compile.sh +++ b/tf_ops/3d_interpolation/tf_interpolate_compile.sh @@ -1,5 +1,11 @@ +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())') + # TF1.2 -g++ -std=c++11 tf_interpolate.cpp -o tf_interpolate_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 +#g++ -std=c++11 tf_interpolate.cpp -o tf_interpolate_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 # TF1.4 #g++ -std=c++11 tf_interpolate.cpp -o tf_interpolate_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -I /usr/local/lib/python2.7/dist-packages/tensorflow/include/external/nsync/public -lcudart -L /usr/local/cuda-8.0/lib64/ -L/usr/local/lib/python2.7/dist-packages/tensorflow -ltensorflow_framework -O2 -D_GLIBCXX_USE_CXX11_ABI=0 + +# TF1.15 +g++ -std=c++11 tf_interpolate.cpp -o tf_interpolate_so.so -shared -fPIC -I $TF_INC -I /usr/local/cuda/include -I $TF_INC/external/nsync/public -lcudart -L /usr/local/cuda/lib64/ -L$TF_LIB -ltensorflow_framework #-O2 -D_GLIBCXX_USE_CXX11_ABI=1 diff --git a/tf_ops/grouping/tf_grouping_compile.sh b/tf_ops/grouping/tf_grouping_compile.sh index b193367d..e2c276d7 100644 --- a/tf_ops/grouping/tf_grouping_compile.sh +++ b/tf_ops/grouping/tf_grouping_compile.sh @@ -1,8 +1,15 @@ #/bin/bash -/usr/local/cuda-8.0/bin/nvcc tf_grouping_g.cu -o tf_grouping_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC +#/usr/local/cuda-8.0/bin/nvcc tf_grouping_g.cu -o tf_grouping_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC +/usr/local/cuda/bin/nvcc tf_grouping_g.cu -o tf_grouping_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC + +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())') # TF1.2 -g++ -std=c++11 tf_grouping.cpp tf_grouping_g.cu.o -o tf_grouping_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 +# g++ -std=c++11 tf_grouping.cpp tf_grouping_g.cu.o -o tf_grouping_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 # TF1.4 #g++ -std=c++11 tf_grouping.cpp tf_grouping_g.cu.o -o tf_grouping_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -I /usr/local/lib/python2.7/dist-packages/tensorflow/include/external/nsync/public -lcudart -L /usr/local/cuda-8.0/lib64/ -L/usr/local/lib/python2.7/dist-packages/tensorflow -ltensorflow_framework -O2 -D_GLIBCXX_USE_CXX11_ABI=0 + +# TF1.15 +g++ -std=c++11 tf_grouping.cpp tf_grouping_g.cu.o -o tf_grouping_so.so -shared -fPIC -I $TF_INC -I /usr/local/cuda/include -I $TF_INC/external/nsync/public -lcudart -L /usr/local/cuda/lib64/ -L$TF_LIB -ltensorflow_framework #-O2 -D_GLIBCXX_USE_CXX11_ABI=1 diff --git a/tf_ops/sampling/tf_sampling_compile.sh b/tf_ops/sampling/tf_sampling_compile.sh index ed903f04..67474035 100644 --- a/tf_ops/sampling/tf_sampling_compile.sh +++ b/tf_ops/sampling/tf_sampling_compile.sh @@ -1,8 +1,18 @@ #/bin/bash -/usr/local/cuda-8.0/bin/nvcc tf_sampling_g.cu -o tf_sampling_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC +#/usr/local/cuda-8.0/bin/nvcc tf_sampling_g.cu -o tf_sampling_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC +/usr/local/cuda/bin/nvcc tf_sampling_g.cu -o tf_sampling_g.cu.o -c -O2 -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC + +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())') + +#/home/vcortex/anaconda3/envs/tensorflow/lib/python3.7/site-packages/tensorflow_core/libtensorflow_framework.so.1 +# sudo ln -s libtensorflow_framework.so.1 libtensorflow_framework.so # TF1.2 -g++ -std=c++11 tf_sampling.cpp tf_sampling_g.cu.o -o tf_sampling_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 +#g++ -std=c++11 tf_sampling.cpp tf_sampling_g.cu.o -o tf_sampling_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 # TF1.4 #g++ -std=c++11 tf_sampling.cpp tf_sampling_g.cu.o -o tf_sampling_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -I /usr/local/lib/python2.7/dist-packages/tensorflow/include/external/nsync/public -lcudart -L /usr/local/cuda-8.0/lib64/ -L/usr/local/lib/python2.7/dist-packages/tensorflow -ltensorflow_framework -O2 -D_GLIBCXX_USE_CXX11_ABI=0 + +# TF1.15 +g++ -std=c++11 tf_sampling.cpp tf_sampling_g.cu.o -o tf_sampling_so.so -shared -fPIC -I $TF_INC -I /usr/local/cuda/include -I $TF_INC/external/nsync/public -lcudart -L /usr/local/cuda/lib64/ -L$TF_LIB -ltensorflow_framework #-O2 -D_GLIBCXX_USE_CXX11_ABI=1