Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > be0974b2b8ed02af93714b256a53dd30 > files > 209

mpi4py-docs-1.2.2-6.fc15.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Installation &mdash; MPI for Python v1.2.2 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.2.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="MPI for Python v1.2.2 documentation" href="index.html" />
    <link rel="next" title="Tutorial" href="tutorial.html" />
    <link rel="prev" title="Design and Interface Overview" href="mpi4py.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="tutorial.html" title="Tutorial"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="mpi4py.html" title="Design and Interface Overview"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">MPI for Python v1.2.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
<div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
<p>You need to have the following software properly installed in order to
build <em>MPI for Python</em>:</p>
<ul>
<li><p class="first">A working MPI distribution, preferably a MPI-2 one built with
shared/dynamic libraries.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you want to build some MPI implementation from sources,
check the instructions at <a class="reference external" href="appendix.html#building-mpi"><em>Building MPI from sources</em></a> in the appendix.</p>
</div>
</li>
<li><p class="first">A Python 2.3 to 2.7 or 3.0 to 3.1 distribution, with Python
library preferably built with shared/dynamic libraries.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><strong>Mac OS X</strong> users employing a Python distribution built
with <strong>universal binaries</strong> may need to temporarily set the
environment variables <span class="target" id="index-9"></span><strong class="xref">MACOSX_DEPLOYMENT_TARGET</strong>,
<span class="target" id="index-10"></span><strong class="xref">SDKROOT</strong>, and <span class="target" id="index-11"></span><strong class="xref">ARCHFLAGS</strong> to appropriate values
in the shell before trying to build/install <em>MPI for
Python</em>. Check the instructions at <a class="reference external" href="appendix.html#macosx-universal-sdk"><em>Mac OS X and Universal/SDK Python builds</em></a> in
the appendix.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Some MPI-1 implementations <strong>do require</strong> the actual
command line arguments to be passed in <tt class="xref docutils literal"><span class="pre">MPI_Init()</span></tt>. In
this case, you will need to use a rebuilt, MPI-enabled, Python
interpreter executable. <em>MPI for Python</em> has some support for
alleviating you from this task. Check the instructions at
<a class="reference external" href="appendix.html#python-mpi"><em>MPI-enabled Python interpreter</em></a> in the appendix.</p>
</div>
</li>
</ul>
</div>
<div class="section" id="using-pip-or-easy-install">
<h2>Using <strong>pip</strong> or <strong>easy_install</strong><a class="headerlink" href="#using-pip-or-easy-install" title="Permalink to this headline">¶</a></h2>
<p>If you already have a working MPI (either if you installed it from
sources or by using a pre-built package from your favourite GNU/Linux
distribution) and the <strong>mpicc</strong> compiler wrapper is on your
search path, you can use <strong>pip</strong>:</p>
<div class="highlight-python"><pre>$ [sudo] pip install mpi4py</pre>
</div>
<p>or alternatively <em>setuptools</em> <strong>easy_install</strong> (deprecated):</p>
<div class="highlight-python"><pre>$ [sudo] easy_install mpi4py</pre>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>If the <strong>mpicc</strong> compiler wrapper is not on your
search path (or if it has a different name) you can use
<strong>env</strong> to pass the environment variable <span class="target" id="index-12"></span><strong class="xref">MPICC</strong>
providing the full path to the MPI compiler wrapper executable:</p>
<div class="last highlight-python"><pre>$ [sudo] env MPICC=/path/to/mpicc pip install mpi4py

$ [sudo] env MPICC=/path/to/mpicc easy_install mpi4py</pre>
</div>
</div>
</div>
<div class="section" id="using-distutils">
<h2>Using <strong>distutils</strong><a class="headerlink" href="#using-distutils" title="Permalink to this headline">¶</a></h2>
<p><em>MPI for Python</em> uses a standard distutils-based buildsystem. However,
some distutils commands (like <em>build</em>) have additional options:</p>
<ul class="simple">
<li><em class="xref">--mpicc=</em> : let you specify a special location or name for
the <strong>mpicc</strong> compiler wrapper.</li>
<li><em class="xref">--mpi=</em> : let you pass a section with MPI configuration
within a special configuration file.</li>
<li><em class="xref">--configure</em> : runs exhaustive tests for checking about
missing MPI types/constants/calls. This option should be passed in
order to build <em>MPI for Python</em> against old MPI-1 implementations,
possibly providing a subset of MPI-2.</li>
</ul>
<div class="section" id="downloading">
<h3>Downloading<a class="headerlink" href="#downloading" title="Permalink to this headline">¶</a></h3>
<p>The <em>MPI for Python</em> package is available for download at the project
website generously hosted by Google Code. You can use <strong>curl</strong>
o <strong>wget</strong> to get a release tarball:</p>
<div class="highlight-python"><pre>$ curl -O http://mpi4py.googlecode.com/files/mpi4py-X.X.X.tar.gz

