Karamba cause Rhino to crash when loading example gh

Karamba 2.2.0.12 ~ 2.2.0.14, RH6.36, RH7.18, Win10 x64

When loading any example gh under
Karamba\Examples\BenchmarkExamples
or
Karamba\Examples\TestExamples

The RH6/7 crashes without showing any error.

Hi Sean -
Just to make sure, could you please run the Rhino SystemInfo command and copy-paste the result here?
-wim

Rhino 7 SR18 2022-5-4 (Rhino 7, 7.18.22124.03001, Git hash:master @ b2a1120bcb32e1f6da66a421cd7162a18a9f0cd9)
License type: Commercial, build 2022-05-04
License details: Stand-Alone

Windows 10.0.19044 SR0.0 or greater (Physical RAM: 32Gb)

Computer platform: DESKTOP

Standard graphics configuration.
Primary display and OpenGL: NVIDIA GeForce GTX 970 (NVidia) Memory: 4GB, Driver date: 9-30-2020 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 456.71
> Accelerated graphics device with 4 adapter port(s)
- Windows Main Display attached to adapter port #0

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 9-30-2020
Driver Version: 27.21.14.5671
Maximum Texture size: 16384 x 16384
Z-Buffer depth: 24 bits
Maximum Viewport size: 16384 x 16384
Total Video Memory: 4 GB

Rhino plugins that do not ship with Rhino
C:\Program Files\Scan&Solve Pro for Rhino 6\SnSPro_Rhino6.rhp “Scan&Solve Pro for Rhino” 1.0.0.0
C:\Program Files\SOFiSTiK\2022\SOFiSTiK Rhinoceros Interface 2022\sofrhino.rhp “SOFiSTiK Rhinoceros Interface 2022”
C:\Program Files\Common Files\McNeel\Rhinoceros\7.0\Plug-ins\TeDAsharp (ce983e9d-72de-4a79-8832-7c374e6e26de)\0.1.0.0\TeDaSharp_050.rhp “TeDAsharp” 0.1.0.0
C:\Program Files (x86)\Evolute\EvoluteTools PRO Panelisation for Rhino 6\EvoluteCoutHook.rhp “EvoluteCoutHook”
C:\Program Files\Rhino 7\Plug-ins\DATAKIT\Rhino7_Import_x64.rhp “Datakit_to_rhino7”

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 7\Plug-ins\Commands.rhp “Commands” 7.18.22124.3001
C:\Program Files\Rhino 7\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 7\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 7.18.22124.3001
C:\Program Files\Rhino 7\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 7.18.22124.3001
C:\Program Files\Rhino 7\Plug-ins\rdk_ui.rhp “Renderer Development Kit UI”
C:\Program Files\Rhino 7\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 7\Plug-ins\RhinoCycles.rhp “RhinoCycles” 7.18.22124.3001
C:\Program Files\Rhino 7\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 7.18.22124.3001
C:\Program Files\Rhino 7\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 7\Plug-ins\Displacement.rhp “Displacement”

Hi Sean -

I’d start with updating that GPU driver.
Do you also experience crashes in other workflows, or is this strictly related to opening that example file?
-wim

  1. updated the graphic card driver to the latest stable version
  2. disable GH solver, load an Karamba built-in example. eg.
    \TestExamples\00_Params\Cross_Section_Internalize.gh
  3. disable all the components, enable GH solver again, then progressively enable each component, until the RH crashes

    It’s the Analyze component that causes the crash.
  4. Loading any GH with Karamba’s Analysis component enabled will crash the RH.

hello @netsonicyxf,
sorry for the inconvenience.
Please try the following: uninstall Karamba3D, check that all ‘karamba.dll’ and ‘libiomp5md.dll’ files are removed from your harddisk. Be cautious with ‘libiomp5md.dll’: It is the intel openMP runtime library which might be used by other applications or Grasshopper plug-ins. Rename occurrences of ‘libiomp5md.dll’ outside the Karamba3D installation folder to e.g. ‘libiomp5md.dll.backup’ so that you can restore them if necessary.
Then install the latest build of Karamba3D from e.g. here.
– Clemens

  1. I find 125 ‘libiomp5md.dll’ in the C drive. I rename them to ‘libiomp5md.dll.bak’ then install Karamba7, it works.
  2. If I rename ‘libiomp5md.dll.bak’ in the ‘C:\Windows\System32’ to the original name, when lauching GH, it shows
  3. If I rename the ‘libiomp5md.dll.bak’ in the ‘C:\Program Files (x86)\Evolute\EvoluteTools PRO Panelisation for Rhino 6’ to the original name, it will cause RH to crash when loading any gh files with Karamba3D Analysize component enabled.

The problem with libiomp5md.dll is, that it is not possible to statically link it into the C++ karamba.dll library. If there are different versions around and karamba.dll dynamically links to an outdated ‘libiomp5md.dll’ it throws exceptions (2.) or crashes (3.).
The version of ‘libiomp5md.dll’ that comes with Karamba3D 2.2.0.14 is the latest one. You could try to use it in place of the other versions.
Maybe there is a better solution via a .manifest file - I will have a look into that.
– Clemens

1 Like

Hello @netsonicyxf,
I have just uploaded a new version of Karamba3D to Release Karamba3D 2.2.0.14 · karamba3d/K3D_NightlyBuilds · GitHub.
This should fix the problem without the necessity of renaming anything.
Could you please try it and tell me whether it works for you?
– Clemens

Hello Clemens,
I installed the latest 2.2.0.14 and revert the other libiomp5md.dll.bak to libiomp5md.dll.
When opening any Karamba GH file, it shows a cmd window as below, then RH crashed.

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll 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 Intel® Product Support.

Hello @netsonicyxf,

Thanks for trying out the fix and reporting back!

I searched around the net for a better solution. The best option seems to be to replace old versions of libiomp5md.dll with the latest one. Like indicated here libiomp5md.dll is backwards compatible - so newer versions can be used in place of older ones.

I replaced the nightly-builds version of Karamba3D for the previous one which uses the libiomp5md.dll which is currently initialized or starts its own.

If possible II will add a warning in case of incompatible libiomp5md.dll versions.

You could copy ‘libiomp5md.dll’ that resides in the Karamba3D installation folder to ‘%SystemRoot%\SYSTEM32’. This should override all other copies.

– Clemens

Hello @netsonicyxf,
could you send me the libiomp5md.dll that comes inside ‘C:\Program Files (x86)\Evolute\EvoluteTools PRO Panelisation for Rhino 6’ for testing? It is a redistributable Intel library so there is no legal problem with sending it. I tried out the Lite-version of the tools but could not reproduce the problem. It would be very helpful for debugging.
– Clemens

Hello Clemens,

I copied ‘libiomp5md.dll’ that resides in the ‘old’ 2.2.0.14 Karamba3D installation folder to ‘%SystemRoot%\SYSTEM32’, but RH still crash unless I rename ‘libiomp5md.dll’ in the ‘C:\Program Files (x86)\Evolute\EvoluteTools PRO Panelisation for Rhino 6’ to ‘libiomp5md.dll.bak’

Below is the link for the ‘libiomp5md.dll’ coming with EvoluteTools PRO.