spinningup: OMP: Error #15: Initializing libiomp5.dylib
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?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 19 (1 by maintainers)
@ZachariahRosenberg did you try
conda install nomkl? It worked for a lot of people from that thread but not for me (neither did I havelibiomp clang-ompinstalled on Brew either), only your workaround helped.conda install nomkldid 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?Tried conda install nomkl and worked
I found an alternative solution to this problem here, which is to preload the OpenMP runtime using the
LD_PRELOADvariable:This eliminates multiple loadings of libiomp, and makes all the components use this specific version of OpenMP.
import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"This worked for me@christabella your solution
conda install nomklworks!! thanks so much. this is much more elegant than setting this cryptic parameter…