<p dir="auto">Please go to Stack Overflow for help and support:</p>
<p dir="auto"><a href="https://stackoverflow.com/questions/tagged/tensorflow" rel="nofollow">https://stackoverflow.com/questions/tagged/tensorflow</a></p>
<p dir="auto">If you open a GitHub issue, here is our policy:</p>
<ol dir="auto">
<li>It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).</li>
<li>The form below must be filled out.</li>
<li>It shouldn't be a TensorBoard issue. Those go <a href="https://github.com/tensorflow/tensorboard/issues">here</a>.</li>
</ol>
<p dir="auto"><strong>Here's why we have that policy</strong>: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.</p>
<hr>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>:</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>:</li>
<li><strong>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device</strong>:</li>
<li><strong>TensorFlow installed from (source or binary)</strong>:</li>
<li><strong>TensorFlow version (use command below)</strong>:</li>
<li><strong>Python version</strong>:</li>
<li><strong>Bazel version (if compiling from source)</strong>:</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>:</li>
<li><strong>CUDA/cuDNN version</strong>:</li>
<li><strong>GPU model and memory</strong>:</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<p dir="auto">You can collect some of this information using our environment capture script:</p>
<p dir="auto"><a href="https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh">https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh</a></p>
<p dir="auto">You can obtain the TensorFlow version with</p>
<p dir="auto">python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"</p>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.</p>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.</p>
<p dir="auto"><em>Please make sure that this is a build/installation issue. As per our <a href="https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md">GitHub Policy</a>, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template</em></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04 LTS</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: -</li>
<li>TensorFlow installed from (source or binary): from source</li>
<li>TensorFlow version: 1.13.1</li>
<li>Python version: Bazel used 2.7 as default, however I have also access to 3.6</li>
<li>Installed using virtualenv? pip? conda?: -</li>
<li>Bazel version (if compiling from source): 0.26</li>
<li>GCC/Compiler version (if compiling from source): 7.4.0</li>
<li>CUDA/cuDNN version: -</li>
<li>GPU model and memory: - (no GPU)</li>
</ul>
<p dir="auto"><strong>Describe the problem</strong><br>
I am using Tensorflow's C API within a C++ simulation software for fluid dynamics (OpenFOAM). So far I used the standard C API available here (<a href="https://www.tensorflow.org/install/lang_c" rel="nofollow">https://www.tensorflow.org/install/lang_c</a>). Everything worked well, both doing my computations on one core as well as using OpenMPI to parallelize the fluid dynamics part. As I wanted to speed up my inference I wanted to try out AVX / AVX2 support, as my CPU supports AVX / AVX2. To do so I compiled Tensorflow from source:</p>
<ol dir="auto">
<li>Installation of Bazel 0.26.1</li>
<li>clone from Github: git clone <a href="https://github.com/tensorflow/tensorflow.git">https://github.com/tensorflow/tensorflow.git</a></li>
<li>cd tensorflow -&gt; ./configure</li>
<li>I chose these steps for configuration:</li>
</ol>
<ul dir="auto">
<li>Please specify the location of python. [Default is /usr/bin/python]: default<br>
-Please input the desired Python library path to use.  Default is [/usr/local/lib/python2.7/dist-packages]: default</li>
<li>Do you wish to build TensorFlow with XLA JIT support? [Y/n]: Y</li>
<li>Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: N</li>
<li>Do you wish to build TensorFlow with ROCm support? [y/N]: N</li>
<li>Do you wish to build TensorFlow with CUDA support? [y/N]: N</li>
<li>Do you wish to download a fresh release of clang? (Experimental) [y/N]: N</li>
<li>Do you wish to build TensorFlow with MPI support? [y/N]: y</li>
<li>Please specify the MPI toolkit folder. [Default is /usr]: default</li>
<li>Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]: default</li>
<li>Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: N</li>
</ul>
<ol start="5" dir="auto">
<li>Test: bazel test --config opt //tensorflow/tools/lib_package:libtensorflow_test</li>
<li>Build: bazel build --config opt //tensorflow/tools/lib_package:libtensorflow</li>
<li>Included the header files and linked the libraries</li>
</ol>
<p dir="auto">Unfortunately, although everything seemed to be fine, I get an error. As I mentioned, using the standard C API downloaded from the homepage everything was fine. Now i can still to my computations if i do not parallelize my fluid dynamics software. However if I run my fluid dynamics simulation in parallel, this happens:<br>
`<br>
[node134:18796] *** Process received signal ***</p>
<p dir="auto">[node134:18796] Signal: Segmentation fault (11)</p>
<p dir="auto">[node134:18796] Signal code: Address not mapped (1)</p>
<p dir="auto">[node134:18796] Failing at address: (nil)</p>
<p dir="auto">[node134:18796] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7fec1c96ff20]</p>
<p dir="auto">[node134:18796] [ 1] /home/elias/OpenFOAM/elias-4.1/platforms/linux64GccDPInt32Opt/lib/libtensorflow_framework.so(hwloc_bitmap_and+0x14)[0x7fec01c21534]</p>
<p dir="auto">[node134:18796] [ 2] /usr/lib/x86_64-linux-gnu/libopen-pal.so.20(opal_hwloc_base_filter_cpus+0x380)[0x7febe59d6b80]</p>
<p dir="auto">[node134:18796] [ 3] /usr/lib/x86_64-linux-gnu/openmpi/lib/openmpi/mca_ess_pmi.so(+0x2b4e)[0x7febe4902b4e]</p>
<p dir="auto">[node134:18796] [ 4] /usr/lib/x86_64-linux-gnu/libopen-rte.so.20(orte_init+0x22e)[0x7febe5c2a1de]</p>
<p dir="auto">[node134:18796] [ 5] /usr/lib/x86_64-linux-gnu/libmpi.so.20(ompi_mpi_init+0x30e)[0x7febffdbc27e]</p>
<p dir="auto">[node134:18796] [ 6] /usr/lib/x86_64-linux-gnu/libmpi.so.20(MPI_Init+0x6b)[0x7febffddd2ab]</p>
<p dir="auto">[node134:18796] [ 7] /opt/OpenFOAM/OpenFOAM-4.1/platforms/linux64GccDPInt32Opt/lib/openmpi-system/libPstream.so(_ZN4Foam8UPstream4initERiRPPc+0x1f)[0x7fec1c72843f]</p>
<p dir="auto">[node134:18796] [ 8] /opt/OpenFOAM/OpenFOAM-4.1/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam7argListC1ERiRPPcbbb+0x719)[0x7fec1db36ed9]</p>
<p dir="auto">[node134:18796] [ 9] tabulatedCombustionFoam(+0x279b8)[0x55fe6eb489b8]</p>
<p dir="auto">[node134:18796] [10] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fec1c952b97]</p>
<p dir="auto">[node134:18796] [11] tabulatedCombustionFoam(+0x30a0a)[0x55fe6eb51a0a]</p>
<p dir="auto">[node134:18796] *** End of error message ***`</p>
<p dir="auto">I do not think that my code has any errors, as with the C API I downloaded directly from the Tensorflow homepage everything worked fine. More probably it seems to be a collision between OpenMPI called from Tensorflow and OpenMPI called from OpenFOAM (the fluid dynamics software). Moreover the run crashes immediately after I start the simulation and far before it reaches my own code.</p>
<p dir="auto">My questions:</p>
<ol dir="auto">
<li>Is there a procedure I can follow to get rid of the bug?</li>
<li>What would I have to do to reproduce exactly the version of the C API that one can download from your homepage? Because as mentioned using this version everything worked fine. Can I find out where the precompiled C API looks for openmpi? Or can you tell me the path?</li>
<li>From this post (<a href="https://www.cfd-online.com/Forums/openfoam-solving/133913-problems-running-openfoam-2-3-parallel.html" rel="nofollow">https://www.cfd-online.com/Forums/openfoam-solving/133913-problems-running-openfoam-2-3-parallel.html</a>) I learned that OpenFOAM uses an own OpenMPI version, however this one worked perfectly fine together with my initial Tensorflow C API stuff that i downloaded. Can you maybe define what the correct MPI toolkit path must contain? Then I could possibly use the one also used by OpenFOAM.</li>
</ol>