{"id":548,"date":"2020-12-08T18:08:59","date_gmt":"2020-12-08T10:08:59","guid":{"rendered":"http:\/\/132.145.126.25\/?p=548"},"modified":"2020-12-08T18:19:17","modified_gmt":"2020-12-08T10:19:17","slug":"nvfortran-using-intel-mkl","status":"publish","type":"post","link":"https:\/\/www.tsihyoung.com\/index.php\/2020\/12\/08\/nvfortran-using-intel-mkl\/","title":{"rendered":"nvfortran\u8c03\u7528Intel MKL"},"content":{"rendered":"\n<p><code>nvfortran<\/code>\u63d0\u5230\u53ef\u4ee5\u7528<code>-Mmkl<\/code>\u6807\u8bb0\u8c03\u7528Intel MKL\u3002\u4f46\u5982\u679c\u53ea\u4f7f\u7528\u6b64\u6807\u8bb0\uff0c\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u5219\u662f\u4e0e\u5355\u7ebf\u7a0b\u52a8\u6001\u5e93<code>libmkl_sequential.so<\/code>\u94fe\u63a5\u7684\u3002\u5982\u679c\u5c1d\u8bd5\u52a0\u5165OpenMP\u6807\u7b7e<code>-mp<\/code>\uff0c\u5219\u4f1a\u62a5\u9519\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\/usr\/bin\/ld: libmkl_intel_thread.so: undefined reference to `__kmpc_critical_with_hint&#8217;<\/p><cite>\u62a5\u9519\u4fe1\u606f1<\/cite><\/blockquote>\n\n\n\n<p>\u53e6\u5916Intel\u5b98\u7f51\u63d0\u4f9b\u7684\u94fe\u63a5\u6807\u8bb0\u5219\u4e3a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">-I\"${MKLROOT}\/include\" -L${MKLROOT}\/lib\/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528\u6b64\u6807\u8bb0\u4f1a\u62a5\u9519\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\/usr\/bin\/ld: cannot find -liomp5<\/p><cite>\u62a5\u9519\u4fe1\u606f2<\/cite><\/blockquote>\n\n\n\n<p>\u62a5\u9519\u539f\u56e0\u662f\u52a8\u6001\u5e93\u4f4d\u4e8e<code>\/opt\/intel\/compilers_and_libraries_2020.4.304\/linux\/compiler\/lib\/intel64_lin\/libiomp5.so<\/code>\uff0c\u8be5\u8def\u5f84\u65e2\u4e0d\u5728\u73af\u5883\u53d8\u91cf\u4e2d\u4e5f\u672a\u5728\u94fe\u63a5\u6807\u8bb0\u4e2d\u5199\u660e\u3002<\/p>\n\n\n\n<p>\u5c1d\u8bd5\u4fee\u6539\u94fe\u63a5\u6807\u8bb0\u4e3a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">-I\"${MKLROOT}\/include\" -L${MKLROOT}\/lib\/intel64 -L\/opt\/intel\/lib\/intel64_lin\/ -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl<\/code><\/pre>\n\n\n\n<p>\u6b64\u65f6\u7f16\u8bd1\u6210\u529f\uff0c\u4f46\u82e5\u6267\u884c\u7a0b\u5e8f\u5219\u4f1a<code>Segmentation fault (core dumped)<\/code>\u3002\u4f7f\u7528<code>ldd<\/code>\u67e5\u770b\u53ef\u6267\u884c\u6587\u4ef6\u52a8\u6001\u5e93\uff0c\u53ef\u89c1<code>nvfortran<\/code>\u81ea\u52a8\u94fe\u63a5\u4e86Nvidia OpenMP\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">libnvomp.so => \/opt\/nvidia\/hpc_sdk\/Linux_x86_64\/20.9\/compilers\/lib\/libnvomp.so<\/code><\/pre>\n\n\n\n<p>\u8be5\u5e93\u4f1a\u4e0eIntel OpenMP\u76f8\u51b2\u7a81\u3002\u6211\u4eec\u7528<code>patchelf<\/code>\u6572\u9664\u8be5\u52a8\u6001\u5e93\u4f9d\u8d56\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">patchelf --remove-needed libnvomp.so foo.x<\/code><\/pre>\n\n\n\n<p>\u518d\u6b21\u6267\u884c\uff0c\u95ee\u9898\u89e3\u51b3\u3002<\/p>\n\n\n\n<p>\u53e6\u5916\u8981\u6ce8\u610f\u4e0d\u8981\u4f7f\u752864\u4f4d\u6574\u578b\u63a5\u53e3<code>-lmkl_intel_ilp64<\/code>\uff0c\u5426\u5219\u8fd8\u662f\u4f1a<code>Segmentation fault (core dumped)<\/code>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>nvfortran\u63d0\u5230\u53ef\u4ee5\u7528-Mmkl\u6807\u8bb0\u8c03\u7528Intel MKL\u3002\u4f46\u5982\u679c\u53ea\u4f7f\u7528\u6b64\u6807\u8bb0\uff0c\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u5219\u662f\u4e0e\u5355\u7ebf\u7a0b\u52a8\u6001\u5e93libmkl_sequential.so\u94fe\u63a5\u7684\u3002\u5982\u679c\u5c1d\u8bd5\u52a0\u5165OpenMP\u6807\u7b7e-mp\uff0c\u5219\u4f1a\u62a5\u9519\uff1a \/usr\/bin\/ld: libmkl_intel_thread.so: undefined reference to `__kmpc_critical_with_hint&#8217; \u62a5\u9519\u4fe1\u606f1 \u53e6\u5916Intel\u5b98\u7f51\u63d0\u4f9b\u7684\u94fe\u63a5\u6807\u8bb0\u5219\u4e3a\uff1a \u4f7f\u7528\u6b64\u6807\u8bb0\u4f1a\u62a5\u9519\uff1a \/usr\/bin\/ld: cannot find -liomp5 \u62a5\u9519\u4fe1\u606f2 \u62a5\u9519\u539f\u56e0\u662f\u52a8\u6001\u5e93\u4f4d\u4e8e\/opt\/intel\/compilers_and_libraries_2020.4.304\/linux\/compiler\/lib\/intel64_lin\/libiomp5.so\uff0c\u8be5\u8def\u5f84\u65e2\u4e0d\u5728\u73af\u5883\u53d8\u91cf\u4e2d\u4e5f\u672a\u5728\u94fe\u63a5\u6807\u8bb0\u4e2d\u5199\u660e\u3002 \u5c1d\u8bd5\u4fee\u6539\u94fe\u63a5\u6807\u8bb0\u4e3a\uff1a \u6b64\u65f6\u7f16\u8bd1\u6210\u529f\uff0c\u4f46\u82e5\u6267\u884c\u7a0b\u5e8f\u5219\u4f1aSegmentation fault (core dumped)\u3002\u4f7f\u7528ldd\u67e5\u770b\u53ef\u6267\u884c\u6587\u4ef6\u52a8\u6001\u5e93\uff0c\u53ef\u89c1nvfortran\u81ea\u52a8\u94fe\u63a5\u4e86Nvidia OpenMP\uff1a \u8be5\u5e93\u4f1a\u4e0eIntel OpenMP\u76f8\u51b2\u7a81\u3002\u6211\u4eec\u7528patchelf\u6572\u9664\u8be5\u52a8\u6001\u5e93\u4f9d\u8d56\uff1a \u518d\u6b21\u6267\u884c\uff0c\u95ee\u9898\u89e3\u51b3\u3002 \u53e6\u5916\u8981\u6ce8\u610f\u4e0d\u8981\u4f7f\u752864\u4f4d\u6574\u578b\u63a5\u53e3-lmkl_intel_ilp64\uff0c\u5426\u5219\u8fd8\u662f\u4f1aSegmentation fault (core dumped)\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"post_formats":[],"languages":[6],"post_translationss":[],"class_list":["post-548","post","type-post","status-publish","format-standard","hentry","category-programme"],"guten_post_layout_featured_media_urls":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"guten_post_layout_landscape_large":false,"guten_post_layout_portrait_large":false,"guten_post_layout_square_large":false,"guten_post_layout_landscape":false,"guten_post_layout_portrait":false,"guten_post_layout_square":false,"sciencexlite-blog-thumb":false},"_links":{"self":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/posts\/548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/comments?post=548"}],"version-history":[{"count":0,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/posts\/548\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/media?parent=548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/categories?post=548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/tags?post=548"},{"taxonomy":"post_format","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/post_formats?post=548"},{"taxonomy":"language","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/languages?post=548"},{"taxonomy":"post_translations","embeddable":true,"href":"https:\/\/www.tsihyoung.com\/index.php\/wp-json\/wp\/v2\/post_translationss?post=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}