<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3743468291862178152</id><updated>2012-02-17T00:22:29.271+01:00</updated><category term='parallel'/><category term='mpi'/><category term='hpc'/><title type='text'>Scientific, Parallel, Open Source Software</title><subtitle type='html'>A blog about software, tools, programming languages, programming models and trends in high-performance computing and Molecular Dynamics (MD) simulations.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://olenz.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743468291862178152/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://olenz.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Olaf Lenz</name><uri>https://profiles.google.com/114544162646817908485</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-YPFn1Bljq8U/AAAAAAAAAAI/AAAAAAAAAB0/1Abx5VZx_Nc/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3743468291862178152.post-285827461704407515</id><published>2011-11-04T08:32:00.001+01:00</published><updated>2011-11-04T08:33:16.134+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hpc'/><title type='text'></title><content type='html'>A very nice infographics on the growth of computing power since the mechanical calculators! &lt;a href="http://www.popsci.com/content/computing"&gt;http://www.popsci.com/content/computing&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743468291862178152-285827461704407515?l=olenz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://olenz.blogspot.com/feeds/285827461704407515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://olenz.blogspot.com/2011/11/very-nice-infographics-on-growth-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743468291862178152/posts/default/285827461704407515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743468291862178152/posts/default/285827461704407515'/><link rel='alternate' type='text/html' href='http://olenz.blogspot.com/2011/11/very-nice-infographics-on-growth-of.html' title=''/><author><name>Olaf Lenz</name><uri>https://profiles.google.com/114544162646817908485</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-YPFn1Bljq8U/AAAAAAAAAAI/AAAAAAAAAB0/1Abx5VZx_Nc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743468291862178152.post-5224615082035652714</id><published>2011-09-09T09:37:00.000+02:00</published><updated>2011-09-20T10:38:39.622+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mpi'/><category scheme='http://www.blogger.com/atom/ns#' term='parallel'/><title type='text'>MPI: Sendrecv</title><content type='html'>MPI provides a function &lt;code&gt;MPI_Sendrecv&lt;/code&gt; that can be used to shift data along a group of processes. Within ESPResSo, this is not used at all so far. Instead, shifting data is done manually via calls to &lt;code&gt;MPI_Send&lt;/code&gt; and &lt;code&gt;MPI_Recv&lt;/code&gt; which have to be interleaved correctly.&lt;br /&gt;&lt;br /&gt;Of course, doing it manually is far more complex and error-prone, but I also had the suspicion that it might be significantly slower, as there are plenty of possiblities to optimize code like that on the side of the MPI implmentation.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Test program&lt;/h2&gt;To test whether there are differences in speed, I have written a little C program that shifts a float value along a chain of processors, and does so a million times. The following is an excerpt from the test program that shows the core routines:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:c"&gt;void do_sendrecv() {&lt;br /&gt;  float send_data = rank;&lt;br /&gt;  float recv_data;&lt;br /&gt;  for (int i=0; i &amp;lt; N; i++) {&lt;br /&gt;    MPI_Sendrecv(&amp;amp;send_data, 1, MPI_FLOAT, next, 42, &lt;br /&gt;   &amp;amp;recv_data, 1, MPI_FLOAT, prev, 42,&lt;br /&gt;   comm, 0);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void do_sendrecv_replace() {&lt;br /&gt;  float data = rank;&lt;br /&gt;  for (int i=0; i &amp;lt; N; i++) {&lt;br /&gt;    MPI_Sendrecv_replace(&amp;amp;data, 1, MPI_FLOAT, &lt;br /&gt;    next, 42, prev, 42,&lt;br /&gt;    comm, 0);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void do_manual() {&lt;br /&gt;  float data = rank;&lt;br /&gt;  for (int i=0; i &amp;lt; N; i++) {&lt;br /&gt;    if (rank%2) {&lt;br /&gt;      MPI_Send(&amp;amp;data, 1, MPI_INT, next, 42, comm);&lt;br /&gt;      MPI_Recv(&amp;amp;data, 1, MPI_INT, prev, 42, comm, 0);&lt;br /&gt;    } else {&lt;br /&gt;      MPI_Recv(&amp;amp;data, 1, MPI_INT, prev, 42, comm, 0);&lt;br /&gt;      MPI_Send(&amp;amp;data, 1, MPI_INT, next, 42, comm);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;Results&lt;/h2&gt;4 Tasks, OpenMPI 1.4.3 with gcc 4.5.0 (-O3) on an Intel Core2 Quad CPU (2.8 GHz):&lt;br /&gt;&lt;pre&gt;sendrecv:         1.487827 s (1.000000)&lt;br /&gt;sendrecv_replace: 1.490810 s (1.002005)&lt;br /&gt;manual:           2.062941 s (1.386547)&lt;br /&gt;&lt;/pre&gt;That is a difference of 40%! From the results it seems obvious to me that it is a very good idea to use &lt;code&gt;MPI_Sendrecv&lt;/code&gt; whenever it is applicable instead of doing so manually!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743468291862178152-5224615082035652714?l=olenz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://olenz.blogspot.com/feeds/5224615082035652714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://olenz.blogspot.com/2011/09/mpi-sendrecv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743468291862178152/posts/default/5224615082035652714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743468291862178152/posts/default/5224615082035652714'/><link rel='alternate' type='text/html' href='http://olenz.blogspot.com/2011/09/mpi-sendrecv.html' title='MPI: Sendrecv'/><author><name>Olaf Lenz</name><uri>https://profiles.google.com/114544162646817908485</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-YPFn1Bljq8U/AAAAAAAAAAI/AAAAAAAAAB0/1Abx5VZx_Nc/s512-c/photo.jpg'/></author><thr:total>0</thr:total><georss:featurename>Stuttgart, Deutschland</georss:featurename><georss:point>48.7771056 9.18076880000001</georss:point><georss:box>48.6814846 9.03997830000001 48.8727266 9.32155930000001</georss:box></entry></feed>
