2
我們試圖將自己的後端實現到TensorFlow XLA編譯器,但我們遇到了一些有些尷尬的情況:我們似乎無法讓現有的CPU編譯器做任何事情。使用TensorFlow XLA例子在這裏找到:如何鍛鍊XLA編譯器?
我們建立TensorFlow從源與TF_ENABLE_XLA=1
在配置階段和調試信息。然後,我們在LLDB中運行softmax示例,並試圖打斷CpuCompiler::Compile()
的呼叫。如下所示,程序運行完成時不會破壞Compile()函數,或者顯然任何可能調用它的函數。
~/tflow$ lldb -- python3 mnist_softmax_xla.py
(lldb) target create "python3"
Current executable set to 'python3' (x86_64).
(lldb) settings set -- target.run-args "mnist_softmax_xla.py"
(lldb) b CpuCompiler::Compile
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 10331 launched: '/usr/bin/python3' (x86_64)
2 locations added to breakpoint 1
Process 10331 stopped and restarted: thread 1 received signal: SIGCHLD
Extracting /tmp/tensorflow/mnist/input_data/train-images-idx3-ubyte.gz
Extracting /tmp/tensorflow/mnist/input_data/train-labels-idx1-ubyte.gz
Extracting /tmp/tensorflow/mnist/input_data/t10k-images-idx3-ubyte.gz
Extracting /tmp/tensorflow/mnist/input_data/t10k-labels-idx1-ubyte.gz
2017-04-13 15:35:52.612498: I tensorflow/compiler/xla/service/platform_util.cc:58] platform Host present with 8 visible devices
2017-04-13 15:35:52.616628: I tensorflow/compiler/xla/service/service.cc:183] XLA service 0x2b38780 executing computations on platform Host. Devices:
2017-04-13 15:35:52.616642: I tensorflow/compiler/xla/service/service.cc:191] StreamExecutor device (0): <undefined>, <undefined>
0.9195
Process 10331 exited with status = 0 (0x00000000)