在進行機器學(xué)習(xí)【pytorch框架】的時候,有事會報如下錯,以前我是通過削減Batch_size值显设,自己仔細想了想孕豹,這樣做未免有點不解決根本問題涩盾,系統(tǒng)報錯提示: KMP_DUPLICATE_LIB_OK=TRUE 可以解決,我順勢查閱了下 KMP_DUPLICATE_LIB_OK=TRUE 励背。得到的二級結(jié)論如下:
這個有可能是因為系統(tǒng)環(huán)境中存在多個版本的OpenMP庫導(dǎo)致春霍,可以把環(huán)境變量KMP_DUPLICATE_LIB_OK設(shè)置成True試試。
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 http://www.intel.com/software/products/support/.
在代碼中解決方案如下:
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
或:
- 查看文件鏈接的OpenMP library, 只使用一個叶眉。
- 推薦使用動態(tài)庫:libiomp5md.dll
- 如果第三方庫使用libguide40.dll, 使用libiomp5md.dll 重新編譯庫文件址儒。