• Showing Page History #49398

Show page source of インテル_コンパイラーでオープンソースソフトウェアをコンパイルしよう_p1 #49709

[[PageNavi(NavigationList)]]

== インテル コンパイラーでオープンソースソフトウェアをコンパイルしよう ==




 インテルの「インテル C++ コンパイラー」は高速なバイナリを生成するということで知られている。いっぽうWindowsの世界ではマイクロソフトのVisual C++が、LinuxではオープンソースのGCCが事実上標準のコンパイラになっており、多くのオープンソースソフトウェアはこれらのコンパイラでコンパイルされている。そのため、利用したいソフトウェアがインテル コンパイラーでコンパイルできるのか興味のある人も多いだろう。また、Visual C++やGCCでコンパイルされたものと比べ、どのくらいパフォーマンスが違うのかも気になるところだ。


 インテル C++ コンパイラーはVisual C++やGCCとの互換性を備えているものの、完全に同一というわけではない。そこで、有名なオープンソースソフトウェアについてインテル C++ コンパイラーでのコンパイルを行い、どの程度の修正でコンパイルが可能なのか、またそのパフォーマンスはどうなのか、調査してみよう。


 なお、今回の記事ではインテル C++コンパイラー 11.0の無償体験版を使用している。この体験版はインテル コンパイラーの国内代理店である[http://www.xlsoft.com/jp/products/intel/download.html?sfwiki エクセルソフトのWebサイト]からダウンロード可能だ。ぜひ読者の皆さんも手元でインテル コンパイラーを試してほしい。

==== オープンソースソフトウェアでも実績が多いインテル コンパイラー ====


 実際の作業を説明する前に、まずはインテル コンパイラーでのコンパイルを利用するにあたって役に立つであろう資料を紹介しておこう。


 まず、インテル コンパイラーのもっとも貴重な情報源となるのが、開発元であるインテルのWebサイトである。インテルのWebサイトでは、LinuxカーネルやSTLport、POV-rayなどのソフトウェアについて、インテル コンパイラーでのコンパイル方法を解説したドキュメントが公開されている('''表1''')。


 用意されているドキュメントは数値演算系や画像処理系のソフトウェア/ライブラリが多いが、これらはインテル コンパイラーが得意とする領域であり、高速化が期待できる。もしこれらのソフトウェア/ライブラリを利用しているなら、インテル コンパイラーを試してみる価値があるだろう。
{{{ html
<h6>表1 インテルのWebサイトで公開されているオープンソースソフトウェアのコンパイル解説ドキュメント</h6>
<table class="wikitable" border="1">

<tr><th>ソフトウェア</th><th>説明</th></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-kernel-building/">Linuxカーネル</a></td><td>OS</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-pgplot-with-the-intel-compilers/">PGPLOT</a></td><td>プロット画像作成ライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-ncar-graphics-with-the-intel-compilers/">NCAR</a></td><td>ドロー画像ライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-wrf-with-the-intel-compilers/">WRF</a></td><td>気象モデリングシステム</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-hdf5-with-intel-compilers">HDF5</a></td><td>クラスタライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-building-upc-to-utilize-the-intel-c-compiler/">UPC</a></td><td>並列言語処理系</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-windows-building-fftw-with-the-intel-compilers/">FFTW</a></td><td>高速フーリエ変換ライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-windows-how-to-build-stlport-515-with-intel-c-compiler-for-windows-10xxxx/">stlport</a></td><td>C++標準ライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/compilepovray/">POV-Ray</a></td><td>3D画像レンダラー</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers/">NetCDF</a></td><td>科学用データフォーマットライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-open-mpi-with-the-intel-compilers/">Open MPI</a></td><td>並列化ライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-the-hpcc-benchmark/">HPCC bnechmark</a></td><td>ベンチマークツール</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-building-acetao-with-intel-c-compiler-for-linux/">ACE+TAO</a></td><td>分散コンポーネント</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-building-xerces-with-intel-c-compiler-for-linux/">Xerces</a></td><td>XML処理ライブラリ</td></tr>
<tr><td><a href="http://software.intel.com/en-us/articles/intel-c-compiler-for-linux-building-quantlib-with-intel-c-compiler-for-linux/">Quantlib</a></td><td>金融/財務処理ライブラリ</td></tr>

</table>
}}}


 また、ソフトウェアによってはVisual C++やGCCでコンパイルしたバイナリだけでなく、インテル コンパイラーでコンパイルしたバイナリも配布されている場合がある('''表2''')。このようなバイナリは有志がコンパイルして配布していることが多く、公式版と比べてパフォーマンスが高いものが多いようだ。ただし、公開されているバージョンが古い場合もあるので注意してほしい。
{{{ html
<h6>表2 インテル コンパイラーでコンパイルされたバイナリが配布されているソフトウェア例</h6>
<table class="wikitable" border="1">

<tr><th>ソフトウェア</th><th>配布先/配布者</th></tr>
<tr><td>MySQL</td><td><a href="http://dev.mysql.com/downloads/">公式ダウンロードページ</a></td></tr>
<tr><td>Blender</td><td><a href="http://www.woogieworks.at/blog/?cat=3">!WoogieWorks Animation Studio</a></td></tr>
<tr><td>FFTW</td><td><a href="http://www.ece.cmu.edu/~franzf/fftw.org/">Franz Franchetti</a></td></tr>
<tr><td>x264</td><td><a href="http://seraphy.fam.cx/~seraphy/pg_mod.html">seraphyのプログラム公開所</a>(「x264 詰め合わせ」の「おまけ」以下)</td></tr>
<tr><td>lame</td><td><a href="http://www.rarewares.org/mp3-lame-bundle.php">RAREWARES</a></td></tr>

</table>
}}}


 例えば、上記で配布されているBlenderのインテル コンパイラー版バイナリを使い、Core 2 Duo E6550(2.33GHz)を搭載したマシンで[http://www.eofw.org/bench/ Blender Render Benchmark]で配布されているテストファイルをレンダリングしたところ、公式版よりも1.5倍程度高速であった('''表3''')。
{{{ html
<h6>表3 Blenderでテストファイル(test.blend)のレンダリングにかかった時間(3回の平均)</h6>
<table class="wikitable" border="1">

<tr><th>バイナリ</th><th>レンダリング時間</th></tr>
<tr><td>公式版(Visual C++ 2008 SP2)</td><td>3:13:18</td></tr>
<tr><td>インテル コンパイラー版(SSE3対応)</td><td>2:01:06</td></tr>

</table>
}}}


 また、「[インテル_コンパイラーの実力を測る――インテル_コンパイラー版MySQLは本当に速いのか?_p1 インテル コンパイラーの実力を測る――インテル コンパイラー版MySQLは本当に速いのか?]」記事では、インテル コンパイラーによるMySQLの高速化についても調査しているので、そちらも参照してほしい。


[[PageNavi(NavigationList)]]