<?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>A Party to the World &#187; building</title>
	<atom:link href="http://dan.lecocq.us/wordpress/tag/building/feed/" rel="self" type="application/rss+xml" />
	<link>http://dan.lecocq.us/wordpress</link>
	<description>Life, love, and computer science</description>
	<lastBuildDate>Fri, 06 Jan 2012 17:21:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Make With Multiple Cores</title>
		<link>http://dan.lecocq.us/wordpress/2008/10/11/make-with-multiple-cores/</link>
		<comments>http://dan.lecocq.us/wordpress/2008/10/11/make-with-multiple-cores/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 03:09:12 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[multiple cores]]></category>
		<category><![CDATA[ninja magic]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/2008/10/11/make-with-multiple-cores/</guid>
		<description><![CDATA[I was building something, and I remembered a friend was saying a while ago that you could tell gcc how many cores to use when building something. I don&#8217;t know if that&#8217;s true or not, but it turns out you can certainly tell make: make -j(number of cores to use) For example, make -j2 I [...]]]></description>
			<content:encoded><![CDATA[<p>I was building something, and I remembered a friend was saying a while ago that you could tell gcc how many cores to use when building something.  I don&#8217;t know if that&#8217;s true or not, but it turns out you can certainly tell make:<br />
<code><br />
make -j(number of cores to use)<br />
</code></p>
<p>For example,<br />
<code><br />
make -j2<br />
</code></p>
<p>I took a screen capture of System Monitor after building each way (make and make -j2), to see the difference.  The first box is using just one core, and the second is using both.</p>
<p><a href='http://dan.lecocq.us/wordpress/wp-content/uploads/2008/10/multicore-make.png' title='Multicore Make'><img src='http://dan.lecocq.us/wordpress/wp-content/uploads/2008/10/multicore-make.thumbnail.png' alt='Multicore Make' /></a></p>
<p>I had initially thought I&#8217;d have to tell gcc, and so I had planned to edit the makefile to automatically find the number of cores on the system, and then run gcc with that as an argument, so I went in search of how to find the number of cores on a Linux system.  It turns out the easiest way to get that number that I came across was to use /proc/cpuinfo:<br />
<code><br />
cat /proc/cpuinfo | grep 'cpu cores' | head -1 | sed -r 's/^.+([[:digit:]]+)/1/'<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2008/10/11/make-with-multiple-cores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

