/*  This is a quick-fix module that prevents MKL from SEGV.

    BUILD:
    gcc -shared -fPIC $(python-config --cflags) initializeMKL.c -o initializeMKL.so

    USAGE:
    Prepend
        import initializeMKL
    at the beginning of __init__.py
*/

#include <Python.h>
#include <dlfcn.h>

PyMODINIT_FUNC
initinitializeMKL(void)
{
    static PyMethodDef methods[1] = {};
    Py_InitModule("initializeMKL", methods);

    dlopen("libiomp5.so", RTLD_LAZY | RTLD_GLOBAL);
}
