Tuesday, December 8, 2009

OpenMP blues.

My company MOSEK sell a software package which essential part is a dynamic link library (shared libray). In order to exploit multiple threads we use OpenMP which is fairly simple to use.

Our customers may link that library with their application programs/libraries. Hence, we have very little control over how customers employ our library. They may link it with arbitrary other libraries. For instance our program may be called
  • MATLAB
  • .NET
  • Java
or some other third party environment. It is there essential that the OpenMP support library works with almost about anything just as the pthread library does on UNIX. Unfortunately it does not. Based on our expirience with the OpenMP library supplied with the Intel C compiler we have seen:
  • Crashes on Linux when OpenMP is used from MATLAB.
  • Strange crashes when our library is loaded on run time. It seems some finalize code is executed a the proper time when the shared libraries are off loaded.
  • Link problems. When we link with version of the OpenMP support library and our customer link with another version that our customers thinks we are stupid.
In summary it basic underlying assumption of OpenMP seems to be that the users build and link the complete application involving OpenMP. So it is very suitable for "Hello world" type of programs. It is pain to use for a commercial vendor of dynamic/shared link libraries. We definitely need something better. Our ideal requirements are
  • that is 100% compatible with C (not C++),
  • is almost as easy to use as OpenMP,
  • makes it a lot easier to debug i.e. be open source and
  • give us much control over what is happening.

1 comment:

  1. Below is one of those annoying issues with OpenMP illustrated. Btw upgrading to MOSEK v6 solves the issue.


    Customer quote:

    After I added a reference to yet another third party library (by CenterSpace) I'm getting the following error when calling into mosek:

    OMP abort: Initializing libguide40.dll, but found libiomp5mt.lib already initialized.
    This may cause performance degradation and correctness issues.
    Set environment variable KMP_DUPLICATE_LIB_OK=TRUE to ignore
    this problem and force the program to continue anyway.
    Please note that the use of KMP_DUPLICATE_LIB_OK is unsupported
    and using it may cause undefined behavior.
    For more information, please contact Intel(R) Premier Support.

    According to http://software.intel.com/en-us/articles/opm-abort-initializing-libguide40dll/ the two libraries are incompatible. CenterSpace is using the newer library (libiomp5) while mosek is using (I guess here, as I only see the mosekdotnet64.dll) libguide40.dll that is deprecated (http://www.intel.com/software/products/compilers/docs/flin/main_for/mergedprojects/optaps_for/common/optaps_par_libs.htm ).

    ReplyDelete