指路:
运行latent_3d_points的train_single_class_ae.ipynb
其中重点:
先确定自己的tensorflow路径
新建find.py文件:vim find.py
find.py文件内容:
from __future__ import print_function
import tensorflow as tf
print(tf.sysconfig.get_compile_flags(),'\n')
print(tf.sysconfig.get_link_flags())
输出结果:
['-I/home/xxj/.local/lib/python2.7/site-packages/tensorflow/include', '-D_GLIBCXX_USE_CXX11_ABI=0']
['-L/home/xxj/.local/lib/python2.7/site-packages/tensorflow', '-l:libtensorflow_framework.so.1']
4.根据上个步骤的输出结果,修改makefile文件,-I之后的内容为TF_INC,-L之后的内容为TF_LIB。
注意makefile中的D_GLIBCXX_USE_CXX11_ABI等于0还是1,以及-l:libtensorflow_framework.so.1,这两部分都需对应自己上一步的输出。
nvcc=/usr/local/cuda-8.0/bin/nvcc
cudalib=/usr/local/cuda-8.0/lib64
nsync=/home/xxj/.local/lib/python2.7/site-packages/tensorflow/include/external/nsync/public
TF_INC=/home/xxj/.local/lib/python2.7/site-packages/tensorflow/include
TF_LIB=/home/xxj/.local/lib/python2.7/site-packages/tensorflow
all: tf_approxmatch_so.so tf_approxmatch_g.cu.o tf_nndistance_so.so tf_nndistance_g.cu.o
tf_approxmatch_so.so: tf_approxmatch_g.cu.o tf_approxmatch.cp
g++ -std=c++11 tf_approxmatch.cpp tf_approxmatch_g.cu.o -o tf_approxmatch_so.so -shared -fPIC -I $(TF_INC) -I $(nsync) -lcudart -L $(cudalib) -L $(TF_LIB) -l:libtensorflow_framework.so.1 -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_approxmatch_g.cu.o: tf_approxmatch_g.cu
$(nvcc) -std=c++11 -c -o tf_approxmatch_g.cu.o tf_approxmatch_g.cu -I $(TF_INC) -I $(nsync) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_nndistance_so.so: tf_nndistance_g.cu.o tf_nndistance.cpp
g++ -std=c++11 tf_nndistance.cpp tf_nndistance_g.cu.o -o tf_nndistance_so.so -shared -fPIC -I $(TF_INC) -I $(nsync) -lcudart -L $(cudalib) -L $(TF_LIB) -l:libtensorflow_framework.so.1 -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_nndistance_g.cu.o: tf_nndistance_g.cu
$(nvcc) -std=c++11 -c -o tf_nndistance_g.cu.o tf_nndistance_g.cu -I $(TF_INC) -I $(nsync) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2 -D_GLIBCXX_USE_CXX11_ABI=0
clean:
rm tf_approxmatch_so.so
rm tf_nndistance_so.so
rm *.cu.o
————————————————
版权声明:本文为优快云博主「谦虚的海绵」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/qq_25436597/article/details/102708842
我的是这样:
nvcc = /usr/local/cuda-8.0/bin/nvcc
cudalib = /usr/local/cuda-8.0/lib64
nsync = /home/y/.local/lib/python2.7/site-packages/tensorflow/include/external
TF_INC=/home/y/.local/lib/python2.7/site-packages/tensorflow/include
TF_LIB=/home/y/.local/lib/python2.7/site-packages/tensorflow
all: tf_approxmatch_so.so tf_approxmatch_g.cu.o tf_nndistance_so.so tf_nndistance_g.cu.o
tf_approxmatch_so.so: tf_approxmatch_g.cu.o tf_approxmatch.cpp
g++ -std=c++11 tf_approxmatch.cpp tf_approxmatch_g.cu.o -o tf_approxmatch_so.so -shared -fPIC -I $(TF_INC) -I $(nsync) -lcudart -L $(cudalib) -L $(TF_LIB) -ltensorflow_framework -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_approxmatch_g.cu.o: tf_approxmatch_g.cu
$(nvcc) -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -o tf_approxmatch_g.cu.o tf_approxmatch_g.cu -I $(TF_INC) -I $(nsync) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2
tf_nndistance_so.so: tf_nndistance_g.cu.o tf_nndistance.cpp
g++ -std=c++11 tf_nndistance.cpp tf_nndistance_g.cu.o -o tf_nndistance_so.so -shared -fPIC -I $(TF_INC) -I $(nsync) -lcudart -L $(cudalib) -L $(TF_LIB) -ltensorflow_framework -O2 -D_GLIBCXX_USE_CXX11_ABI=0
tf_nndistance_g.cu.o: tf_nndistance_g.cu
$(nvcc) -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -o tf_nndistance_g.cu.o tf_nndistance_g.cu -I $(TF_INC) -I $(nsync) -DGOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -O2
clean:
rm tf_approxmatch_so.so
rm tf_nndistance_so.so
rm *.cu.o
makefile文件在Latent/external/structural_losses/makefile这个路径下面