<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ubuntu 14.04 &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/ubuntu-14-04/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Mon, 27 Apr 2020 17:07:27 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] 在Ubuntu 14.04中安装gcc 6</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8ubuntu-14-04%e4%b8%ad%e5%ae%89%e8%a3%85gcc-6/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8ubuntu-14-04%e4%b8%ad%e5%ae%89%e8%a3%85gcc-6/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Fri, 14 Jul 2017 17:18:06 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[ELL]]></category>
		<category><![CDATA[Ubuntu 14.04]]></category>
		<category><![CDATA[安装gcc 6.3]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=9496</guid>

					<description><![CDATA[<p>
成功编译<a href="https://github.com/Microsoft/ELL" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122);">ELL</span></a>对gcc版本有要求，这而这一点在ELL的文档中并没有写。<br />
gcc版本太低了是不行的，那么什么算版本低？反正我的gcc 4.8.4是不work的&#8212;&#8212;使用低版本的gcc，你也可以照着文档完成很多步骤，但是到最后某一步，一定会遇到由于gcc版本低导致的问题，并且还没有直观的错误提示，查找问题源头可能会浪费你很多时间。<br />
<span id="more-9496"></span><br />
我在ELL的issue列表中看到有人说用gcc 6.3是OK的。但是，在Ubuntu 14.04上通过编译源码安装gcc 6并不那么容易。通过Google，我找到了如下<a href="http://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122);">这个</span></a>很棒的答案，只需要在命令行粘贴如下命令再回车，就安装上了gcc 6，实在太爽：</p>
<pre class="bash" style="padding: 6px; border-style: solid; border-color: rgb(153, 153, 153); background: rgb(244, 244, 255); color: rgb(15, 15, 15); font-size: 15px;">
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get update</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> build-essential software-properties-common <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> add-apt-repository ppa:ubuntu-toolchain-r<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(122, 8, 116); font-weight: bold;">test</span> <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get update</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> gcc-snapshot <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get update</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> gcc-<span style="color: rgb(0, 0, 0);">6</span> g++-<span style="color: rgb(0, 0, 0);">6</span> <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> update-alternatives <span style="color: rgb(102, 0, 51);">--install</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>gcc-<span style="color: rgb(0, 0, 0);">6</span> <span style="color: rgb(0, 0, 0);">60</span> <span style="color: rgb(102, 0, 51);">--slave</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>g++-<span style="color: rgb(0, 0, 0);">6</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> gcc-<span style="color: rgb(0, 0, 0);">4.8</span> g++-<span style="color: rgb(0, 0, 0);">4.8</span> <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&#38;&#38;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> update-alternatives <span style="color: rgb(102, 0, 51);">--install</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>gcc-<span style="color: rgb(0, 0, 0);">4.8</span> <span style="color: rgb(0, 0, 0);">60</span> <span style="color: rgb(102, 0, 51);">--slave</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>g++-<span style="color: rgb(0, 0, 0);">4.8</span>;</pre>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8ubuntu-14-04%e4%b8%ad%e5%ae%89%e8%a3%85gcc-6/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
成功编译<a href="https://github.com/Microsoft/ELL" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122);">ELL</span></a>对gcc版本有要求，这而这一点在ELL的文档中并没有写。<br />
gcc版本太低了是不行的，那么什么算版本低？反正我的gcc 4.8.4是不work的&mdash;&mdash;使用低版本的gcc，你也可以照着文档完成很多步骤，但是到最后某一步，一定会遇到由于gcc版本低导致的问题，并且还没有直观的错误提示，查找问题源头可能会浪费你很多时间。<br />
<span id="more-9496"></span><br />
我在ELL的issue列表中看到有人说用gcc 6.3是OK的。但是，在Ubuntu 14.04上通过编译源码安装gcc 6并不那么容易。通过Google，我找到了如下<a href="http://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122);">这个</span></a>很棒的答案，只需要在命令行粘贴如下命令再回车，就安装上了gcc 6，实在太爽：</p>
<pre class="bash" style="padding: 6px; border-style: solid; border-color: rgb(153, 153, 153); background: rgb(244, 244, 255); color: rgb(15, 15, 15); font-size: 15px;">
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get update</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> build-essential software-properties-common <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> add-apt-repository ppa:ubuntu-toolchain-r<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(122, 8, 116); font-weight: bold;">test</span> <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get update</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> gcc-snapshot <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get update</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> gcc-<span style="color: rgb(0, 0, 0);">6</span> g++-<span style="color: rgb(0, 0, 0);">6</span> <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> update-alternatives <span style="color: rgb(102, 0, 51);">--install</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>gcc-<span style="color: rgb(0, 0, 0);">6</span> <span style="color: rgb(0, 0, 0);">60</span> <span style="color: rgb(102, 0, 51);">--slave</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>g++-<span style="color: rgb(0, 0, 0);">6</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">apt-get install</span> gcc-<span style="color: rgb(0, 0, 0);">4.8</span> g++-<span style="color: rgb(0, 0, 0);">4.8</span> <span style="color: rgb(102, 0, 51);">-y</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">&amp;&amp;</span> \
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> update-alternatives <span style="color: rgb(102, 0, 51);">--install</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>gcc-<span style="color: rgb(0, 0, 0);">4.8</span> <span style="color: rgb(0, 0, 0);">60</span> <span style="color: rgb(102, 0, 51);">--slave</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span><span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">g++</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>usr<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>bin<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span>g++-<span style="color: rgb(0, 0, 0);">4.8</span>;</pre>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
安装完成后，使用如下命令选择gcc版本：</p>
<pre class="bash" style="padding: 6px; border-style: solid; border-color: rgb(153, 153, 153); background: rgb(244, 244, 255); color: rgb(15, 15, 15); font-size: 15px;">
<span style="color: rgb(194, 12, 185); font-weight: bold;">sudo</span> update-alternatives <span style="color: rgb(102, 0, 51);">--config</span> <span style="color: rgb(194, 12, 185); font-weight: bold;">gcc</span></pre>
<p>会打印出如下提示：</p>
<blockquote>
<div>
		There are 2 choices for the alternative gcc (providing /usr/bin/gcc).</div>
<div>
		&nbsp;</div>
<div>
		&nbsp; Selection &nbsp; &nbsp;Path &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Priority &nbsp; Status</div>
<div>
		------------------------------------------------------------</div>
<div>
		* 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/bin/gcc-6 &nbsp; &nbsp; 60 &nbsp; &nbsp; &nbsp; &nbsp;auto mode</div>
<div>
		&nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/bin/gcc-4.8 &nbsp; 60 &nbsp; &nbsp; &nbsp; &nbsp;manual mode</div>
<div>
		&nbsp; 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/usr/bin/gcc-6 &nbsp; &nbsp; 60 &nbsp; &nbsp; &nbsp; &nbsp;manual mode</div>
</blockquote>
<p>直接回车就是使用默认的gcc 6.3。<br />
此时，再用 gcc -v 命令检查一下版本，我的输出如下：</p>
<blockquote>
<div>
		Using built-in specs.</div>
<div>
		COLLECT_GCC=gcc</div>
<div>
		COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper</div>
<div>
		Target: x86_64-linux-gnu</div>
<div>
		Configured with: ...(内容很长，省略)</div>
<div>
		Thread model: posix</div>
<div>
		gcc version 6.3.0 20170519 (Ubuntu/Linaro 6.3.0-18ubuntu2~14.04)</div>
</blockquote>
<div>
	这就OK了。<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
		<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%9c%a8ubuntu-14-04%e4%b8%ad%e5%ae%89%e8%a3%85gcc-6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[原创] 升级Ubuntu 14.04上的Open MPI到 libmpi.so.12 版本</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%8d%87%e7%ba%a7ubuntu-14-04%e4%b8%8a%e7%9a%84open-mpi%e5%88%b0-libmpi-so-12-%e7%89%88%e6%9c%ac/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%8d%87%e7%ba%a7ubuntu-14-04%e4%b8%8a%e7%9a%84open-mpi%e5%88%b0-libmpi-so-12-%e7%89%88%e6%9c%ac/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Tue, 11 Jul 2017 17:41:51 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[libmpi.so.12]]></category>
		<category><![CDATA[Open MPI]]></category>
		<category><![CDATA[Ubuntu 14.04]]></category>
		<category><![CDATA[安装]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=9464</guid>

					<description><![CDATA[<p>
好好的为什么要折腾这个事？说来也是郁闷，在测试<a href="https://github.com/Microsoft/ELL" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">ELL</span></a>的过程中，遇到了一个Open MPI package依赖的问题，它要用到 libmpi.so.12 这个动态链接库对应版本的Open MPI，而Ubuntu 14.04系统上，用 <span style="color:#0000ff;">apt-get install libopenmpi-dev</span> 安装上的是很旧的版本，因此只能升级系统里已经安装的Open MPI了。<br />
<span id="more-9464"></span><br />
<span style="background-color:#00ff00;">『1』</span>使用Open MPI旧版本引起的错误<br />
运行ELL的demo程序<span style="color:#0000ff;">&#160;cntkDemo.py</span> 的时候，旧版本的Open MPI会导致的错误：</p>
<blockquote>
<div>
		OpenBLAS : Your OS does not support AVX instructions. OpenBLAS is using Nehalem kernels as a fallback, which may give poorer performance.</div></blockquote>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%8d%87%e7%ba%a7ubuntu-14-04%e4%b8%8a%e7%9a%84open-mpi%e5%88%b0-libmpi-so-12-%e7%89%88%e6%9c%ac/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p>
好好的为什么要折腾这个事？说来也是郁闷，在测试<a href="https://github.com/Microsoft/ELL" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">ELL</span></a>的过程中，遇到了一个Open MPI package依赖的问题，它要用到 libmpi.so.12 这个动态链接库对应版本的Open MPI，而Ubuntu 14.04系统上，用 <span style="color:#0000ff;">apt-get install libopenmpi-dev</span> 安装上的是很旧的版本，因此只能升级系统里已经安装的Open MPI了。<br />
<span id="more-9464"></span><br />
<span style="background-color:#00ff00;">『1』</span>使用Open MPI旧版本引起的错误<br />
运行ELL的demo程序<span style="color:#0000ff;">&nbsp;cntkDemo.py</span> 的时候，旧版本的Open MPI会导致的错误：</p>
<blockquote>
<div>
		OpenBLAS : Your OS does not support AVX instructions. OpenBLAS is using Nehalem kernels as a fallback, which may give poorer performance.</div>
<div>
		Traceback (most recent call last):</div>
<div>
		&nbsp; File &quot;/home/codelast/.miniconda3/envs/py36/lib/python3.6/site-packages/cntk/cntk_py.py&quot;, line 18, in swig_import_helper</div>
<div>
		&nbsp; &nbsp; return importlib.import_module(mname)</div>
<div>
		&nbsp; File &quot;/home/codelast/.miniconda3/envs/py36/lib/python3.6/importlib/__init__.py&quot;, line 126, in import_module</div>
<div>
		&nbsp; &nbsp; return _bootstrap._gcd_import(name[level:], package, level)</div>
<div>
		&nbsp; File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 978, in _gcd_import</div>
<div>
		&nbsp; File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 961, in _find_and_load</div>
<div>
		&nbsp; File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 948, in _find_and_load_unlocked</div>
<div>
		ModuleNotFoundError: No module named &#39;cntk._cntk_py&#39;</div>
<div>
		&nbsp;</div>
<div>
		During handling of the above exception, another exception occurred:</div>
<div>
		&nbsp;</div>
<div>
		Traceback (most recent call last):</div>
<div>
		&nbsp; File &quot;cntkDemo.py&quot;, line 7, in &lt;module&gt;</div>
<div>
		&nbsp; &nbsp; import cntk_to_ell</div>
<div>
		&nbsp; File &quot;./../../../../build/tools/importers/CNTK/cntk_to_ell.py&quot;, line 17, in &lt;module&gt;</div>
<div>
		&nbsp; &nbsp; from cntk.layers import Convolution, MaxPooling, AveragePooling, Dropout, BatchNormalization, Dense</div>
<div>
		&nbsp; File &quot;/home/codelast/.miniconda3/envs/py36/lib/python3.6/site-packages/cntk/__init__.py&quot;, line 10, in &lt;module&gt;</div>
<div>
		&nbsp; &nbsp; from . import cntk_py</div>
<div>
		&nbsp; File &quot;/home/codelast/.miniconda3/envs/py36/lib/python3.6/site-packages/cntk/cntk_py.py&quot;, line 21, in &lt;module&gt;</div>
<div>
		&nbsp; &nbsp; _cntk_py = swig_import_helper()</div>
<div>
		&nbsp; File &quot;/home/codelast/.miniconda3/envs/py36/lib/python3.6/site-packages/cntk/cntk_py.py&quot;, line 20, in swig_import_helper</div>
<div>
		&nbsp; &nbsp; return importlib.import_module(&#39;_cntk_py&#39;)</div>
<div>
		&nbsp; File &quot;/home/codelast/.miniconda3/envs/py36/lib/python3.6/importlib/__init__.py&quot;, line 126, in import_module</div>
<div>
		&nbsp; &nbsp; return _bootstrap._gcd_import(name[level:], package, level)</div>
<div>
		<span style="color:#ff0000;">ImportError: libmpi.so.12: cannot open shared object file: No such file or directory</span></div>
</blockquote>
<p>红色那一行是关键信息。<br />
<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="background-color: rgb(0, 255, 0);">『2』</span>检查Ubuntu 14.04上已经安装的Open MPI</p>
<div>
	在Ubuntu 14.04系统上：</div>
<blockquote>
<div>
		[codelast@ ~]$ ll /usr/lib/libmpi.so*</div>
<div>
		lrwxrwxrwx 1 root root 27 &nbsp;7月 12 00:03 /usr/lib/libmpi.so -&gt; /etc/alternatives/libmpi.so</div>
<div>
		lrwxrwxrwx 1 root root 15 12月 29 &nbsp;2013 /usr/lib/libmpi.so.1 -&gt; libmpi.so.1.0.8</div>
<div>
		lrwxrwxrwx 1 root root 27 12月 29 &nbsp;2013 /usr/lib/libmpi.so.1.0.8 -&gt; openmpi/lib/libmpi.so.1.0.8</div>
<div>
		&nbsp;</div>
<div>
		[codelast@ ~]$ apt-cache show libopenmpi-dev</div>
<div>
		Version: 1.6.5-8</div>
</blockquote>
<div>
	可见，1.6.5这个版本的Open MPI对应的动态链接库的版本远低于&nbsp;libmpi.so.12。<br />
	我们需要把Ubuntu 14.04系统里旧版的Open MPI卸载掉。<br />
	先查找：</p>
<blockquote>
<p>
			sudo dpkg -l | grep openmpi</p>
</blockquote>
<p>	然后视情况卸载。我卸载了下面这些：</p>
<blockquote>
<p>
			sudo apt-get remove libmpich-dev mpi-default-dev libopenmpi-dev libopenmpi1.6 openmpi-common</p>
</blockquote>
<p>	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="background-color:#00ff00;">『3』</span>确定&nbsp;libmpi.so.12 对应的Open MPI版本<br />
	要使用新版的Open MPI，只能自己编译安装了，因此，要先确定应该安装哪个版本的Open MPI，光有一个动态链接库名 libmpi.so.12 是不够的。<br />
	我在Google上搜了一下，查到 libmpi.so.12 应该是在Ubuntu 16.04系统上，用<span style="color:#0000ff;"> apt-get install libopenmpi-dev</span>&nbsp;安装上的版本，因此，我直接到一台Ubuntu 16.04系统的机器上试装了一下，果然如此。安装之后检查一下：</p>
<blockquote>
<div>
			[codelast@ ~]$ ll /usr/lib/libmpi.so*</div>
<div>
			lrwxrwxrwx 1 root root 27 7月 &nbsp;12 00:08 /usr/lib/libmpi.so -&gt; /etc/alternatives/libmpi.so</div>
<div>
			lrwxrwxrwx 1 root root 16 2月 &nbsp;26 &nbsp;2016 /usr/lib/libmpi.so.12 -&gt; libmpi.so.12.0.2</div>
<div>
			lrwxrwxrwx 1 root root 28 2月 &nbsp;26 &nbsp;2016 /usr/lib/libmpi.so.12.0.2 -&gt; openmpi/lib/libmpi.so.12.0.2</div>
<div>
			&nbsp;</div>
<div>
			[codelast@ ~]$ apt-cache show libopenmpi-dev</div>
<div>
			Version: 1.10.2-8ubuntu1</div>
</blockquote>
<div>
		可见，我们要找的Open MPI版本是 <span style="color:#ff0000;">1.10.2</span>。<br />
		<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
		<span style="background-color:#00ff00;">『4』</span>在Ubuntu 14.04上编译安装新版的Open MPI<br />
		到Open MPI网站的<a href="https://www.open-mpi.org/software/ompi/v1.10/" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">这个页面</span></a>上，下载 <span style="color:#ff0000;">1.10.2</span> 版本的包（<span style="color:#0000ff;">openmpi-1.10.2.tar.gz</span>），然后编译安装：</p>
<blockquote>
<div>
				tar zxf openmpi-1.10.2.tar.gz</div>
<div>
				cd openmpi-1.10.2/</div>
<div>
				./configure</div>
<div>
				make</div>
<div>
				sudo make install</div>
</blockquote>
<p>		如果一切顺利，新版的Open MPI就安装成功了。<br />
		为了保险，检查一下：</p>
<blockquote>
<div>
				[codelast@ ~]$ sudo find ./ -name libmpi.so.12</div>
<div>
				./usr/local/lib/libmpi.so.12</div>
</blockquote>
<div>
			说明真的成功了。<br />
			<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
			<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
			转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
			感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
				<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
</p></div>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-%e5%8d%87%e7%ba%a7ubuntu-14-04%e4%b8%8a%e7%9a%84open-mpi%e5%88%b0-libmpi-so-12-%e7%89%88%e6%9c%ac/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
