Giter VIP home page Giter VIP logo

Comments (1)

SchroeterJulien avatar SchroeterJulien commented on September 28, 2024

Hi,

While this will certainly be too late for the original author of the question, here is what worked for me (Tensorflow 1.14). Disclaimer: I mostly don't know what I am doing, so if you are a real and rigorous programmer apologies in advance. But at least the following worked for me, thus it might help others out:

  1. In Makefile, add -D_GLIBCXX_USE_CXX11_ABI=0 to each g++ command. This might already fix it for some. [1] [2]

  2. In Makefile, add -L$TF_LIB -ltensorflow_framework to each g++ command, where TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())') (this need to be added in the first lines). [3] [4] [5]. Depending on how you set things up on your computer, you might need to replace python with python3.

  3. Check manually that you have a file called libtensorflow_framework.so in $TF_LIB (see point 2. on how to obtain that path). If not, you should have a file that is almost called like it (e.g., libtensorflow_framework.so.1). In that case, you need to create a symbolic link [6]:

$ cd [$TF_LIB]
$ ln -s libtensorflow_framework.so.1 libtensorflow_framework.so
  1. In Makefile, add -lcudart -L $CUDA_PATH/lib64 to each g++ command, where CUDA_PATH=/usr/local/cuda/ (this need to be added in the first lines). To locate where cuda was installed on your machine (e.g., it might be /usr/local/cuda-10.0/) check [6]

At that point, it should be working. But if for some reason it is not, you might still try one last trick while you are at it: replace every variable containing a path (e.g., "L$TF_LIB") with a "fixed text" (e.g., -L/home/julien/.local/lib/python3.6/site-packages/tensorflow). In the end here is the version that worked for me (it is not pretty, but does the job):

TF_INC="/home/julien/.local/lib/python3.6/site-packages/tensorflow/include/" #$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB="/home/julien/.local/lib/python3.6/site-packages/tensorflow" #$(python3 -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')

.PHONY: all

all: nms_net/matching_module/det_matching.so nms_net/roi_pooling_layer/roi_pooling.so imdb/file_formats/AnnoList_pb2.py

nms_net/roi_pooling_layer/roi_pooling.so: nms_net/roi_pooling_layer/roi_pooling_op.o nms_net/roi_pooling_layer/roi_pooling_op_gpu.o
	g++ -std=c++11 -shared $^ -o $@ -fPIC -O2 -lcudart -L/usr/local/cuda-10.0/lib64 -D_GLIBCXX_USE_CXX11_ABI=0 -L/home/julien/.local/lib/python3.6/site-packages/tensorflow -ltensorflow_framework

%.o: %.cc
	g++ -std=c++11 -c $< -o $@ -fPIC -I ${TF_INC} -O2 -lcudart -L/usr/local/cuda-10.0/lib64 -D_GLIBCXX_USE_CXX11_ABI=0 -L/home/julien/.local/lib/python3.6/site-packages/tensorflow -ltensorflow_framework

%.o: %.cu
	nvcc -std=c++11 -c $< -o $@ -I ${TF_INC} -O2 -x cu -arch=sm_35 -D GOOGLE_CUDA=1 -Xcompiler -fPIC

%.so: %.cc
	g++ -std=c++11 -shared $< -o $@ -fPIC -I ${TF_INC} -O2 -lcudart -L/usr/local/cuda-10.0/lib64 -D_GLIBCXX_USE_CXX11_ABI=0 -L/home/julien/.local/lib/python3.6/site-packages/tensorflow -ltensorflow_framework

%_pb2.py: %.proto
	protoc --python_out=. $<

Hope that these loose instructions will help someone.

from gossipnet.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.