<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tunç Bahçecioğlu &#187; coding</title>
	<atom:link href="http://www.tuncbahcecioglu.com/posts/tag/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tuncbahcecioglu.com</link>
	<description>carpe omnium</description>
	<lastBuildDate>Tue, 26 Oct 2010 13:43:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>delphi and mpi, closer look 2</title>
		<link>http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/</link>
		<comments>http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 11:11:42 +0000</pubDate>
		<dc:creator>tunc</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[mpi]]></category>

		<guid isPermaLink="false">http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/</guid>
		<description><![CDATA[It is pretty simple to install and use MPI with Delphi, fortunately for us programming the MPI is no bother too. The second part is about calling MPI functions from Delphi. Name Convention No change here. Since we are using a direct translation of the original MPI header, all the original names are there. Sending, [...]]]></description>
			<content:encoded><![CDATA[<p>It is pretty simple to install and use MPI with Delphi, fortunately for us programming the MPI is no bother too.</p>
<p>The second part is about calling MPI functions from Delphi.</p>
<p><span id="more-56"></span></p>
<h3>Name Convention</h3>
<p>No change here. Since we are using a direct translation of the original MPI header, all the original names are there.</p>
<h3>Sending, Receiving Data</h3>
<p>No surprise here too, here are some pointers:</p>
<h5>Variables</h5>
<p>Since MPI needs pointers to variables, use @ operator to get the pointer to your variables.</p>
<p>MPI_Comm_rank(MPI_COMM_WORLD,@myid);</p>
<p>For getting the size of variables use the sizeoff function.</p>
<h5>Arrays</h5>
<p>Again we need the starting address of the arrays.</p>
<p>Lets say we have an array named as “sizeArray”</p>
<p>For dynamic arrays use @(sizeArray[0])</p>
<p>For static arrays use  @(sizeArray[1]) //  assuming the array starts from 1</p>
<h5>Strings</h5>
<p>Since no one knows the memory map of a Delphi string you cannot use them with MPI. You have to go with short strings.</p>
<h3>Debugging</h3>
<p>Bad news here, Delphi has no support for parallel debugging. You have to go with displaying data to screen, or using a log file.</p>
<p>I was going to write a 3rd article about creating parallel applications with GUI, but since it is a general subject I decided to write the article separately, so this series and here.</p>
<ul class="related_post"><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/" title="Delphi and mpi in 4 steps">Delphi and mpi in 4 steps</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/optimum-design-of-high-rise-steel-buildings-using-an-evolution-strategy-integrated-parallel-algorithm/" title="Optimum Design of High-Rise Steel Buildings using an Evolution Strategy Integrated Parallel Algorithm">Optimum Design of High-Rise Steel Buildings using an Evolution Strategy Integrated Parallel Algorithm</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-1/" title="DELPHI and MPI, closer look 1">DELPHI and MPI, closer look 1</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/" title="send std::string with mpi">send std::string with mpi</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/mpi-debugging-with-visual-studio/" title="MPI Debugging with Visual Studio">MPI Debugging with Visual Studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/a-comparative-study-on-two-different-direct-parallel-solution-strategies-for-large-scale-problems/" title="A Comparative Study on Two Different Direct Parallel Solution Strategies for Large-Scale Problems">A Comparative Study on Two Different Direct Parallel Solution Strategies for Large-Scale Problems</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/pugg/" title="pugg">pugg</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/" title="Installing boost for visual studio">Installing boost for visual studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/what-i-need-from-delphi-2010/" title="what i need from delphi 2010">what i need from delphi 2010</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>pugg</title>
		<link>http://www.tuncbahcecioglu.com/posts/pugg/</link>
		<comments>http://www.tuncbahcecioglu.com/posts/pugg/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 00:15:30 +0000</pubDate>
		<dc:creator>tunc</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[pugg]]></category>

		<guid isPermaLink="false">http://www.tuncbahcecioglu.com/posts/pugg/</guid>
		<description><![CDATA[a c++ framework for plug-in management Features Header only library, no installation Auto loading of plug-ins from files Version control for plug-ins Object oriented design Web Pages http://pugg.sourceforge.net/ https://sourceforge.net/projects/pugg/ Installing boost for visual studiosend std::string with mpidelphi and mpi, closer look 2Delphi and mpi in 4 steps]]></description>
			<content:encoded><![CDATA[<h3>a c++ framework for plug-in management </h3>
<h4>Features</h4>
<ul>
<li>Header only library, no installation </li>
<li>Auto loading of plug-ins from files </li>
<li>Version control for plug-ins </li>
<li>Object oriented design </li>
</ul>
<h4>Web Pages</h4>
<p><a href="http://pugg.sourceforge.net/">http://pugg.sourceforge.net/</a>    <br /><a href="https://sourceforge.net/projects/pugg/">https://sourceforge.net/projects/pugg/</a></p>
<ul class="related_post"><li><a href="http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/" title="Installing boost for visual studio">Installing boost for visual studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/" title="send std::string with mpi">send std::string with mpi</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/" title="delphi and mpi, closer look 2">delphi and mpi, closer look 2</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/" title="Delphi and mpi in 4 steps">Delphi and mpi in 4 steps</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.tuncbahcecioglu.com/posts/pugg/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing boost for visual studio</title>
		<link>http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/</link>
		<comments>http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 00:06:01 +0000</pubDate>
		<dc:creator>tunc</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/</guid>
		<description><![CDATA[Boost is a collection of free libraries for c++, kind of a Swiss knife for the c++ geek. Most of boost is actually header only and don&#8217;t need any installation. To use the small dark part of boost you need to install them, well built them, here is how: Short, Softcore Method: Go to BoostPro [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.boost.org/"><span style="text-decoration: underline;"><span style="color: #0066cc;">Boost </span></span></a>is a collection of free libraries for c++, kind of a Swiss knife for the c++ geek.<br />
Most of boost is actually header only and don&#8217;t need any installation. To use the small dark part of boost<br />
you need to install them, well built them, here is how:</p>
<h1>Short, Softcore Method:</h1>
<p>Go to <a href="http://www.boostpro.com/download"><span style="text-decoration: underline;"><span style="color: #0066cc;">BoostPro Computing</span></span></a> and download a web installer. Follow the installer instructions.<br />
It needs a free registration, and it does not contain some libraries like Boost.Python</p>
<h1>Long, Hardcore Method<span style="font-size: 22px;">:</span></h1>
<p>This is the programmers way., we will built the libraries ourselves.</p>
<p><strong>1.We start by downloading Boost Source code from </strong><a href="http://sourceforge.net/project/showfiles.php?group_id=7586&amp;package_id=8041&amp;release_id=679861"><span style="text-decoration: underline;"><span style="color: #0066cc;">Sourceforge</span></span></a><strong> </strong></p>
<p><span id="more-34"></span><strong>2.Extract the zip file  to a nice </strong><strong>folder, for me it is c:\Program Files\Boost\</strong></p>
<p><strong>3.Build BJam</strong></p>
<p>Bjam is a tool that will help us built BOOST, but we first have to built it:<br />
-Open visual studio Comman Prompt ,<br />
start-&gt;All Programs-&gt;Microsoft Visual Studio 2005-&gt;visual studio tools-&gt;visual studio command prompt<br />
cd C:\Program Files\boost\boost_1_39_0\tools\jam\src&gt;<br />
built.bat<br />
This made the following C:\Program Files\boost\boost_1_39_0\tools\jam\src\bin.ntx86\bjam.exe<br />
Now copy bjam.exe to the root boost directory : C:\Program Files\boost\boost_1_39_0\<br />
<strong></strong></p>
<p><strong>4.Build Boost</strong></p>
<p>from the visual studio command promt go to C:\Program Files\boost\boost_1_39_0\<br />
For a complete set of libraries use the following:<br />
bjam &#8211;toolset=msvc-8.0 &#8211;build-type=complete<br />
If you want a sub set here are your options:<br />
bjam toolset=msvc-8.0 variant=debug threading=multi link=shared<br />
bjam toolset=msvc-8.0 variant=release threading=multi link=static<br />
Now this will take some time&#8230;</p>
<p><strong>5.Enjoy</strong></p>
<p>Your lib directory is C:\Program Files\boost\boost_1_39_0\stage\lib<br />
Yout include directory is C:\Program Files\boost\boost_1_39_0\include</p>
<p>For details of this process you can refer to <a href="http://www.boost.org/doc/libs/1_39_0/more/getting_started/windows.html"><span style="text-decoration: underline;"><span style="color: #0066cc;">Boost getting started web pages</span></span></a></p>
<ul class="related_post"><li><a href="http://www.tuncbahcecioglu.com/posts/pugg/" title="pugg">pugg</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/" title="send std::string with mpi">send std::string with mpi</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/vs2010-good-sort-of-vs2005-bad/" title="VS2010 good (sort of), vs2005 bad">VS2010 good (sort of), vs2005 bad</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/mpi-debugging-with-visual-studio/" title="MPI Debugging with Visual Studio">MPI Debugging with Visual Studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/" title="delphi and mpi, closer look 2">delphi and mpi, closer look 2</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/" title="Delphi and mpi in 4 steps">Delphi and mpi in 4 steps</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>send std::string with mpi</title>
		<link>http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/</link>
		<comments>http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 02:12:45 +0000</pubDate>
		<dc:creator>tunc</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[mpi]]></category>
		<category><![CDATA[std]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/</guid>
		<description><![CDATA[The idea is to send the size of the string first and then allocate the storage on the reciever. Here is an example with broadcast. string s = "before"; int size = 0; if (myRank == 0) { s = "after"; size = s.size(); } BroadCast(&#38;size,1); if (myRank != 0) s.resize(size); BroadCast(s.data(),size); delphi and mpi, [...]]]></description>
			<content:encoded><![CDATA[<p>The idea is to send the size of the string first and then allocate the storage on the reciever. Here is an example with broadcast.</p>
<pre class="brush:cpp">string s = "before";
int size = 0;
if (myRank == 0)
{
   s = "after";
   size = s.size();
}
BroadCast(&amp;size,1);
if (myRank != 0) s.resize(size);
BroadCast(s.data(),size);</pre>
<ul class="related_post"><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/" title="delphi and mpi, closer look 2">delphi and mpi, closer look 2</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/" title="Delphi and mpi in 4 steps">Delphi and mpi in 4 steps</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/optimum-design-of-high-rise-steel-buildings-using-an-evolution-strategy-integrated-parallel-algorithm/" title="Optimum Design of High-Rise Steel Buildings using an Evolution Strategy Integrated Parallel Algorithm">Optimum Design of High-Rise Steel Buildings using an Evolution Strategy Integrated Parallel Algorithm</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/mpi-debugging-with-visual-studio/" title="MPI Debugging with Visual Studio">MPI Debugging with Visual Studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-1/" title="DELPHI and MPI, closer look 1">DELPHI and MPI, closer look 1</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/pugg/" title="pugg">pugg</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/" title="Installing boost for visual studio">Installing boost for visual studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/a-comparative-study-on-two-different-direct-parallel-solution-strategies-for-large-scale-problems/" title="A Comparative Study on Two Different Direct Parallel Solution Strategies for Large-Scale Problems">A Comparative Study on Two Different Direct Parallel Solution Strategies for Large-Scale Problems</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delphi and mpi in 4 steps</title>
		<link>http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/</link>
		<comments>http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 01:31:28 +0000</pubDate>
		<dc:creator>tunc</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[lazarus]]></category>
		<category><![CDATA[mpi]]></category>
		<category><![CDATA[mpich2]]></category>
		<category><![CDATA[pascal]]></category>

		<guid isPermaLink="false">http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/</guid>
		<description><![CDATA[Download and install MPICH2 Download mpi.pas from lazarus site and put it in your project. http://wiki.lazarus.freepascal.org/MPICH Comment out any code that gives error in MPI.pas (Lazarus pascal is a little bit different than Delphi object pascal) Write your code! program HelloWorld1; uses&#160; MPI; var myid: integer; begin MPI_Init(nil,nil); MPI_Comm_rank(MPI_COMM_WORLD,@myid); writeln('id=',myid); MPI_Finalize; end. DELPHI and MPI, [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Download and install <a href="http://www.mcs.anl.gov/research/projects/mpich2/index.php"><span style="text-decoration: underline"><span style="color: #0066cc">MPICH2 </span></span></a></li>
<li>Download mpi.pas from lazarus site and put it in your project. <a href="http://wiki.lazarus.freepascal.org/MPICH"><span style="text-decoration: underline"><span style="color: #0066cc">http://wiki.lazarus.freepascal.org/MPICH</span></span></a> </li>
<li>Comment out any code that gives error in MPI.pas (Lazarus pascal is a little bit different than Delphi object pascal) </li>
<li>Write your code! </li>
</ol>
<pre class="delphi" name="code">program HelloWorld1;

uses&#160; MPI;

var myid: integer;
begin
MPI_Init(nil,nil);
MPI_Comm_rank(MPI_COMM_WORLD,@myid);
writeln('id=',myid);
MPI_Finalize;

end.</pre>
<ul class="related_post"><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-1/" title="DELPHI and MPI, closer look 1">DELPHI and MPI, closer look 1</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-closer-look-2/" title="delphi and mpi, closer look 2">delphi and mpi, closer look 2</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/optimum-design-of-high-rise-steel-buildings-using-an-evolution-strategy-integrated-parallel-algorithm/" title="Optimum Design of High-Rise Steel Buildings using an Evolution Strategy Integrated Parallel Algorithm">Optimum Design of High-Rise Steel Buildings using an Evolution Strategy Integrated Parallel Algorithm</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/send-stdstring-with-mpi/" title="send std::string with mpi">send std::string with mpi</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/mpi-debugging-with-visual-studio/" title="MPI Debugging with Visual Studio">MPI Debugging with Visual Studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/a-comparative-study-on-two-different-direct-parallel-solution-strategies-for-large-scale-problems/" title="A Comparative Study on Two Different Direct Parallel Solution Strategies for Large-Scale Problems">A Comparative Study on Two Different Direct Parallel Solution Strategies for Large-Scale Problems</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/pugg/" title="pugg">pugg</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/installing-boost-for-visual-studio/" title="Installing boost for visual studio">Installing boost for visual studio</a></li><li><a href="http://www.tuncbahcecioglu.com/posts/what-i-need-from-delphi-2010/" title="what i need from delphi 2010">what i need from delphi 2010</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.tuncbahcecioglu.com/posts/delphi-and-mpi-in-4-steps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

