<?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>Stealthcopter.com &#187; CUDA</title>
	<atom:link href="http://www.stealthcopter.com/blog/tag/cuda/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stealthcopter.com/blog</link>
	<description>Android, Linux, Python and stealthcopters</description>
	<lastBuildDate>Fri, 13 Jan 2012 16:29:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing PyCuda on ubuntu 10.04</title>
		<link>http://www.stealthcopter.com/blog/2010/07/installing-pycuda-on-ubuntu-10-04/</link>
		<comments>http://www.stealthcopter.com/blog/2010/07/installing-pycuda-on-ubuntu-10-04/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 10:30:43 +0000</pubDate>
		<dc:creator>mat</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[CUDA]]></category>

		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=918</guid>
		<description><![CDATA[Using graphics cards to hand massively parallel tasks can now be realised in python, thanks to PyCuda a module for python which allows interaction with the CUDA libaries/binaries provided by Nvidia. To get this working in ubuntu 10.04 lucid lynx I followed this guide http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu. Prep / Installation: First install CUDA, most places will tell [...]]]></description>
			<content:encoded><![CDATA[<p>Using graphics cards to hand massively parallel tasks can now be realised in python, thanks to PyCuda a module for python which allows interaction with the CUDA libaries/binaries provided by Nvidia. To get this working in ubuntu 10.04 lucid lynx I followed this guide <a href="http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu">http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu</a>.</p>
<p><strong>Prep / Installation:</strong></p>
<p>First install CUDA, most places will tell you that CUDA is incompatible with gcc-4.3 but this is not true if you make a few small changes to the configuration.mk file, please see <a href="http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/">this post about installing CUDA in ubuntu</a></p>
<p>Install the required packages (or use package manager):</p>
<blockquote><p>
sudo apt-get install python-numpy -y<br />
sudo apt-get install build-essential python-dev python-setuptools libboost-python-dev -y
</p>
</blockquote>
<p>Download pycuda from: <a href="http://pypi.python.org/pypi/pycuda">http://pypi.python.org/pypi/pycuda</a></p>
<p>Untar the achive:</p>
<blockquote><p>tar xzvf pycuda-0.94rc.tar.gz</p>
</blockquote>
<p>Configure, make and install:</p>
<blockquote><p>cd pycuda-0.94rc<br />
./configure.py &#8211;cuda-root=/usr/local/cuda &#8211;cudadrv-lib-dir=/usr/lib &#8211;boost-inc-dir=/usr/include &#8211;boost-lib-dir=/usr/lib &#8211;boost-python-libname=boost_python-mt &#8211;boost-thread-libname=boost_thread-mt<br />
make -j 4<br />
sudo python setup.py install</p>
</blockquote>
<p><strong>Problems</strong></p>
<p>I had some problems with the compliation because it was complaining about pytools missing, this was resolved by removing and reinstalling python-setuptools:</p>
<blockquote><p>sudo apt-get remove python-setuptools<br />
sudo apt-get install python-setuptools</p>
</blockquote>
<p><strong>Running the example</strong></p>
<p>You should now be able to run the <em>hellogpu.py</em> demo in the examples folder and use the <em>download-examples-from-wiki.py</em> to download further demos from the pycuda wiki.</p>
<p><strong>Next</strong><br />
I plan to learn how to use PyCuda and aim to make a MD5 cracker as discussed previously (<a href="http://www.stealthcopter.com/blog/2010/06/cracking-md5-hashes-or-passwords-ultra-fast-with-gpu-acceleration/">here</a> and <a href="http://www.stealthcopter.com/blog/2010/06/cracking-real-world-salted-md5-passwords-in-python-with-several-dictionaries/">here</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthcopter.com/blog/2010/07/installing-pycuda-on-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cracking MD5 hashes (or passwords) ultra-fast with GPU acceleration</title>
		<link>http://www.stealthcopter.com/blog/2010/06/cracking-md5-hashes-or-passwords-ultra-fast-with-gpu-acceleration/</link>
		<comments>http://www.stealthcopter.com/blog/2010/06/cracking-md5-hashes-or-passwords-ultra-fast-with-gpu-acceleration/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 18:17:14 +0000</pubDate>
		<dc:creator>mat</dc:creator>
				<category><![CDATA[cryptography]]></category>
		<category><![CDATA[computational]]></category>
		<category><![CDATA[cracking]]></category>
		<category><![CDATA[CUDA]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[md5]]></category>

		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=914</guid>
		<description><![CDATA[Do you want to crack MD5 hashes in at a rate of ~300MHash/s without a massive rainbow table? Do you have a CUDA enabled GFX card? If you said yes or maybe to these questions then read on for a brief introduction on how to compile and run a CUDA accelerated MD5 cracker (coded by [...]]]></description>
			<content:encoded><![CDATA[<p>Do you want to crack MD5 hashes in at a rate of ~300MHash/s without a massive rainbow table? Do you have a CUDA enabled GFX card? If you said yes or maybe to these questions then read on for a brief introduction on how to compile and run a CUDA accelerated MD5 cracker (coded by Benjamin <em>&#8220;Titan&#8221;</em> Vernoux ).</p>
<p><strong>Pre-Requisites and Downloading</strong></p>
<ul>
<li>Own a <a href="http://www.nvidia.com/object/cuda_learn_products.html">CUDA enabled GFX card</a>, if you have a NVIDIA graphics card from the past year or so this is most likely the case.</li>
<li>Download and Install the <a href="http://www.nvidia.com/object/cuda_get.html">CUDA toolkit</a></li>
<li>Download MD5 GPU crack from <a href="http://bvernoux.free.fr/md5/index.php">http://bvernoux.free.fr</a> (windows and Linux)</li>
</ul>
<p><strong>Building in Ubuntu 10.04</strong></p>
<p>Extract the archive and do a make on the source code. When doing this I came across two problems that can be fixed by modifying the common.mk file.</p>
<p><em><strong>Problem 1: (cannot be declared weak)</strong></em></p>
<blockquote><p>
$ make<br />
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak<br />
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak<br />
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak<br />
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak<br />
/opt/cuda/bin/../include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak<br />
/opt/cuda/bin/../include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak<br />
/opt/cuda/bin/../include/math_functions.h:422: error: inline function ‘int __signbit(double)’ cannot be declared weak<br />
/opt/cuda/bin/../include/math_functions.h:427: error: inline function ‘int __signbitf(float)’ cannot be declared weak<br />
/opt/cuda/bin/../include/math_functions.h:440: error: inline function ‘int __signbitl(long double)’ cannot be declared weak<br />
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbit(double)’ cannot be declared weak<br />
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak<br />
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak<br />
/usr/include/bits/mathinline.h:36: error: inline function ‘int __signbitf(float)’ cannot be declared weak<br />
/usr/include/bits/mathinline.h:42: error: inline function ‘int __signbit(double)’ cannot be declared weak<br />
/usr/include/bits/mathinline.h:48: error: inline function ‘int __signbitl(long double)’ cannot be declared weak</p>
</blockquote>
<p><em><strong>Solution 1</strong></em></p>
<blockquote><p>
# Debug/release configuration<br />
ifeq ($(dbg),1)<br />
	COMMONFLAGS += -g<br />
	NVCCFLAGS   += -D_DEBUG<br />
	BINSUBDIR   := debug<br />
	LIBSUFFIX   := D<br />
else<br />
	##############Change the following line to have -O0 instead of -O2<br />
	COMMONFLAGS += -O0<br />
	BINSUBDIR   := release<br />
	LIBSUFFIX   :=<br />
	NVCCFLAGS   += &#8211;compiler-options -fno-strict-aliasing<br />
	CXXFLAGS    += -fno-strict-aliasing<br />
	CFLAGS      += -fno-strict-aliasing<br />
endif
</p>
</blockquote>
<p><em><strong>Problem 2: (lcudart)</strong></em></p>
<blockquote><p>
$ make<br />
/usr/bin/ld: skipping incompatible /opt/cuda/lib/libcudart.so when searching for -lcudart<br />
/usr/bin/ld: skipping incompatible /opt/cuda/lib/libcudart.so when searching for -lcudart<br />
/usr/bin/ld: cannot find -lcudart<br />
collect2: ld returned 1 exit status<br />
make: *** [bin/linux/release/gpu_md5_crack_0.2.3] Error 1
</p>
</blockquote>
<p><em><strong>Solution 2</strong></em></p>
<blockquote><p>
############## Change lib to lib64 if using a 64 bit operating system<br />
LIB       := -L$(CUDA_INSTALL_PATH)/lib64 -L$(LIBDIR) -L$(COMMONDIR)/lib64/$(OSLOWER) -L$(NVIDIA_SDK_PATH)/lib
</p>
</blockquote>
<p>Remember that you should &#8220;make clean&#8221; in-between each attempt to compile.</p>
<p><strong>Benchmarking</strong></p>
<p>Once it has compiled nicely you can give it a testdrive with its build in benchmark (with an NVIDIA 260 GFX card). Just run with the -b option:</p>
<blockquote><p>
./gpu_md5_crack_0.2.3 -b<br />
GPU_MD5_Crack v0.2.3 09 July 2009 LGPL for BackTrack 4.<br />
Copyright (C) 2009 TitanMKD (titanmkd@gmail.com).                                    </p>
<p>Benchmark Start<br />
Using default CUDA GPU device:0<br />
Cuda device ID:0, Device name:GeForce GTX 260, supporting CUDA:1.3,<br />
multiProcessorCount:27, clockRate:1466.00 MHz, TotalMem:895.31 MB<br />
******* Test 0 Start *******<br />
Expected Password: 1234567890<br />
MD5 Hash:e807f1fcf82d132f9bb018ca6738a19f, Start Password:1200000000, Total pwd to check:1000000000<br />
Charset used 0:0123456789<br />
MD5 brute force started                                                                            </p>
<p>MD5 Cracked pwd=1234567890 hash=e807f1fcf82d132f9bb018ca6738a19f<br />
Instant 200.02 Mhash/s(40.00 ms)<br />
Average 190.49 Mhash/s, Total Time:0.21s(210.00 ms)<br />
MD5 brute force finished<br />
******* Test 0 End *******                                      </p>
<p>******* Test 1 Start *******<br />
Expected Password: azerty<br />
MD5 Hash:ab4f63f9ac65152575886860dde480a1, Start Password:, Total pwd to check:1000000000<br />
Charset used 1:abcdefghijklmnopqrstuvwxyz<br />
MD5 brute force started                                                                  </p>
<p>MD5 Cracked pwd=azerty hash=ab4f63f9ac65152575886860dde480a1<br />
Instant 200.02 Mhash/s(40.00 ms)<br />
Average 240.02 Mhash/s, Total Time:0.10s(100.00 ms)<br />
MD5 brute force finished<br />
******* Test 1 End *******                                  </p>
<p>******* Test 2 Start *******<br />
Expected Password: azer09<br />
MD5 Hash:41b9cabe6033932eb3037fc933060adc, Start Password:, Total pwd to check:1000000000<br />
Charset used 2:abcdefghijklmnopqrstuvwxyz0123456789<br />
MD5 brute force started<br />
Progress 5%, Pwd:6lmea, Instant 280.02 Mhash/s(28.57 ms)<br />
MD5 Cracked pwd=azer09 hash=41b9cabe6033932eb3037fc933060adc<br />
Instant 266.69 Mhash/s(30.00 ms)<br />
Average 287.20 Mhash/s, Total Time:0.39s(390.00 ms)<br />
MD5 brute force finished<br />
******* Test 2 End *******                                                               </p>
<p>******* Test 3 Start *******<br />
Expected Password: AZBVSD<br />
MD5 Hash:fd049008572788d60140aaead79336cc, Start Password:, Total pwd to check:1000000000<br />
Charset used 3:ABCDEFGHIJKLMNOPQRSTUVWXYZ<br />
MD5 brute force started                                                                  </p>
<p>MD5 Cracked pwd=AZBVSD hash=fd049008572788d60140aaead79336cc<br />
Instant 266.69 Mhash/s(30.00 ms)<br />
Average 240.02 Mhash/s, Total Time:0.10s(100.00 ms)<br />
MD5 brute force finished<br />
******* Test 3 End *******</p>
<p>******* Test 4 Start *******<br />
Expected Password: AZ09AA<br />
MD5 Hash:7a552dd9cdd49acc5320bad9c29c9722, Start Password:, Total pwd to check:1000000000<br />
Charset used 4:ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<br />
MD5 brute force started<br />
Progress 5%, Pwd:6LMEA, Instant 266.69 Mhash/s(30.00 ms)<br />
MD5 Cracked pwd=AZ09AA hash=7a552dd9cdd49acc5320bad9c29c9722<br />
Instant 266.69 Mhash/s(30.00 ms)<br />
Average 280.02 Mhash/s, Total Time:0.40s(400.00 ms)<br />
MD5 brute force finished<br />
******* Test 4 End *******</p>
<p>******* Test 5 Start *******<br />
Expected Password: zaZAab<br />
MD5 Hash:aef49f70bb7b923b8bc0a018f916ef64, Start Password:zCAAAA, Total pwd to check:1000000000<br />
Charset used 5:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<br />
MD5 brute force started<br />
Progress 17%, Pwd:zaDpoA, Instant 280.02 Mhash/s(28.57 ms)<br />
MD5 Cracked pwd=zaZAab hash=aef49f70bb7b923b8bc0a018f916ef64<br />
Instant 266.69 Mhash/s(30.00 ms)<br />
Average 283.10 Mhash/s, Total Time:0.65s(650.00 ms)<br />
MD5 brute force finished<br />
******* Test 5 End *******</p>
<p>******* Test 6 Start *******<br />
Expected Password: za0ZA9<br />
MD5 Hash:062cc3b1302759722f48ac0b95b75803, Start Password:zaAAAA, Total pwd to check:1000000000<br />
Charset used 6:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789<br />
MD5 brute force started</p>
<p>MD5 Cracked pwd=za0ZA9 hash=062cc3b1302759722f48ac0b95b75803<br />
Instant 266.69 Mhash/s(30.00 ms)<br />
Average 266.69 Mhash/s, Total Time:0.06s(60.00 ms)<br />
MD5 brute force finished<br />
******* Test 6 End *******</p>
<p>******* Test 7 Start *******<br />
Expected Password: a^-*|<br />
MD5 Hash:cf7dcf4c3eeb6255668393242fcce273, Start Password:a0000, Total pwd to check:1000000000<br />
Charset used 7: !&#8221;#$%&#038;&#8217;()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<br />
MD5 brute force started</p>
<p>MD5 Cracked pwd=a^-*| hash=cf7dcf4c3eeb6255668393242fcce273<br />
Instant 266.69 Mhash/s(30.00 ms)<br />
Average 266.69 Mhash/s, Total Time:0.15s(150.00 ms)<br />
MD5 brute force finished<br />
******* Test 7 End *******</p>
<p>Benchmark End
</p>
</blockquote>
<p>So from the benchmark you can see that we are getting between 200 and 300 Mhash/s, that is about 250,000,000 hash attempts per second! AMAZING!!!</p>
<p><strong>Number of combinations for different alphabets</strong></p>
<table>
<tr>
<th>Length</th>
<th>0-9</th>
<th>a-z</th>
<th>a-z0-9</th>
<th>a-zA-Z</th>
<th>a-zA-Z0-9</th>
</tr>
<tr>
<td>1</td>
<td>10</td>
<td>26</td>
<td>36</td>
<td>52</td>
<td>62</td>
</tr>
<tr>
<td>2</td>
<td>100</td>
<td>676</td>
<td>1,296</td>
<td>2,704</td>
<td>3,844</td>
</tr>
<tr>
<td>3</td>
<td>1,000</td>
<td>17,576</td>
<td>46,656</td>
<td>140,608</td>
<td>238,328</td>
</tr>
<tr>
<td>4</td>
<td>10,000</td>
<td>456,976</td>
<td>1,679,616</td>
<td>7,311,616</td>
<td>14,776,336</td>
</tr>
<tr>
<td>5</td>
<td>100,000</td>
<td>11,881,376</td>
<td>60,466,176</td>
<td>380,204,032</td>
<td>916,132,832</td>
</tr>
<tr>
<td>6</td>
<td>1,000,000</td>
<td>308,915,776</td>
<td>2,176,782,336</td>
<td>19,770,609,664</td>
<td>56,800,235,584</td>
</tr>
<tr>
<td>7</td>
<td>10,000,000</td>
<td>8,031,810,176</td>
<td>78,364,164,096</td>
<td>1,028,071,702,528</td>
<td>3,521,614,606,208</td>
</tr>
<tr>
<td>8</td>
<td>100,000,000</td>
<td>208,827,064,576</td>
<td>2,821,109,907,456</td>
<td>53,459,728,531,456</td>
<td>218,340,105,584,896</td>
</tr>
<tr>
<td>9</td>
<td>1,000,000,000</td>
<td>5,429,503,678,976</td>
<td>101,559,956,668,416</td>
<td>2,779,905,883,635,710</td>
<td>13,537,086,546,263,600</td>
</tr>
<tr>
<td>10</td>
<td>10,000,000,000</td>
<td>141,167,095,653,376</td>
<td>3,656,158,440,062,980</td>
<td>144,555,105,949,057,000</td>
<td>839,299,365,868,340,000</td>
</tr>
</table>
<p><strong>Estimated time (in seconds) to crack (at 250MHash/s)</strong></p>
<table>
<tr>
<th>Length</th>
<th>0-9</th>
<th>a-z</th>
<th>a-z0-9</th>
<th>a-zA-Z</th>
<th>a-zA-Z0-9</th>
</tr>
<tr>
<td>1</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>2</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>3</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
</tr>
<tr>
<td>4</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0.01</td>
<td>0.03</td>
</tr>
<tr>
<td>5</td>
<td>0.00</td>
<td>0.02</td>
<td>0.12</td>
<td>0.76</td>
<td>1.83</td>
</tr>
<tr>
<td>6</td>
<td>0.00</td>
<td>0.62</td>
<td>4.35</td>
<td>39.54</td>
<td>113.60</td>
</tr>
<tr>
<td>7</td>
<td>0.02</td>
<td>16.06</td>
<td>156.73</td>
<td>2,056.14</td>
<td>7,043.23</td>
</tr>
<tr>
<td>8</td>
<td>0.20</td>
<td>417.65</td>
<td>5,642.22</td>
<td>106,919.46</td>
<td>436,680.21</td>
</tr>
<tr>
<td>9</td>
<td>2.00</td>
<td>10,859.01</td>
<td>203,119.91</td>
<td>5,559,811.77</td>
<td>27,074,173.09</td>
</tr>
<tr>
<td>10</td>
<td>20.00</td>
<td>282,334.19</td>
<td>7,312,316.88</td>
<td>289,110,211.90</td>
<td>1,678,598,731.74</td>
</tr>
</table>
<p>Full calculations avaliable here: <a href='http://www.stealthcopter.com/blog/2010/06/cracking-md5-hashes-or-passwords-ultra-fast-with-gpu-acceleration/hashes/' rel='attachment wp-att-915'>MD5 hash cracking time using GPU accelerated brute forcing</a></p>
<p><strong>What now?</strong><br />
Well you can crack MD5&#8242;s at an extremely accelerated rate, so enjoy doing so responsibly (let your morals guide you <img src='http://www.stealthcopter.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). You could also explore the source code and make additions as you see fit, I am planning on modifying it to allow an extra parameter so that prefixes can be added if you already know how the password starts. This can be the case when someone has prefixed the password with a known salt.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthcopter.com/blog/2010/06/cracking-md5-hashes-or-passwords-ultra-fast-with-gpu-acceleration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compiling and running CUDA 2.3 SDK and toolkit on ubuntu 9.10 x64 (64-bit)</title>
		<link>http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/</link>
		<comments>http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 10:30:17 +0000</pubDate>
		<dc:creator>mat</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[misc]]></category>
		<category><![CDATA[computational]]></category>
		<category><![CDATA[CUDA]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=728</guid>
		<description><![CDATA[I&#8217;ve heard a lot about CUDA, such as how it is 10,000% faster at cracking wireless passwords over a conventional program/hardware, but never really got around to testing it out before now. This post details the steps required to compile and setup CUDA 2.3 SDK and toolkit on ubuntu 9.10. Downloads You are required to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve heard a lot about CUDA, such as how it is <a href="http://www.crunchgear.com/2008/10/10/crack-wpa-ten-thousand-percent-faster-with-cuda/">10,000% faster at cracking wireless passwords</a> over a conventional program/hardware, but never really got around to testing it out before now. This post details the steps required to compile and setup CUDA 2.3 SDK and toolkit on ubuntu 9.10.</p>
<p><strong>Downloads</strong><br />
You are required to have an Nvidia graphics driver (relatively new version) already installed. First download the CUDA toolkit and CUDA sdk from the <a href="http://developer.nvidia.com/object/cuda_2_3_downloads.html">Nvidia CUDA 2.3 download page</a>.</p>
<p><strong>Install the toolkit</strong></p>
<pre name="code" class="bash"># Make file executable
chmod +x cudatoolkit_2.3_linux_64_ubuntu9.04.run
# Run it as superuser
sudo ./cudatoolkit_2.3_linux_64_ubuntu9.04.run
</pre>
<p>You now need to edit your .bashrc file in your home directory to include the paths (so your CUDA binaries can be found by the system)</p>
<pre class="bash">export PATH=${PATH}:/usr/local/cuda/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64</pre>
<p>Note if you are using 32bit then &#8220;lib64&#8243; should be replaced with just &#8220;lib&#8221;</p>
<p><strong>Install the SDK</strong></p>
<pre name="code" class="bash">
# Make file executable
chmod +x cudasdk_2.3_linux.run
# Run it as normal user
./cudasdk_2.3_linux.run
</pre>
<p>You should now have a NVIDIA_GPU_Computing_SDK folder in your home directory. Change directory into the C folder inside this one.</p>
<pre name="code" class="bash">
cd NVIDIA_GPU_Computing_SDK/C
</pre>
<p>In this folder is a make file which will compile all the Nvidia SDK and all the demos, in order for this to work in ubuntu 9.10 (x64) you will need to install several dependencies. By installing these before attempting to make will save you a lot of time, if you are getting errors please scroll down to the problems section to see if they are already covered.</p>
<pre name="code" class="bash">
# Install the necessary libraries
sudo apt-get install freeglut3 freeglut3-dev libx11-dev mesa-common-dev libxmu6
</pre>
<p><strong>Making and running demos</strong></p>
<p>You can then run the make command, once this is ran all of the executables will be placed in  NVIDIA_GPU_Computing_SDK/C/bin/linux/released . We can check that our computer has an useable CUDA device install by running the deviceQuery program:</p>
<pre name="code" class="bash">
cd ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/released
./deviceQuery
</pre>
<p>This should output something similar to the following:</p>
<pre name="code" class="bash">
# ./deviceQuery
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA

Device 0: "GeForce GTX 260"
  CUDA Driver Version:                           2.30
  CUDA Runtime Version:                          2.30
  CUDA Capability Major revision number:         1
  CUDA Capability Minor revision number:         3
  Total amount of global memory:                 938803200 bytes
  Number of multiprocessors:                     27
  Number of cores:                               216
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       16384 bytes
  Total number of registers available per block: 16384
  Warp size:                                     32
  Maximum number of threads per block:           512
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
  Maximum memory pitch:                          262144 bytes
  Texture alignment:                             256 bytes
  Clock rate:                                    1.47 GHz
  Concurrent copy and execution:                 Yes
  Run time limit on kernels:                     Yes
  Integrated:                                    No
  Support host page-locked memory mapping:       Yes
  Compute mode:                                  Default (multiple host threads can use this device simultaneously)

Test PASSED
</pre>
<p>Now that we can see CUDA is successfully installed and a suitable device is found we can run some of nvidia&#8217;s more ascetically pleasing demos:</p>
<pre name="code" class="bash">
./fluidsGL
</pre>
<p><div id="attachment_739" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/cudafluids/" rel="attachment wp-att-739"><img src="http://www.stealthcopter.com/blog/wp-content/uploads/2010/02/cudafluids-600x570.png" alt="CUDA SDK example fluidsGL on ubuntu 9.10 x64" title="CUDA SDK example fluidsGL on ubuntu 9.10 x64" width="600" height="570" class="size-medium wp-image-739" /></a><p class="wp-caption-text">CUDA SDK example fluidsGL on ubuntu 9.10 x64</p></div></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/ITpgGT65PJY&#038;hl=en_GB&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ITpgGT65PJY&#038;hl=en_GB&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<pre name="code" class="bash">
./smokeParticles
</pre>
<p><div id="attachment_744" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/cudasmokeparticles/" rel="attachment wp-att-744"><img src="http://www.stealthcopter.com/blog/wp-content/uploads/2010/02/cudasmokeparticles-600x474.png" alt="CUDA SDK example smokeparticles on ubuntu 9.10 x64" title="CUDA SDK example smokeparticles on ubuntu 9.10 x64" width="600" height="474" class="size-medium wp-image-744" /></a><p class="wp-caption-text">CUDA SDK example smokeparticles on ubuntu 9.10 x64</p></div></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/IrKITmwU3jE&#038;hl=en_GB&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/IrKITmwU3jE&#038;hl=en_GB&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<pre name="code" class="bash">
./particles
</pre>
<p><div id="attachment_765" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/cuda_particles/" rel="attachment wp-att-765"><img src="http://www.stealthcopter.com/blog/wp-content/uploads/2010/02/cuda_particles-600x473.png" alt="CUDA SDK example particles on ubuntu 9.10 x64" title="CUDA SDK example particles on ubuntu 9.10 x64" width="600" height="473" class="size-medium wp-image-765" /></a><p class="wp-caption-text">CUDA SDK example particles on ubuntu 9.10 x64</p></div></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/wKSy8_GeHFY&#038;hl=en_GB&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/wKSy8_GeHFY&#038;hl=en_GB&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<pre name="code" class="bash">
./postProcessGL
</pre>
<p><div id="attachment_767" class="wp-caption aligncenter" style="width: 530px"><a href="http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/cuda_teapot/" rel="attachment wp-att-767"><img src="http://www.stealthcopter.com/blog/wp-content/uploads/2010/02/cuda_teapot.png" alt="CUDA SDK example postProcessGL on ubuntu 9.10 x64 (teapot)" title="CUDA SDK example postProcessGL on ubuntu 9.10 x64 (teapot)" width="520" height="543" class="size-full wp-image-767" /></a><p class="wp-caption-text">CUDA SDK example postProcessGL on ubuntu 9.10 x64 (teapot)</p></div></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/0Fd7pVQ8OP0&#038;hl=en_GB&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0Fd7pVQ8OP0&#038;hl=en_GB&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Problems</strong></p>
<pre name="code" class="bash">

libxi (<a href="http://forums.nvidia.com/lofiversion/index.php?t30464.html">Nvidia forum link</a>)

make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common'
make[1]: Entering directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common'
In file included from ./../common/inc/paramgl.h:24,
                 from src/paramgl.cpp:19:
./../common/inc/GL/glut.h:60:20: error: GL/glu.h: No such file or directory
make[1]: *** [obj/release/paramgl.cpp.o] Error 1
make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/common'
make: *** [lib/libparamgl.so] Error 2
</pre>
<pre>
sudo apt-get install freeglut3 freeglut3-dev libx11-dev mesa-common-dev
</pre>
<pre name="code" class="bash">
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathinline.h:36: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:42: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:48: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:442: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
make[1]: *** [obj/release/particleSystem.cu.o] Error 255
make[1]: Leaving directory `/home/mat/NVIDIA_GPU_Computing_SDK/C/src/particles'
make: *** [src/particles/Makefile.ph_build] Error 2
</pre>
<p>The problem is due to having gcc 4.4 installed rather than 4.3, it is possible to install the older version of this compiler but it is simpler to modify common/common.mk and add the following extra flag (<a href="http://forums.nvidia.com/index.php?showtopic=104525">Nvidia forum link</a>):</p>
<pre class="bash">
# Change:
NVCCFLAGS += --compiler-options -fno-strict-aliasing
# To:
NVCCFLAGS += --compiler-options -fno-strict-aliasing --compiler-options -fno-inline</pre>
<p>and change the -O2</p>
<pre class="bash">
# Change:
COMMONFLAGS += -O2
# To:
COMMONFLAGS += -O0
</pre>
<p>The two remaining errors you may encounter are very similar and arrise from missing libraries:</p>
<p>libxi (<a href="http://forums.nvidia.com/index.php?showtopic=83217">Nvidia forum link</a>)</p>
<pre class="bash">
/usr/bin/ld: cannot find -lXi
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/particles] Error 1
</pre>
<pre name="code" class="bash">
sudo apt-get install libxi-dev
</pre>
<p>libxmu (<a href="http://forums.nvidia.com/index.php?showtopic=87692">Nvidia forum link</a>)</p>
<pre class="bash">/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/particles] Error 1</pre>
<pre name="code" class="bash">
sudo apt-get install libxmu-dev libxmu6
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthcopter.com/blog/2010/02/compiling-and-running-cuda-2-3-sdk-and-toolkit-on-ubuntu-9-10-x64-64-bit/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

