1

While running TensorFlow tests using bazel test command, I can see some tests which fail due to assertion error(slight deviation from the expected tolerance), pass when run with -c dbg as below:

bazel test -c dbg //tensorflow/python:training_ops_test

While, this fails:

bazel test -c opt //tensorflow/python:training_ops_test
bazel test //tensorflow/python:training_ops_test

So as per Bazel, --compilation_mode [-c] can be fastbuild, dbg or opt; default: "fastbuild".

Does the opt or fastbuild mode return unexpected result on few platforms?

NamrataB
  • 283
  • 2
  • 15
  • I'm not sure I understand the question, are you asking if dbg/opt/fastbuild work on all platforms the same? From the Bazel's perspective compilation mode just a switch that changes how the resulting command line will look like, which flags get added and what outputs are produced. What flags are added for which compilation mode is in the hands of project authors. Or I misunderstood the question? – hlopko Aug 04 '17 at 14:54
  • Yes @mhlopko, you got it right.. My issue is that test passes with debug mode and not with opt/fastbuild. So I am trying to understand the difference between the two. Whether Bazel defines the behaviour in both these modes or TensorFlow. Also on Red Hat, the error is seen wrt to tolderance while on Ubuntu it passes. So I this doesn't seem like TensorFlow code issue. Hence a little puzzled about this. – NamrataB Aug 04 '17 at 15:25

1 Answers1

2

dbg, opt and fastbuild pass different options to the C++ compiler. You can see exactly which options by looking at the dbg and opt sections of the CROSSTOOL.

I'm guessing the failures you're seeing are just based on variances in code generation due to different levels of optimization in the compile mode. This question is a good overview of some of the differences you'll see between optimized and non-optimized builds. (It's for Windows in particular, but applies to compiler optimizations across all systems.)

kris
  • 23,024
  • 10
  • 70
  • 79
  • Woah. Too much to think. Indeed the above link you shared explains the differences very well. @kristina, thanks! – NamrataB Aug 09 '17 at 06:38