Skip to content

openmp and per_face_normals pybind11 wrapper crash #193

@stigersh

Description

@stigersh

Hi,
I'm actually wrapping my cpp code with libigl to python using pybind11 and I figured out that it crashes when I use openmp on per_face_normals. Without openmp in cmakelists everything works fine.

Did you have any issues like that with pybind11 and openmp? Would really appreciate any advice.

Here is the minimal repository for problem reproduction:
https://github.com/stigersh/MinimalBindIGL
it has 2 methods wrappers of igl - doubleArea which works fine and per_face_normals which crashes the python kernel (testClass.py). There is also a main indicating none of them crash as a cpp project.

crash message:
OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib 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://openmp.llvm.org/

**setting the KMP_DUPLICATE_LIB_OK to TRUE didn't help as well.

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions