Here&#39;s how it works.<br>mpi4py is a module like any other.&nbsp; You build it with the python installation that you built all the other modules with, ala python setup.py build and install.&nbsp; In order for that to work, you need some mpi libraries installed.&nbsp; As I said, I prefer openmpi for this because they were the easiest for me to install and build mpi4py with.&nbsp; Before you do python build install in the mpi4py directory, you&#39;ll need to edit the .cfg file (can&#39;t remember exactly what it&#39;s called) so that the installation has the proper paths to your mpi install.<br>
<br>When you&#39;ve got mpi4py properly built, you will be able to run some yt operations in parallel in the following manner.<br>1. Whatever you want to do needs to be in some python script.&nbsp; As far as I know, you can&#39;t do parallel entering lines directly into the interpreter.<br>
Here&#39;s an example:<br><br>### Start<br>from yt.mods import *<br>from yt.config import ytcfg<br>pf = EnzoStaticOutput(&quot;EnzoRuns/cool_core_rediculous/DD0252/DD0252&quot;)<br>pc = PlotCollection(pf,center=[0.5,0.5,0.5])<br>
pc.add_projection(&quot;Density&quot;,0)<br><br>if ytcfg.getint(&quot;yt&quot;,&quot;__parallel_rank&quot;) == 0:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pc.save(&quot;DD0252&quot;)<br>### End<br>That if statement at the end assures that the final image save is done by the root process only.&nbsp; The nice thing is this script can be run in exactly the same form in serial, too.<br>
<br>2. Let&#39;s say this script is called proj.py.&nbsp; You&#39;ll run it like this:<br>mpirun -np 4 python proj.py --parallel<br><br>If you don&#39;t unclude the --parallel, you&#39;ll see 4 instances of your proj.py script running separately, but each one doing the entire projection and not working together.<br>
<br>Hope that helps,<br><br>Britton<br><br><div class="gmail_quote">On Fri, Feb 13, 2009 at 11:15 PM, rsoares <span dir="ltr">&lt;<a href="mailto:dlleuz@xmission.com">dlleuz@xmission.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">What Python do you parallelize to install mpi4py into - or do you build /use mpi4py without python, then how?<br>
<br>
R.Soares<br>
<br>
Britton Smith wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
I recommend using openmpi. &nbsp;I have been able to build openmpi on multiple platforms and then build mpi4py with it without any customization. &nbsp;As Matt has said, though, you won&#39;t see any benefit to using parallel until your simulations are at least 256^3 cells or more.<br>

<br></div><div class="Ih2E3d">
On Thu, Feb 12, 2009 at 8:16 PM, Matthew Turk &lt;<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a> &lt;mailto:<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>&gt;&gt; wrote:<br>

<br>
 &nbsp; &nbsp;Hi again,<br>
<br>
 &nbsp; &nbsp;I just realized that I should say a couple important caveats --<br>
<br>
 &nbsp; &nbsp;1. We haven&#39;t released &#39;yt-trunk&#39; as 1.5 yet because it&#39;s not quite<br>
 &nbsp; &nbsp;done or stable. &nbsp;It&#39;s going well, and many people use it for<br>
 &nbsp; &nbsp;production-quality work, but it&#39;s not really stamped-and-completed.<br>
 &nbsp; &nbsp;2. I should *also* note that you won&#39;t really get a lot out of<br>
 &nbsp; &nbsp;parallel yt unless you have relatively large datasets or relatively<br>
 &nbsp; &nbsp;large amounts of computation on each cell while creating a derived<br>
 &nbsp; &nbsp;field. &nbsp;It might end up being a bit more work than you&#39;re looking for,<br>
 &nbsp; &nbsp;if you just want to get some plots out quickly.<br>
<br>
 &nbsp; &nbsp;-Matt<br>
<br>
 &nbsp; &nbsp;On Thu, Feb 12, 2009 at 7:12 PM, Matthew Turk<br></div><div><div></div><div class="Wj3C7c">
 &nbsp; &nbsp;&lt;<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a> &lt;mailto:<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>&gt;&gt; wrote:<br>
 &nbsp; &nbsp;&gt; Hi!<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; yt-trunk is now parallelized. &nbsp;Not all tasks work in parallel, but<br>
 &nbsp; &nbsp;&gt; projections, profiles (if done in &#39;lazy&#39; mode) and halo finding (if<br>
 &nbsp; &nbsp;&gt; you use the SS_HopOutput module) are now parallelized. &nbsp;Slices are<br>
 &nbsp; &nbsp;&gt; almost done, and the new covering grid will be. &nbsp;It&#39;s not<br>
 &nbsp; &nbsp;documented,<br>
 &nbsp; &nbsp;&gt; but those tasks should all run in parallel. &nbsp;We will be rolling<br>
 &nbsp; &nbsp;out a<br>
 &nbsp; &nbsp;&gt; 1.5 release relatively soon, likely shortly after I defend my thesis<br>
 &nbsp; &nbsp;&gt; in April, that will have documentation and so forth.<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; I&#39;m surprised you can&#39;t compile against the mpich libraries in a<br>
 &nbsp; &nbsp;&gt; shared fashion. &nbsp;Unfortunately, I&#39;m not an expert on MPI<br>
 &nbsp; &nbsp;&gt; implementations, so I can&#39;t quite help out there. &nbsp;In my personal<br>
 &nbsp; &nbsp;&gt; experience, using OpenMPI, I have needed to except when running on<br>
 &nbsp; &nbsp;&gt; some form of linux without a loader -- the previous discussion about<br>
 &nbsp; &nbsp;&gt; this was related to Kraken, which runs a Cray-specific form of linux<br>
 &nbsp; &nbsp;&gt; called &quot;Compute Node Linux.&quot; &nbsp;I don&#39;t actually know offhand (anybody<br>
 &nbsp; &nbsp;&gt; else?) of any non-Cray machines at supercomputing out there require<br>
 &nbsp; &nbsp;&gt; static linking as opposed to a standard installation of Python.<br>
 &nbsp; &nbsp; (I&#39;m<br>
 &nbsp; &nbsp;&gt; sure they do, I just don&#39;t know of them!)<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; As for the second part, usually when instantiating you have to<br>
 &nbsp; &nbsp;run the<br>
 &nbsp; &nbsp;&gt; executable via mpirun. &nbsp;(On other MPI implementations, this could be<br>
 &nbsp; &nbsp;&gt; something different.) &nbsp;One option for this -- if you&#39;re running off<br>
 &nbsp; &nbsp;&gt; trunk -- would be to do something like:<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; mpirun -np 4 python my_script.py --parallel<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; where the file my_script.py has something like:<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; --<br>
 &nbsp; &nbsp;&gt; from yt.mods import *<br>
 &nbsp; &nbsp;&gt; pf = EnzoStaticOutput(&quot;my_output&quot;)<br>
 &nbsp; &nbsp;&gt; pc = PlotCollection(pf, center=[0.5,0.5,0.5])<br>
 &nbsp; &nbsp;&gt; pc.add_projection(&quot;Density&quot;,0)<br>
 &nbsp; &nbsp;&gt; pc.save(&quot;hi_there&quot;)<br>
 &nbsp; &nbsp;&gt; --<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; The projection would be executed in parallel, in this case.<br>
 &nbsp; &nbsp; (There is<br>
 &nbsp; &nbsp;&gt; a command line interface called &#39;yt&#39; that also works in<br>
 &nbsp; &nbsp;parallel, but<br>
 &nbsp; &nbsp;&gt; it&#39;s still a bit in flux.) &nbsp;You can&#39;t just run &quot;python&quot; because<br>
 &nbsp; &nbsp;of the<br>
 &nbsp; &nbsp;&gt; way the stdin and stdout streams work; you have to supply a<br>
 &nbsp; &nbsp;script, so<br>
 &nbsp; &nbsp;&gt; that it can proceed without input from the user. &nbsp;(IPython&#39;s<br>
 &nbsp; &nbsp;parallel<br>
 &nbsp; &nbsp;&gt; fanciness notwithstanding, which we do not use in yt.)<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; But, keep in mind, running &quot;mpirun -np 4&quot; by itself, wihtout setting<br>
 &nbsp; &nbsp;&gt; up a means of distributing tasks (usually via a tasklist) will run<br>
 &nbsp; &nbsp;&gt; them all on the current machine. &nbsp;I am, unfortunately, not really<br>
 &nbsp; &nbsp;&gt; qualified to speak to setting up MPI implementations. &nbsp;But please do<br>
 &nbsp; &nbsp;&gt; let us know if you have problems with the yt aspects of this!<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; -Matt<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;&gt; On Thu, Feb 12, 2009 at 6:59 PM, rsoares &lt;<a href="mailto:dlleuz@xmission.com" target="_blank">dlleuz@xmission.com</a><br></div></div><div class="Ih2E3d">
 &nbsp; &nbsp;&lt;mailto:<a href="mailto:dlleuz@xmission.com" target="_blank">dlleuz@xmission.com</a>&gt;&gt; wrote:<br>
 &nbsp; &nbsp;&gt;&gt; Hi,<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; I&#39;m trying to run mpi4py on my 4 machines, but I need a<br>
 &nbsp; &nbsp;parallelized version<br>
 &nbsp; &nbsp;&gt;&gt; of Python. Tried to compile one with Python 2.5 and mpich2 but<br>
 &nbsp; &nbsp;mpich2 won&#39;t<br>
 &nbsp; &nbsp;&gt;&gt; let me built dynamic /shares libraries which it needs. &nbsp;Trying<br>
 &nbsp; &nbsp;with the<br>
 &nbsp; &nbsp;&gt;&gt; static ones involves alot of headers errors from both.<br>
 &nbsp; &nbsp;&gt;&gt; Is yt-trunk capable of doing python in parallel?<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; Without parallel-python, I mpdboot -n 4 then<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; python<br>
 &nbsp; &nbsp;&gt;&gt;&gt;&gt;&gt;import MPI<br>
 &nbsp; &nbsp;&gt;&gt;&gt;&gt;&gt; rank, size = MPI.COMM_WORLD.rank, MPI.COMM_WORLD.size<br>
 &nbsp; &nbsp;&gt;&gt;&gt;&gt;&gt; print &#39;Hello World! I am process&#39;, rank, &#39;of&#39;, size<br>
 &nbsp; &nbsp;&gt;&gt; Hello World! I am process 0 of 1<br>
 &nbsp; &nbsp;&gt;&gt;&gt;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; not 4 processes, and &nbsp;mpirun -np 4 python just hangs. &nbsp;mpi4py<br>
 &nbsp; &nbsp;installed on<br>
 &nbsp; &nbsp;&gt;&gt; all 4 nodes.<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; Thanks.<br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;&gt; R.Soares<br>
 &nbsp; &nbsp;&gt;&gt; _______________________________________________<br>
 &nbsp; &nbsp;&gt;&gt; yt-users mailing list<br></div>
 &nbsp; &nbsp;&gt;&gt; <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a> &lt;mailto:<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a>&gt;<div class="Ih2E3d">
<br>
 &nbsp; &nbsp;&gt;&gt; <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
 &nbsp; &nbsp;&gt;&gt;<br>
 &nbsp; &nbsp;&gt;<br>
 &nbsp; &nbsp;_______________________________________________<br>
 &nbsp; &nbsp;yt-users mailing list<br></div>
 &nbsp; &nbsp;<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a> &lt;mailto:<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a>&gt;<div class="Ih2E3d">
<br>
 &nbsp; &nbsp;<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
 &nbsp;<br>
</div></blockquote>
</blockquote></div><br>