1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Design Philosophy</title> 6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="../mpi.html" title="Chapter 26. Boost.MPI"> 10<link rel="prev" href="python.html" title="Python Bindings"> 11<link rel="next" href="performance.html" title="Performance Evaluation"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td> 16<td align="center"><a href="../../../index.html">Home</a></td> 17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="python.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mpi.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="performance.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="section"> 27<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 28<a name="mpi.design"></a><a class="link" href="design.html" title="Design Philosophy">Design Philosophy</a> 29</h2></div></div></div> 30<p> 31 The design philosophy of the Parallel MPI library is very simple: be both convenient 32 and efficient. MPI is a library built for high-performance applications, but 33 it's FORTRAN-centric, performance-minded design makes it rather inflexible 34 from the C++ point of view: passing a string from one process to another is 35 inconvenient, requiring several messages and explicit buffering; passing a 36 container of strings from one process to another requires an extra level of 37 manual bookkeeping; and passing a map from strings to containers of strings 38 is positively infuriating. The Parallel MPI library allows all of these data 39 types to be passed using the same simple <code class="computeroutput"><span class="identifier">send</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">recv</span><span class="special">()</span></code> primitives. Likewise, collective operations 40 such as <code class="computeroutput"><a class="link" href="../boost/mpi/reduce.html" title="Function reduce">reduce()</a></code> allow arbitrary data types 41 and function objects, much like the C++ Standard Library would. 42 </p> 43<p> 44 The higher-level abstractions provided for convenience must not have an impact 45 on the performance of the application. For instance, sending an integer via 46 <code class="computeroutput"><span class="identifier">send</span></code> must be as efficient as 47 a call to <code class="computeroutput"><span class="identifier">MPI_Send</span></code>, which means 48 that it must be implemented by a simple call to <code class="computeroutput"><span class="identifier">MPI_Send</span></code>; 49 likewise, an integer <code class="computeroutput"><a class="link" href="../boost/mpi/reduce.html" title="Function reduce">reduce()</a></code> using <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">plus</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span></code> must 50 be implemented with a call to <code class="computeroutput"><span class="identifier">MPI_Reduce</span></code> 51 on integers using the <code class="computeroutput"><span class="identifier">MPI_SUM</span></code> 52 operation: anything less will impact performance. In essence, this is the "don't 53 pay for what you don't use" principle: if the user is not transmitting 54 strings, s/he should not pay the overhead associated with strings. 55 </p> 56<p> 57 Sometimes, achieving maximal performance means foregoing convenient abstractions 58 and implementing certain functionality using lower-level primitives. For this 59 reason, it is always possible to extract enough information from the abstractions 60 in Boost.MPI to minimize the amount of effort required to interface between 61 Boost.MPI and the C MPI library. 62 </p> 63</div> 64<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 65<td align="left"></td> 66<td align="right"><div class="copyright-footer">Copyright © 2005-2007 Douglas Gregor, 67 Matthias Troyer, Trustees of Indiana University<p> 68 Distributed under the Boost Software License, Version 1.0. (See accompanying 69 file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt"> 70 http://www.boost.org/LICENSE_1_0.txt </ulink>) 71 </p> 72</div></td> 73</tr></table> 74<hr> 75<div class="spirit-nav"> 76<a accesskey="p" href="python.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mpi.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="performance.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> 77</div> 78</body> 79</html> 80