<?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>nklein software &#187; macosx</title>
	<atom:link href="http://nklein.com/tags/macosx/feed/" rel="self" type="application/rss+xml" />
	<link>http://nklein.com</link>
	<description>software development and consulting</description>
	<lastBuildDate>Thu, 22 Dec 2011 04:42:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Installing mpich2 for use with CL-MPI</title>
		<link>http://nklein.com/2009/06/installing-mpich2-for-use-with-cl-mpi/</link>
		<comments>http://nklein.com/2009/06/installing-mpich2-for-use-with-cl-mpi/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 18:48:01 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[mpi]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=503</guid>
		<description><![CDATA[Some time back, I began writing some OpenMPI wrappers for Lisp. I got everything that I needed working, but I hardly scratched the surface of what MPI-2 makes available. Recently, Alex Fukunaga started up a blog about Lisp. One of the things he has done is make CFFI bindings for mpich2. Here is an introductory [...]]]></description>
			<content:encoded><![CDATA[<p>Some time back, I began writing some OpenMPI wrappers for Lisp.  I got everything that I needed working, but I hardly scratched the surface of what MPI-2 makes available.</p>
<p>Recently, Alex Fukunaga started up <a href="http://risupu.blogspot.com/">a blog about Lisp</a>.  One of the things he has done is make CFFI bindings for <a href="http://www.mcs.anl.gov/research/projects/mpich2/">mpich2</a>.  Here is an <a href="http://risupu.blogspot.com/2009/06/parallel-mandelbrot-computation-in-lisp.html">introductory post about those bindings</a> with a link to his <a href="http://code.google.com/p/cl-mpi/">CL-MPI site</a>.</p>
<p>Today, I have been working on getting his bindings up and running under Ubuntu Linux and Mac OS X.</p>
<p><span id="more-503"></span><br />
So far, it has been a nightmare trying to get mpich2 compiled on either platform.  It compiles famously if you just run</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">% ./configure --prefix=/usr/local</pre></div>
<p>However, that doesn&#8217;t build shared libraries.  Without shared libraries, the CFFI stub library happily links against the static library and happily imports zero of the symbols.  After sifting through <strong>configure &#8211;help</strong>, I decided that I should add <strong>&#8211;enable-dynamiclibs</strong>.  Doing so yells at me that I must also specify <strong>&#8211;enable-sharedlibs=type</strong>.  So, I sifted through the help again and decided to try:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ubuntu% ./configure --prefix=/usr/local --enable-dynamiclibs --enable-sharedlibs=gcc
macosx% ./configure --prefix=/usr/local --enable-dynamiclibs --enable-sharedlibs=gcc-osx</pre></div>
<p>Both compiles then bomb out saying <strong>MPIU_CALL_MPIDI_CH3</strong> is undeclared.  Yay.</p>
<p>Searching the web on the relevant errors, I discover that I do not need to enable dynamiclibs to get shared libraries.  Wheee.  Now, mpich2 is built on both architectures.</p>
<p>I added this target into <strong>cl-mpi/mpich2-stub/Makefile</strong>:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">libmpiskeleton.dylib: mpiskeleton.o
        mpicc -dynamiclib -o libmpiskeleton.dylib -dylib mpiskeleton.o</pre></div>
<p>and changed the bottom of <strong>cl-mpi/cl-mpi-configure.lisp</strong> to this:</p>
<div class="codecolorer-container lisp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="lisp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&#40;</span>eval-<span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">compile-toplevel</span> <span style="color: #66cc66;">:</span><span style="color: #555;">load-toplevel</span> <span style="color: #66cc66;">:</span><span style="color: #555;">execute</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>pushnew <span style="color: #66cc66;">:</span><span style="color: #555;">mpich2</span> *features*<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">; Use MPICH2                                     </span>
  <span style="color: #66cc66;">&#40;</span>defvar *mpi-header-file* <span style="color: #ff0000;">&quot;/usr/local/include/mpi.h&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">;; For MPICH2, Need to load a special stub shared object, and not the MPICH s\</span>
hared library directly                                                          
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> load-mpi-foreign-libraries <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    #-darwin
    <span style="color: #66cc66;">&#40;</span>cffi<span style="color: #66cc66;">:</span><span style="color: #555;">use-foreign-library</span> <span style="color: #ff0000;">&quot;/usr/local/asdf-install/site/cl-mpi/mpich2-stub/<span style="color: #000099; font-weight: bold;">\</span>
libmpiskeleton.so.1.0.1&quot;</span><span style="color: #66cc66;">&#41;</span>
    #+darwin
    <span style="color: #66cc66;">&#40;</span>cffi<span style="color: #66cc66;">:</span><span style="color: #555;">use-foreign-library</span> <span style="color: #ff0000;">&quot;/usr/local/asdf-install/site/cl-mpi/mpich2-stub/<span style="color: #000099; font-weight: bold;">\</span>
libmpiskeleton.dylib&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div>
<p>After sorting out some svn merge problems in mpi-test.lisp, it appears as though it all works wonderfully on MacOSX.  Most of it seems to work under Ubuntu for me, but I have to look into some error messages more closely.</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/06/installing-mpich2-for-use-with-cl-mpi/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

