Jupyter Notebook运行中内核挂掉
Jupyter Notebook运行中内核挂掉了
有人说可能是版本冲突,由于我的都是最新版本,因此更新版本并未解决该问题。
最后发现有人通过这行代码解决了
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
我也试了试,发现......
我加了这一句之后也能跑了,哈哈哈哈哈。
至于什么原理,日后在更。
我回来啦,似乎其作用是允许加载并运行多个OpenMP
- 根据stackoverflow上的回答:
KMP_DUPLICATE_LIB_OK
=True
tells OpenMP(多进程并发API) to not complain if it notices that two copies of OpenMP are loaded. This doesn't necessarily mean it will work, but it does mean it won't stop you from trying to make it work. - 根据pytorch论坛上的回答: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.