$ wget http://mpi4py.googlecode.com/files/mpi4py-X.X.X.tar.gz</pre>
</div>
</div>
<div class="section" id="building">
<h3>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h3>
<p>After unpacking the release tarball:</p>
<div class="highlight-python"><pre>$ tar -zxf mpi4py-X.X.X.tar.gz
$ cd mpi4py-X.X.X</pre>
</div>
<p>the distribution is ready for building.</p>
<ul>
<li><p class="first">If you use a MPI implementation providing a <strong>mpicc</strong>
compiler wrapper (e.g., MPICH 1/2, Open MPI, LAM), it will be used
for compilation and linking. This is the preferred and easiest way
of building <em>MPI for Python</em>.</p>
<p>If <strong>mpicc</strong> is located somewhere in your search path, simply
run the <em>build</em> command:</p>
<div class="highlight-python"><pre>$ python setup.py build</pre>
</div>
<p>If <strong>mpicc</strong> is not in your search path or the compiler
wrapper has a different name, you can run the <em>build</em> command
specifying its location:</p>
<div class="highlight-python"><pre>$ python setup.py build --mpicc=/where/you/have/mpicc</pre>
</div>
</li>
<li><p class="first">Alternatively, you can provide all the relevant information about
your MPI distribution by editing the file called
<tt class="docutils literal"><span class="pre">mpi.cfg</span></tt>. You can use the default section <tt class="docutils literal"><span class="pre">[mpi]</span></tt> or add a
new, custom section, for example <tt class="docutils literal"><span class="pre">[my_mpi]</span></tt> (see the examples
provided in the <tt class="docutils literal"><span class="pre">mpi.cfg</span></tt> file):</p>
<div class="highlight-python"><pre>[mpi]

include_dirs         = /usr/local/mpi/include
libraries            = mpi
library_dirs         = /usr/local/mpi/lib
runtime_library_dirs = /usr/local/mpi/lib

[other_mpi]

include_dirs         = /opt/mpi/include ...
libraries            = mpi ...
library_dirs         = /opt/mpi/lib ...
runtime_library_dirs = /op/mpi/lib ...

...</pre>
</div>
<p>and then run the <em>build</em> command, perhaps specifying you custom
configuration section:</p>
<div class="highlight-python"><pre>$ python setup.py build --mpi=other_mpi</pre>
</div>
</li>
</ul>
</div>
<div class="section" id="installing">
<h3>Installing<a class="headerlink" href="#installing" title="Permalink to this headline">¶</a></h3>
<p>After building, the distribution is ready for install.</p>
<p>If you have root privileges (either by log-in as the root user of by
using <strong>sudo</strong>) and you want to install <em>MPI for Python</em> in
your system for all users, just do:</p>
<div class="highlight-python"><pre>$ python setup.py install</pre>
</div>
<p>The previous steps will install the <tt class="xref docutils literal"><span class="pre">mpi4py</span></tt> package at standard
location <tt class="docutils literal"><em><span class="pre">prefix</span></em><span class="pre">/lib/python</span><em><span class="pre">X</span></em><span class="pre">.</span><em><span class="pre">X</span></em><span class="pre">/site-packages</span></tt>.</p>
<p>If you do not have root privileges or you want to install <em>MPI for
Python</em> for your private use, you have two options depending on the
target Python version.</p>
<ul>
<li><p class="first">For Python 2.6 and up:</p>
<div class="highlight-python"><pre>$ python setup.py install --user</pre>
</div>
</li>
<li><p class="first">For Python 2.5 and below (assuming your home directory is available
through the <span class="target" id="index-13"></span><strong class="xref">HOME</strong> environment variable):</p>
<div class="highlight-python"><pre>$ python setup.py install --home=$HOME</pre>
</div>
<p>Finally, add <tt class="docutils literal"><span class="pre">$HOME/lib/python</span></tt> or <tt class="docutils literal"><span class="pre">$HOME/lib64/python</span></tt>
to your <span class="target" id="index-14"></span><strong class="xref">PYTHONPATH</strong> environment variable.</p>
</li>
</ul>
</div>
<div class="section" id="testing">
<h3>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h3>
<p>Issuing at the command line:</p>
<div class="highlight-python"><pre>$ mpiexec -n 5 python demo/helloworld.py</pre>
</div>
<p>or (in the case of older MPI-1 implementations):</p>
<div class="highlight-python"><pre>$ mpirun -np 5 python demo/helloworld.py</pre>
</div>
<p>will launch a five-process run of the Python interpreter and run the
test scripts <tt class="docutils literal"><span class="pre">demo/helloworld.py</span></tt>.</p>
<p>You can also run all the <em>unittest</em> scripts:</p>
<div class="highlight-python"><pre>$ mpiexec -n 5 python test/runalltest.py</pre>
</div>
<p>or, if you have <a class="reference external" href="http://somethingaboutorange.com/mrl/projects/nose/">nose</a> unit testing framework installed:</p>
<div class="highlight-python"><pre>$ mpiexec -n 5 nosetests -w test</pre>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">Installation</a><ul>
<li><a class="reference external" href="#requirements">Requirements</a></li>
<li><a class="reference external" href="#using-pip-or-easy-install">Using <strong>pip</strong> or <strong>easy_install</strong></a></li>
<li><a class="reference external" href="#using-distutils">Using <strong>distutils</strong></a><ul>
<li><a class="reference external" href="#downloading">Downloading</a></li>
<li><a class="reference external" href="#building">Building</a></li>
<li><a class="reference external" href="#installing">Installing</a></li>
<li><a class="reference external" href="#testing">Testing</a></li>
</ul>
</li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="mpi4py.html"
                                  title="previous chapter">Design and Interface Overview</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="tutorial.html"
                                  title="next chapter">Tutorial</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/install.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="tutorial.html" title="Tutorial"
             >next</a></li>
        <li class="right" >
          <a href="mpi4py.html" title="Design and Interface Overview"
             >previous</a> |</li>
        <li><a href="index.html">MPI for Python v1.2.2 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, Lisandro Dalcin.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.6.
    </div>
  </body>
</html>