Kernel dies when using NGSolve with Tensorflow

More
4 years 3 weeks ago #3264 by Luma
Hi everyone :)

I am currently using Tensorflow to evaluate data obtained from NGSolve simulations. When my tensorflow model makes a prediction there should be the possibility to run a simulation again to validate the results.

My problem is, that working with both Tensorflow and NGSolve causes my Kernel to die unexpectedly. This happens as soon as I import the NGSolve routines via 'from ngsolve import *'.

In Spyder the Kernel restarts and shows:
Code:
[SpyderKernelApp] WARNING | No such comm: b30a683a184f11ebb7e4801934d35270
The output in a Jupyter Lab terminal is:
Code:
2020-10-27 13:02:47.624887: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA OMP: Error #15: Initializing libiomp5.so, but found libomp.so already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/. [ThinkPad:06245] *** Process received signal *** [ThinkPad:06245] Signal: Aborted (6) [ThinkPad:06245] Signal code: (-6) [ThinkPad:06245] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x128a0)[0x7ff9114028a0] [ThinkPad:06245] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7ff91103df47] [ThinkPad:06245] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7ff91103f8b1] [ThinkPad:06245] [ 3] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../../_solib_k8/_U@mkl_Ulinux_S_S_Cmkl_Ulibs_Ulinux___Uexternal_Smkl_Ulinux_Slib/libiomp5.so(+0xb6b23)[0x7ff8c642bb23] [ThinkPad:06245] [ 4] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../../_solib_k8/_U@mkl_Ulinux_S_S_Cmkl_Ulibs_Ulinux___Uexternal_Smkl_Ulinux_Slib/libiomp5.so(+0xa1d17)[0x7ff8c6416d17] [ThinkPad:06245] [ 5] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../../_solib_k8/_U@mkl_Ulinux_S_S_Cmkl_Ulibs_Ulinux___Uexternal_Smkl_Ulinux_Slib/libiomp5.so(+0xb4915)[0x7ff8c6429915] [ThinkPad:06245] [ 6] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../../_solib_k8/_U@mkl_Ulinux_S_S_Cmkl_Ulibs_Ulinux___Uexternal_Smkl_Ulinux_Slib/libiomp5.so(+0xb62d4)[0x7ff8c642b2d4] [ThinkPad:06245] [ 7] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../../_solib_k8/_U@mkl_Ulinux_S_S_Cmkl_Ulibs_Ulinux___Uexternal_Smkl_Ulinux_Slib/libiomp5.so(+0xa96c0)[0x7ff8c641e6c0] [ThinkPad:06245] [ 8] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../../_solib_k8/_U@mkl_Ulinux_S_S_Cmkl_Ulibs_Ulinux___Uexternal_Smkl_Ulinux_Slib/libiomp5.so(omp_set_num_threads+0xa)[0x7ff8c640b8da] [ThinkPad:06245] [ 9] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../libtensorflow_framework.so.2(_ZN10tensorflow16ThreadPoolDeviceC2ERKNS_14SessionOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_3gtl7IntTypeINS_10Bytes_tag_ExEERKNS_14DeviceLocalityEPNS_9AllocatorE+0x28c)[0x7ff8bcb5615c] [ThinkPad:06245] [10] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../libtensorflow_framework.so.2(+0x12707ad)[0x7ff8bcb577ad] [ThinkPad:06245] [11] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/../libtensorflow_framework.so.2(_ZN10tensorflow13DeviceFactory10AddDevicesERKNS_14SessionOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPSt6vectorISt10unique_ptrINS_6DeviceESt14default_deleteISE_EESaISH_EE+0x9e)[0x7ff8bcac081e] [ThinkPad:06245] [12] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so(TFE_NewContext+0x82)[0x7ff8c8e685d2] [ThinkPad:06245] [13] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/_pywrap_tfe.so(+0xffd2d)[0x7ff8ba211d2d] [ThinkPad:06245] [14] /home/lukas/miniconda3/lib/python3.8/site-packages/tensorflow/python/_pywrap_tfe.so(+0xfb880)[0x7ff8ba20d880] [ThinkPad:06245] [15] /home/lukas/miniconda3/bin/python3.8(PyCFunction_Call+0x56)[0x55dbfc8bfdc6] [ThinkPad:06245] [16] /home/lukas/miniconda3/bin/python3.8(_PyObject_MakeTpCall+0x21f)[0x55dbfc8817cf] [ThinkPad:06245] [17] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalFrameDefault+0x53a7)[0x55dbfc924347] [ThinkPad:06245] [18] /home/lukas/miniconda3/bin/python3.8(_PyFunction_Vectorcall+0xfb)[0x55dbfc8cc69b] [ThinkPad:06245] [19] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalFrameDefault+0x49a)[0x55dbfc91f43a] [ThinkPad:06245] [20] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalCodeWithName+0x1dc)[0x55dbfc8cb6bc] [ThinkPad:06245] [21] /home/lukas/miniconda3/bin/python3.8(_PyFunction_Vectorcall+0x1c5)[0x55dbfc8cc765] [ThinkPad:06245] [22] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalFrameDefault+0x6e0)[0x55dbfc91f680] [ThinkPad:06245] [23] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalCodeWithName+0x1dc)[0x55dbfc8cb6bc] [ThinkPad:06245] [24] /home/lukas/miniconda3/bin/python3.8(_PyFunction_Vectorcall+0x268)[0x55dbfc8cc808] [ThinkPad:06245] [25] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalFrameDefault+0x144d)[0x55dbfc9203ed] [ThinkPad:06245] [26] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalCodeWithName+0x1dc)[0x55dbfc8cb6bc] [ThinkPad:06245] [27] /home/lukas/miniconda3/bin/python3.8(_PyFunction_Vectorcall+0x268)[0x55dbfc8cc808] [ThinkPad:06245] [28] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalFrameDefault+0x144d)[0x55dbfc9203ed] [ThinkPad:06245] [29] /home/lukas/miniconda3/bin/python3.8(_PyEval_EvalCodeWithName+0x1dc)[0x55dbfc8cb6bc] [ThinkPad:06245] *** End of error message ***
As far as I know, the first two messages can be ignored and I do not understand where the problem originates from. I attached a minimal example of code to reproduce the problem. I am using
Code:
python 3.8.2 ipykernel 5.3.4 tensorflow 2.2.0 ngsolve 6.2.2008

If anyone ever experienced this kind of problem or can validate if its caused by my environment setup this would really help me out.

kind regards
Lukas
Attachments:
Time to create page: 0.107 seconds