-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ api runs much slower than Python API (compile flags) #3471
Comments
Did you use the
|
Ah amazing, I got the run times from 2minutes -> 4.5 seconds. However, note that you must pass the flags after the build keyword:
Maybe this should be added to documentation somewhere? |
Right. "-c opt" means optimized build. On Friday, July 22, 2016, Lingliang Zhang notifications@github.com wrote:
|
@lingz I am trying to run the exported .pb file in C++ and getting errors.
Can you point me to a how you ran it in C++ ? |
I have an independant project using Makefile and tensorflow shared object file instead of bazel to build. What's the g++ equalivalent of |
In my case, adding optimization options (all available for cpu) during bazel build works with me. |
My graph run in Python only takes 6 seconds for one batch, but when I run the identical batch on the same graph (graph_freeze) in the C++ Api, the time is 80 seconds. I'm guessing this 13x slowdown is probably from using the wrong C flags during compilation. This is all running on CPU only.
I'm loading the graphs using the same way as in the label_images example.
I took a look at: #2721, and added the -mavx C flag, which increased it by about double, but still 13x slower than the python.
The graph is a mostly a large multi layered regular RNN but with some feedforward as well.
Any ideas on how to get it to the same speed as python? Is there somewhere I can see what flags tensorflow installed from source is compiled with?
Environment info
Operating System: Linux ubuntu 64 bit 14.04
Installed version of CUDA and cuDNN: None (CPU Only)
(please attach the output of
ls -l /path/to/cuda/lib/libcud*
):If installed from binary pip package, provide:
Linux 64 Bit CPU Python 3.5
python -c "import tensorflow; print(tensorflow.__version__)"
.0.9.0
If installed from source, provide
git rev-parse HEAD
)bazel version
Steps to reproduce
What have you tried?
Logs or other output that would be helpful
(If logs are large, please upload as attachment).
The text was updated successfully, but these errors were encountered: