Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMP: Error #15: Initializing libiomp5.dylib #16

Closed
ZachariahRosenberg opened this issue Nov 10, 2018 · 19 comments
Closed

OMP: Error #15: Initializing libiomp5.dylib #16

ZachariahRosenberg opened this issue Nov 10, 2018 · 19 comments

Comments

@ZachariahRosenberg
Copy link

Followed Mujoco install, followed by full Gym installation.

Used Miniconda, py 3.6

On fresh OSX Mojave (right out of the box!)

Ran the following code:

import gym
import tensorflow as tf
from spinup import ddpg

env_name = 'Pendulum-v0'
env_fn       = lambda : gym.make(env_name)

ac_kwargs = {
        'hidden_sizes':[64,64], 
        'activation'  :tf.nn.relu
    }

logger_kwargs = {
    'output_dir'  : 'logs', 
    'exp_name'  :'pendulum_test'
    }

addl_kwargs = {
    'seed' : 42
}

ddpg(env_fn, ac_kwargs=ac_kwargs, logger_kwargs=logger_kwargs, **addl_kwargs)

Received following error on first build:

INFO:tensorflow:Assets added to graph.
INFO:tensorflow:No assets to write.
INFO:tensorflow:SavedModel written to: logs/simple_save/saved_model.pb

OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.

OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into theprogram. 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/.

[MBP:05587] *** Process received signal ***
[MBP:05587] Signal: Abort trap: 6 (6)
[MBP:05587] Signal code: (0)
[MBP:05587] [ 0] 0 libsystem_platform.dylib 0x00007fff6ad79b3d _sigtramp + 29
[MBP:05587] [ 1] 0 libiomp5.dylib 0x0000000110b7b018 __kmp_openmp_version + 88572
[MBP:05587] [ 2] 0 libsystem_c.dylib 0x00007fff6ac381c9 abort + 127
[MBP:05587] [ 3] 0 libiomp5.dylib 0x0000000110b24df3 __kmp_abort_process + 35
[MBP:05587] *** End of error message ***
Abort trap: 6

The workaround is including:

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

However, is there a more permanent fix? Why might there be multiple instances of OpenMP?

@jachiam
Copy link
Contributor

jachiam commented Nov 11, 2018

Being real honest here: I have absolutely no idea what might have happened there. This issue from another project looks relevant. Try solutions recommended there, maybe?

@ZachariahRosenberg
Copy link
Author

ZachariahRosenberg commented Nov 11, 2018

Tried the following suggestion from that thread:

At least for Mac,
brew uninstall libiomp clang-omp
as long as u got gcc v5 from brew it come with openmp

Nothing.

The workaround above works,

os.environ['KMP_DUPLICATE_LIB_OK']='True'

This is likely nothing to do with this repo and can be closed.

@christabella
Copy link

@ZachariahRosenberg did you try conda install nomkl? It worked for a lot of people from that thread but not for me (neither did I have libiomp clang-omp installed on Brew either), only your workaround helped.

@agilebean
Copy link

@christabella your solution conda install nomkl works!! thanks so much. this is much more elegant than setting this cryptic parameter...

@esvhd
Copy link

esvhd commented Dec 22, 2018

The best solution I found was here.

Check your anaconda/lib folder, run ll lib*omp*, do you see some old libiomp5.dylib file? Remove it.

@rgurrapu5401
Copy link

Yes, even i ran into the same problem today and tried conda install nomkl and it worked!,thanks for the solution.

@Chloe-Xue99
Copy link

Tried conda install nomkl and worked

@emigre459
Copy link

conda install nomkl did the trick for me as well. When I read about MKL on the Anaconda site though, it sounds really helpful in general for machine learning. Any ideas on how we can avoid disabling it and losing the potential efficiency gains?

@0l00ph0le
Copy link

@christabella thanks conda install nomkl worked for me too

@nezar-a
Copy link

nezar-a commented May 7, 2019

conda install nomkl worked on macOS 10.14.4 from my end

@jiangjunmggs
Copy link

thank you very macth

@poke1024
Copy link

Same problem here. KMP_DUPLICATE_LIB_OK fix works for me, conda install nomkl rolled back due to some privilege problem.

@HaoranLiao
Copy link

Same problem here. KMP_DUPLICATE_LIB_OK fix works for me, conda install nomkl rolled back due to some privilege problem.

@mehdirezaie
Copy link

conda install nomkl worked for me!

@yaochx
Copy link

yaochx commented Aug 25, 2020

import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
This worked for me

@Werikson1
Copy link

The best solution I found was here.

Check your anaconda/lib folder, run ll lib*omp*, do you see some old libiomp5.dylib file? Remove it.

this really works

@jiadR
Copy link

jiadR commented Oct 6, 2020

conda install nomkl worked for me too! Fixed permanently on macOS Catalina 10.15.7.

@sjoerdvansteenkiste
Copy link

I found an alternative solution to this problem here, which is to preload the OpenMP runtime using the LD_PRELOAD variable:

LD_PRELOAD=<path_to_libiomp5.so> <path_to your_executable>

This eliminates multiple loadings of libiomp, and makes all the components use this specific version of OpenMP.

@AkaShark
Copy link

conda install nomkl worked for me. MacOS 10.15.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests