<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"> <channel><title>Miscellaneous</title> <link>http://blog.andrecardoso.eu</link> <description>"adj.,  having various qualities, aspects, or subjects..."</description> <lastBuildDate>Sat, 24 Sep 2011 19:18:13 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/andrecardoso/bYoR" /><feedburner:info uri="andrecardoso/byor" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Gracefully turn off an ESXi host and VMs</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/YsQUKEJbQCg/</link> <comments>http://blog.andrecardoso.eu/2011/09/gracefully-turn-off-an-esxi-host-and-vms/#comments</comments> <pubDate>Sat, 24 Sep 2011 19:17:41 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[sysadmin]]></category> <category><![CDATA[ac fail]]></category> <category><![CDATA[esxi]]></category> <category><![CDATA[ups]]></category> <category><![CDATA[vmware]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=605</guid> <description><![CDATA[So, with this, you get a VM listening to you UPS state, and connecting to the virtualization host when the AC fails. The graceful shutdown of all the VMs is only possible thanks to the vmware tools installed on each one of the VMs.]]></description> <content:encoded><![CDATA[<p>It&#8217;s been a long time&#8230; well, here we go.</p><p>We have a virtualized server on the office, using a free VMware ESXi 4.1 solution. We also have the machine connected to a UPS.</p><p>Unfortunately, the power lines on the office already have failed us, so we wanted to configure the server to shutdown gracefully all the VMs and then shutdown the host itself.</p><p>These were the steps we took to take care of this:</p><p><em>Install vmware tools on all the VMs. Using the vsphere console (I think that&#8217;s what its called&#8230;) is easy enough:</em></p><ul><li>right mouse button on top of the VM name &gt; Guest &gt; install VMware tools;</li><li>on windows guests, just follow the wizard</li><li>On linux guests, mount /dev/cdrom, copy the tar.gz to some temporary location, extract it, use the *_install.pl script to install (accept all the defaults, ensure you have previously installed gccs, linux-headers, and such (on ubuntu, build-essential and linux-headers should be enough)</li></ul><p><em>Create a new VM (once again, using the vsphere) with minimal disk space and RAM, to just install the UPS drivers. This VM job is just take care of listen to the UPS connected to the host. On the properties of the VM, make sure you add a serial port, mapping directly to the physical serial port of the host</em></p><ul><li>On my case, I installed ubuntu server; The UPS we have on the office is a Riello NETDialog, so we downloaded the drivers from the manufacturer (NUT did not have drivers for it) and installed them. Just had to configure the UPS connection to use the serial on /dev/ttyS0</li></ul><p><em>Now comes the nice part: the idea is to make this VM to connect to the host OS and run the appropriate commands to begin the shutdown process. SSH to the rescue&#8230; on that VM, just create a pair of SSH keys (ssh-keygen -t RSA, for example) <strong>WITHOUT PASSWORD</strong>, and push the public one to the host. </em></p><ul><li>Of course, you have first to enable SSH on the ESXi host first. For that, we just connected a monitor and keyboard to the host temporarily, logged in using root, and enable the something troubleshooting option, which is a fancy name for turning on the SSH server.</li><li>with the ssh public key on the ESXi host, you just have to put it on the well known authorized_keys file<em></em></li><li>mkdir .ssh</li><li>cat id_rsa.pub &gt; .ssh/authorized_keys</li></ul><p><em>Done, you should  now have access to the ESXi host without having to enter a key. Which means, you can automate the process of shuting it down when the UPS starts running on battery, by running an arbitrary command through SSH. On this matter, here goes the script we used on the ESXi host to shutdown everything (this came from a blog whose link I can&#8217;t remember. I&#8217;m trully sorry. The credits for this should not go to me!)</em></p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
## get all the VMs identifiers
VMID=$(/usr/bin/vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}')
## loop through all the VMs
for i in $VMID
do
## get their state (turned on, off, whatever)
STATE=$(/usr/bin/vim-cmd vmsvc/power.getstate $i | tail -1 | awk '{print $2}')
## if they are running, turn them off (only works correctly if
## vmware tools are installed on the VMs)
if [ $STATE == on ]
then
/usr/bin/vim-cmd vmsvc/power.shutdown $i
fi
done
## shutdown the host itself
sleep 30
/sbin/shutdown.sh
/sbin/poweroff
</pre><ul><li>we saved the script above inside <strong>/home/</strong>shutdownVMs.sh (we had to create the directory first) on the ESXi host</li></ul><p><em>There&#8217;s a small problem here: I&#8217;m quite new to this VMware things, but from my understanding, the host completely wipes out all the files you&#8217;ve just created on reboot. Everything you see from <strong>/</strong> on the filesystem gets wiped when the machine reboots. So we have to take a few steps to get the changes you&#8217;ve made on <strong>authorized_keys</strong> and the shutdown script inside <strong>/home</strong>  permanent. These steps include packing up the directories and files you&#8217;ve created and editing a file (I&#8217;ve seen this on a blog I can&#8217;t remenber&#8230; sorry):</em></p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
## pack your files
tar -C / -czf &quot;/bootbank/home.tgz&quot; /.ssh /home
## edit the file /bootbank/boot.cfg and add the new compressed file. In our case,
## the file reads the following:
kernel=b.z
kernelopt=
modules=k.z --- s.z --- c.z --- oem.tgz --- license.tgz --- m.z --- state.tgz --- home.tgz
build=4.1.0-348481
updated=1
bootstate=0
</pre><ul><li>We&#8217;re done on ESXi; now is just configure the UPS monitoring VM, to run a specific command upon AC fail; We&#8217;ve done the following:</li></ul><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
ssh -i *my_private_key* root@*esxi_host_ip 'sh /home/shutdownVMs.sh'
</pre><h2>Conclusion</h2><p>So, with this, you get a VM listening to your UPS state, and connecting to the virtualization host when the AC fails. The graceful shutdown of all the VMs is only possible thanks to the vmware tools installed on each one of the VMs.</p> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/YsQUKEJbQCg" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2011/09/gracefully-turn-off-an-esxi-host-and-vms/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2011/09/gracefully-turn-off-an-esxi-host-and-vms/</feedburner:origLink></item> <item><title>Revert commits with GIT</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/vbK_yNdr_Fw/</link> <comments>http://blog.andrecardoso.eu/2011/04/revert-commits-with-git/#comments</comments> <pubDate>Fri, 15 Apr 2011 16:00:53 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Dev]]></category> <category><![CDATA[git]]></category> <category><![CDATA[revert commit]]></category> <category><![CDATA[version control]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=598</guid> <description><![CDATA[Revert changes done through a series of commits.]]></description> <content:encoded><![CDATA[<p>I had a situation where I followed a determined development path, which turned out to be&#8230; not so good!</p><p>So, I wanted to revert the changes I made (in several commits done) to the repository, creating a commit which would throw away those changes.</p><p>I found a possible solution in <a
href="http://stackoverflow.com/questions/1463340/revert-multiple-git-commits " target="_blank">http://stackoverflow.com/questions/1463340/revert-multiple-git-commits</a></p><p>Assuming you have a history like:</p><p><strong>(&#8230;) -&gt; A -&gt; B -&gt; C -&gt; D</strong></p><p>and you want to revert all the changes done through <strong>B, C </strong>and <strong>D, </strong>you can try something like:<strong><br
/> </strong></p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ git reset --hard A
$ git reset --soft @{1}
$ git commit -a
</pre><p>where <strong>A</strong> is the SHA of the commit you want to revert to.</p> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/vbK_yNdr_Fw" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2011/04/revert-commits-with-git/feed/</wfw:commentRss> <slash:comments>1</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2011/04/revert-commits-with-git/</feedburner:origLink></item> <item><title>How to Create a Radiograph (DRR) from a CAD model</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/5VuNCQTulpQ/</link> <comments>http://blog.andrecardoso.eu/2011/03/how-to-create-a-radiograph-drr-from-a-cad-model/#comments</comments> <pubDate>Mon, 28 Mar 2011 00:53:03 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Academic]]></category> <category><![CDATA[Dev]]></category> <category><![CDATA[cuda]]></category> <category><![CDATA[drr]]></category> <category><![CDATA[radiograph]]></category> <category><![CDATA[rasterization]]></category> <category><![CDATA[thesis]]></category> <category><![CDATA[triangles]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=568</guid> <description><![CDATA[A summary of the problems I tried to tackle during my thesis project. DRR generation using CUDA and 3D vertebrae models.]]></description> <content:encoded><![CDATA[<div><p>Creating a Digitally Reconstructed Radiograph (<strong>DRR</strong>) from a triangle mesh is like shooting <em>rays</em> from some source position to each pixel of the final image. One pixel, one ray. The objective is to find intersection points of those rays with each triangle composing the model. Intersection points enables us to calculate distances to the source and, from these, the distance a ray traverses inside the object&#8217;s volume (<em>path length</em>).</p><p>Applying this final value to a particular formula &#8212; <a
href="http://en.wikipedia.org/wiki/Attenuation" target="_blank">attenuation law</a> &#8212; (just summing all distances and multiplying by an attenuation factor, basically) gives us the final intensity for a pixel.</p><h2>Context<a
href="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/abuffer-spine-pa.png"><img
class="alignright size-large wp-image-584" title="abuffer-spine-pa" src="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/abuffer-spine-pa-235x1024.png" alt="" width="191" height="830" /></a></h2><p>This post relates to the research project I developed during my thesis, which I concluded a few weeks ago. The goal was to develop efficient algorithms for <strong>DRR generation from 3D models of human vertebrae. </strong>For this purpose, a set of algorithms were implemented under <a
href="http://www.nvidia.com/object/cuda_home_new.html" target="_blank">NVIDIA&#8217;s CUDA</a> platform, which allowed the implementation in GPU.</p><p>The post will not have much detail. But for whom is interested, the complete thesis report can be found <a
href="ftp://andrecardoso.eu/ftp/thesis/thesis_vfinal.pdf" target="_blank">here</a>, and the presentation used during the defense is <a
href="ftp://andrecardoso.eu/ftp/thesis/presentation.pdf" target="_blank">here</a> (or on <a
href="http://www.slideshare.net/thyandrecardoso/generation-of-planar-radiographs-from-3d-anatomical-models-using-the-gpu" target="_blank">slideshare</a>). Following is the description of the most important problems treated during the project.</p><h2>Naive approach?</h2><p>We can span a thread for each pixel, following what was described above: iterate over all the triangles, apply a ray-triangle intersection test (heavy computation) and, if an intersection exists, calculate the distance to the source. Or we can do this in reverse: span a thread for each triangle (possibly, fewer threads) and do the same computation. However, we have concurrency problems here, because different threads will try to access the same pixel buffers to hold intermediate information. Moreover, using either approach &#8212; <strong>image</strong> order or <strong>object</strong> order &#8212; we still have to blend together all the intersection-source distances, in an orderly fashion. What was described, computes intersections in triangle submission order (unordered). For example, the picture shows a ring-shaped model. To compute its DRR, we would shoot rays to every pixel. One ray is depicted in the picture, having as intersections points P1, P2, P3 and P4. Finding the path length of the ray is just a matter of subtracting and adding distances. However, we need to do this in depth order!! The problem with the described algorithms is that there is no guarantee we will compute those four points in the correct order&#8230;</p><p>These two approaches are expensive to perform, mainly because of all the intersection tests and distance calculation.</p><div
id="attachment_573" class="wp-caption aligncenter" style="width: 624px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/intersections.png"><img
class="size-large wp-image-573 " title="Path length calculation" src="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/intersections-1024x469.png" alt="" width="614" height="281" /></a><p
class="wp-caption-text">We want to compute (||P2 − P1|| + ||P4 − P3||). Careful with triangle edges!</p></div><h2>A faster approach</h2><p>It is possible to simplify this problem by assuming that the DRR quality is not significantly affected if we <strong>don&#8217;t</strong> bother to compute <strong>Euclidean-based distances</strong>.</p><p
style="text-align: center;"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/depth_calc.png"><img
class="aligncenter size-large wp-image-574" title="depth_calc" src="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/depth_calc-1024x375.png" alt="" width="614" height="225" /></a></p><p
style="text-align: justify;">&nbsp;</p><p
style="text-align: justify;">Instead of looking for ray-triangle intersections, we can just compute the (<strong>interpolated</strong>) depth value of all the <strong>fragments</strong> falling into a pixel, and accept that each of those values is an approximation of the ray intersection distance to the source. Doing this in CUDA is considerably faster than the other approaches.</p><p
style="text-align: justify;">Without many details, this can be implemented using somewhat of a triangle rasterization procedure: for each triangle of the model, <strong>our goal is to determine all the pixels it covers when projected onto the image plane</strong>, and store each <strong>fragment&#8217;s depth as a integer</strong>. To solve this, I followed a scanline approach, mixed with Bresenham line algorithm to avoid floats during part of the algorithm.</p><p
style="text-align: justify;">The problem with this approach, is that we are spanning a thread for each triangle (object order) and, as said before, we&#8217;ll have concurrency problems when trying to save the fragment&#8217;s depth on the correct pixel buffer. To avoid this, we can make use of  <strong>CUDA atomic operations</strong>. The following enables any number of threads to safely write on an array, concurrently,  and storing some value on a different array index.</p><p
style="text-align: justify;">&nbsp;</p><pre class="brush: cpp; collapse: false; light: false; title: ; toolbar: true; notranslate">
index = atomicInc(&amp;counter, INT_MAX)
depthArray[index] = Znew // RAW-hazard free!!!! BASED ON [3]
</pre><p
style="text-align: justify;">After this stage &#8212; where for each pixel we save all the fragment&#8217;s depths &#8212; we&#8217;ll end up with a 3-dimensional grid containing all the projected fragments. But they will not be ordered. For the final stage we just need to order them, and subtract them two by two, accumulating the result. We end up with a bi-dimensional grid &#8212; where each value comes from the blending of each pixel depth array &#8212; which is our DRR.</p><p
style="text-align: justify;">&nbsp;</p><p
style="text-align: justify;">The advantage of the described approach is that we avoid complicated math, artifact generation (careful scanline procedure &#8212; <a
href="http://www.devmaster.net/articles/software-rendering/part4.php" target="_blank">filling convention</a>!) and we get a complete DRR with <strong>one single geometry</strong> pass.</p><p
style="text-align: justify;">&nbsp;</p><p
style="text-align: justify;">&nbsp;</p><div
id="attachment_580" class="wp-caption aligncenter" style="width: 563px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/l3pa.png"><img
class="size-full wp-image-580" title="l3pa" src="http://blog.andrecardoso.eu/wp-content/uploads/2011/03/l3pa.png" alt="" width="553" height="286" /></a><p
class="wp-caption-text">DRR from l3 vertebra, taken from a frontal perspective</p></div></div><p>The topics covered in this post were the subject of my thesis, during this last semester. The document can be seen <a
href="ftp://andrecardoso.eu/ftp/thesis/thesis_vfinal.pdf" target="_blank">here</a>. The presentation, used during the defense, can be seen in <a
href="http://www.slideshare.net/thyandrecardoso/generation-of-planar-radiographs-from-3d-anatomical-models-using-the-gpu" target="_blank">slideshare</a>.</p><p>Keep in mind that this is a blog post, and I did not bother to properly reference previous work or authors. Credits for many of what I explored here is due to other people&#8217;s work. Below, is a <strong>very incomplete</strong> list of previous work.</p><p>Any question, comment or advise <strong>is welcome</strong>.</p><h2>References</h2><ol><li>Vidal, F. P., M.Garnier, N. Freud, J. M. Létang, and N. John (2009). Simulation of x-ray attenuation on the gpu. In Proceeding of TCPG’09 &#8211; Theory and Practice of Computer Graphics, pp. 25–32. Eurographics.</li><li>Bresenham, J. E. (1965). Algorithm for computer control of a digital plotter. IBM Systems Jour- nal 4(1), 25 –30.</li><li>Liu, F., M.-C. Huang, X.-H. Liu, and E.-H. Wu (2010). Freepipe: a programmable parallel ren- dering architecture for efficient multi-fragment effects. In I3D ’10: Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games, New York, NY, USA, pp. 75–82.</li><li>Moura, D. C., J. Boisvert, J. G. Barbosa, and J. M. Tavares (2009). Fast 3d reconstruction of the spine using user-defined splines and a statistical articulated model. In ISVC ’09: Proceedings of the 5th International Symposium on Advances in Visual Computing, Berlin, Heidelberg, pp. 586–595. Springer-Verlag.</li><li><a
href="http://www.devmaster.net/articles/software-rendering/part4.php" target="_blank">Filling convention</a></li><li><a
href="http://www.nvidia.com/object/cuda_home_new.html" target="_blank">NVIDIA CUDA platform</a></li></ol> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/5VuNCQTulpQ" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2011/03/how-to-create-a-radiograph-drr-from-a-cad-model/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2011/03/how-to-create-a-radiograph-drr-from-a-cad-model/</feedburner:origLink></item> <item><title>Func is Funky</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/Ts7B9mdF9Q8/</link> <comments>http://blog.andrecardoso.eu/2010/09/func-is-funky/#comments</comments> <pubDate>Thu, 02 Sep 2010 18:31:11 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[sysadmin]]></category> <category><![CDATA[administration]]></category> <category><![CDATA[fedora]]></category> <category><![CDATA[func]]></category> <category><![CDATA[kickstart]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[python]]></category> <category><![CDATA[remote]]></category> <category><![CDATA[shell globs]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=551</guid> <description><![CDATA[Func, Fedora Unified Network Controller, allows us to send commands for remote execution in a set of pre-configured hosts. More, it allows us to choose which machines we want to address using shell globs. This, and more, is done securely over SSL. Func facilitates remote administration.]]></description> <content:encoded><![CDATA[<h2>Context</h2><p><a
href="https://fedorahosted.org/func/" target="_blank">Func</a>, <strong>Fedora Unified Network Controller</strong>, allows us to send commands for remote execution in a set of pre-configured hosts. More, it allows us to choose which machines we want to address using <strong>shell globs</strong>. This, and more, is done securely over <strong>SSL</strong>. Func <strong>facilitates</strong> remote <strong>administration</strong>.</p><p>Func is a Fedora project whose general architecture is based on two parties: <strong>Func</strong> itself and <a
href="https://fedorahosted.org/certmaster/" target="_blank"><strong>Certmaster</strong></a>. Certmaster is responsible for authentication and encryption using SSL certificates. Certificates are identity proofs. And, from my knowledge, (correct me) they are little more than a signature (private key encryption of an hash) attached to a cryptographic public key. Certmaster application is composed by a <strong>client</strong> and a <strong>daemon</strong> capable of requesting and serving SSL certificates. This enables a <strong>master</strong> machine to communicate with a <strong>slave</strong> over SSL.</p><p>On top of this comes Func: it is also a built on <strong>client-server style</strong> and enables administrators to build an infrastructure of slave machines running the daemon <strong>funcd</strong>. This daemon listens on a port for requests from a certain master machine. In fact, the SSL scheme behind it lets us sleep tight at night knowing that those slaves will only reply to the master and not some fake.</p><p>The master is where the all-powerful sysadmin is logged in <img
src='http://blog.andrecardoso.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> From that machine, the sysadmin can issue commands for execution by the slaves at the same time. Even cooler, he can address those machines in the following manner:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
&quot;*fe.up.pt&quot;
</pre><p>Meaning <em>all the machines in the &#8220;fe.up.pt&#8221; domain under my control. </em>How cool is that?</p><p>Func is <strong>python</strong>, and has a python <strong>API</strong> so, besides using Func directly, we can even build our own customized scripts.</p><h2>Installation&#8230;</h2><p>I tested this in <strong>CentOS</strong> <strong>5</strong>. I think Func and Certmaster are in the EPEL repo.</p><p>This, in fact, little more than what can be found in the official Func page.</p><h3>On the master:</h3><p>Install Func and Certmaster. Certmaster gets pushed by Func on installation.</p><p><strong>Certmaster daemon</strong> will be running on the <strong>master</strong> machine, making it possible for the slaves (called <strong><em>minions</em></strong>) to request certificates.</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ yum install func
$ /sbin/chkconfig --level 345 certmaster on
$ /sbin/service certmaster start
</pre><h3>On the slave machines:</h3><p>On the minions, the funcd will be running, accepting requests from func client and running commands. Besides this, func will try to request certificate signing from the master. For this to work, we&#8217;ll need to indicate the master&#8217;s address on the certmaster configuration file.</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ yum install func
</pre><p>Edit the <em>/etc/certmaster/minion.conf</em> file and change the address of your master machine. For example:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
# configuration for minions
[main]
certmaster = master.fe.up.pt
certmaster_port = 51235
log_level = DEBUG
cert_dir = /etc/pki/certmaster
</pre><p>Now, put the funcd running at boot and start it.</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$/sbin/chkconfig --level 345 funcd on
$/sbin/service funcd start
</pre><p><strong>Also</strong>, you need to open <a
href="https://fedorahosted.org/func/wiki/PortInfo" target="_blank">ports</a> on <strong>iptables</strong>. The master machine must have port <strong>51235</strong> open, and the minions must have port <strong>51234</strong> open.</p><h2>Working</h2><p>Now we have the environment set.</p><p>Before starting to send commands to slaves, we need to &#8220;sign&#8221; them first. Issue the following command from the master to list the slave machines. If everything is <strong>ok</strong>, you&#8217;ll see <strong>all the slave machines</strong> where you&#8217;ve just installed func.</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ certmaster-ca --list
</pre><p>Once you&#8217;ve seen the machines <strong>that are ready to be signed</strong>, you can sign them:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ certmaster-ca --sign slave1.fe.up.pt
$ certmaster-ca --sign slave2.fe.up.pt
$ ...
</pre><h3>Example</h3><p>Now, you&#8217;re <strong>ready to send commands</strong>. Let&#8217;s imagine you want to send a message to all logged users on the slaves, <strong>using <em>wall</em> command</strong>:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ func &quot;*.fe.up.pt&quot; call command run &quot;wall 'Hello users! Machine will go down for reboot in 1 minute! Save you work!'&quot;
</pre><p>This is a simple example. You can use more complex <strong>globbing</strong> to address specific machines. See <a
href="https://fedorahosted.org/func/wiki/CommandLineGlobbing" target="_blank">https://fedorahosted.org/func/wiki/CommandLineGlobbing</a>.</p><h2>About provisioning</h2><p>If you want to integrate minion installation with <strong>kickstart</strong> for example, it&#8217;s fairly simple, as you <strong>only need</strong> to install <strong>packages</strong> and change a line of the <strong>config</strong> file.</p><p>You can run into some problems if you happen to kickstart a minion machine, both in the master and slave. This is because in the master there will be a CSR inconsistent with the new machine. And in the minion, because funcd automatically retrieves the certificate at boot, funcd will have a wrong certificate, one referring to the previous state of the machine before re installation. You can solve this by cleaning SSL keys and such in the minion and cleaning the certificate request on the master:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
# on the new, kickstarted machine
$ service funcd stop
$ rm -rf /etc/pki/certmaster/*
# on the master
$ certmaster-ca --clean &lt;hostname_of_the_kickstarted_machine&gt;
# again, on the slave
$ service funcd start
# on the master again
$ certmaster-ca --sign &lt;hostname_of_the_kickstarted_machine&gt;
</pre><p>All this is just to clean certificates and certificate requests form both ends.</p><p><strong>This can be avoided if, immediately before restarting the minion to a re installation</strong>,  we clean its respective certificate request in the master with:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
$ certmaster-ca --clean &lt;hostname&gt;
</pre><p><strong>This way</strong>, when the minion <strong>boots up with the funcd</strong> daemon running, it will reach a <strong>consistent</strong> state.</p><p>Still, you&#8217;ll have to issue the <em>&#8211;sign</em> command.</p><h2>References</h2><ul><li><a
href="https://fedorahosted.org/func/" target="_blank">https://fedorahosted.org/func/</a></li></ul> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/Ts7B9mdF9Q8" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/09/func-is-funky/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/09/func-is-funky/</feedburner:origLink></item> <item><title>I haz Bunny</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/Mk_Oh8D4-Y8/</link> <comments>http://blog.andrecardoso.eu/2010/08/i-haz-bunny/#comments</comments> <pubDate>Sat, 28 Aug 2010 01:49:46 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[bunny]]></category> <category><![CDATA[pet]]></category> <category><![CDATA[photos]]></category> <category><![CDATA[rabbit]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=532</guid> <description><![CDATA[Rabbit photos]]></description> <content:encoded><![CDATA[<p>I haz bunny.</p><p>He&#8217;s called <em>Jordão</em> and there&#8217;s a small chance he&#8217;s actually a <em>she</em>&#8230; I don&#8217;t know&#8230; <img
src='http://blog.andrecardoso.eu/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /></p><div
id="attachment_534" class="wp-caption aligncenter" style="width: 650px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action001.jpg"><img
class="size-full wp-image-534" title="The Cage" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action001.jpg" alt="" width="640" height="480" /></a><p
class="wp-caption-text">The Cage</p></div><div
id="attachment_538" class="wp-caption aligncenter" style="width: 650px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action005.jpg"><img
class="size-full wp-image-538" title="Jordão Resting" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action005.jpg" alt="" width="640" height="480" /></a><p
class="wp-caption-text">Jordão Resting</p></div><div
id="attachment_537" class="wp-caption aligncenter" style="width: 650px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action004.jpg"><img
class="size-full wp-image-537" title="Jordão facing me" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action004.jpg" alt="" width="640" height="480" /></a><p
class="wp-caption-text">Jordão facing me</p></div><div
id="attachment_541" class="wp-caption aligncenter" style="width: 650px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action008.jpg"><img
class="size-full wp-image-541" title="Jordão being held...He does not like it...heads will roll...!" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action008.jpg" alt="" width="640" height="480" /></a><p
class="wp-caption-text">Jordão being held...He does not like it...heads will roll...!</p></div><div
id="attachment_544" class="wp-caption aligncenter" style="width: 650px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action011.jpg"><img
class="size-full wp-image-544" title="Jordão dating a gal" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/Action011.jpg" alt="" width="640" height="480" /></a><p
class="wp-caption-text">Jordão dating a gal</p></div><p
style="text-align: center;"> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/Mk_Oh8D4-Y8" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/08/i-haz-bunny/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/08/i-haz-bunny/</feedburner:origLink></item> <item><title>OpenAFS Encryption and Kerberos V</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/4xsSjyIhRPY/</link> <comments>http://blog.andrecardoso.eu/2010/08/openafs-encryption-and-kerberos-v/#comments</comments> <pubDate>Mon, 16 Aug 2010 01:41:21 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Academic]]></category> <category><![CDATA[sysadmin]]></category> <category><![CDATA[encryption]]></category> <category><![CDATA[fcrypt]]></category> <category><![CDATA[kerberos]]></category> <category><![CDATA[openafs]]></category> <category><![CDATA[µSG]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=513</guid> <description><![CDATA[Kerberos. Type of Encryption used in OpenAFS communications.]]></description> <content:encoded><![CDATA[<h2>Context</h2><p>It was our intention to build a secure network, with single sign-on mechanisms. With &#8216;secure&#8217; we mean secure authentication and transmission of data. <a
href="http://web.mit.edu/kerberos/" target="_blank">Kerberos</a> solves the problem of secure authentication using a shared secret key architecture. In fact, while authenticating principals passwords are never sent over the cables. Authentication is based upon the ability of the principal of decrypting some piece of information.</p><p>Kerberos also solves the problem of mutual authentication: each service (server) and consumer must  know for sure that they are communicating with authorized parties and not with fakes. This is cleverly solved using the <em>Needham-Schroeder </em>scheme. This algorithm enables two parties to share a session key, securely. The session key can be further used to protect communications between them. In particular, Kerberos introduces the concept of <em>Authenticators</em>. These are, basically, principal identifiers and timestamps. When a client initiates communication with a service, sends him &#8230; well it sends him a butload of things <img
src='http://blog.andrecardoso.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> but the important thing is that it sends him a Authenticator encrypted with the session key that both will use. However, the service cannot decrypt it yet, because it has no access to the session key itself. To obtain the session key, he first has to decrypt another part of the message sent by the client, which is the <strong>session key encrypted with the key that only he and the Ticket Granting Service</strong> share. Now, the service is prepared to decrypt the Authenticator sent by the client and reply to him with a new Authenticator which now contains the original timestamp plus 1. This goes, once again, encrypted using the same session key. This can somewhat be seen in the pictures below. They were taken from the course I&#8217;ve attended last year on <a
href="https://www.fe.up.pt/si_uk/DISCIPLINAS_GERAL.FORMVIEW?P_ANO_LECTIVO=2010/2011&amp;P_CAD_CODIGO=PRODEI011&amp;P_PERIODO=1S" target="_blank">Computer Systems Security</a>.</p><div
id="attachment_518" class="wp-caption aligncenter" style="width: 591px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/kerberos11.png"><img
class="size-large wp-image-518   " title="Kerberos Authentication" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/kerberos11-1024x407.png" alt="Kerberos Authentication" width="581" height="231" /></a><p
class="wp-caption-text">Authentication protocol used in Kerberos. Simplified. Taken from the lecture notes of Computer Systems Security: http://web.fe.up.pt/~jmcruz/ssi/acetat/4-autentica.pdf</p></div><p
style="text-align: center;"><div
id="attachment_516" class="wp-caption aligncenter" style="width: 310px"><a
href="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/kerberos2.png"><img
class="size-medium wp-image-516 " title="Kerberos Service Request" src="http://blog.andrecardoso.eu/wp-content/uploads/2010/08/kerberos2-300x110.png" alt="Kerberos Service Request" width="300" height="110" /></a><p
class="wp-caption-text">Service request phase. Simplified. Taken from the lecture notes of Computer Systems Security: http://web.fe.up.pt/~jmcruz/ssi/acetat/4-autentica.pdf</p></div><p>Wrapping up, mutual authentication is achieved, from the service side, by matching the information found in the Authenticator against the information found in the ticket (crafted by the TGS) and the network information. If everything matches, the client is authenticated. The client authenticates the server when it receives from it the proper authenticator in reply to its own.</p><h2>Problem</h2><p>By now we have authentication and, as a sub-product of kerberos system, communication encryption. <a
href="http://openafs.org/" target="_blank">OpenAFS</a> can now enter here as a means to distribute, for example, the home directories of users over the network (network login facilities&#8230;). OpenAFS has the advantage of being a natively <em>kerberized</em> application. The problem is the type of encryption supported by it.</p><p>If I&#8217;m not mistaken, AES is accepted as the strongest encryption algorithm and is also supported by Kerberos. However, by what I know, there are two problems with OpenAFS: it only supports <strong><a
href="http://docs.openafs.org/Reference/8/asetkey.html" target="_blank">des-cbc-crc:v4</a> </strong>principal keys, which means authentication is done using a weak encryption protocol. The other problem is that communication between afs clients and servers get encrypted using something even weaker: <a
href="http://users.surfvi.com/~ota//fcrypt-paper.txt" target="_blank">fcrypt</a>.</p><p>In fact, this is something that confuses me: I thought that encryption of any two parties &#8220;talking&#8221; kerberos was done using the session key given by the TGS. But it seems that applications like OpenAFS bypass this, using their own encryption scheme. Or maybe the session key is used only for the mutual authentication part. In this case, what type of encryption protocol is used those messages? This whole thing about encryption leaves me confused&#8230;<strong>if someone cares to shed some light, it would much appreciated</strong> <img
src='http://blog.andrecardoso.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>But as far as I know, in the current network design that we were trying to mount (kerberos, ldap, openafs) <strong>the <em>weak link</em> is OpenAFS</strong>, because all the other principals can use of AES encryption type.</p><p>Nonetheless, this whole scheme of Kerberos plus OpenAFS plus OpenLDAP is just great to whom seeks to secure a smaller network within unsecured networks.</p><h2>References</h2><ul><li><a
href="http://users.surfvi.com/~ota//fcrypt-paper.txt" target="_blank">http://docs.openafs.org/Reference/8/asetkey.html</a></li><li><a
href="http://users.surfvi.com/~ota//fcrypt-paper.txt" target="_blank">http://users.surfvi.com/~ota//fcrypt-paper.txt</a></li><li><a
href="http://docs.openafs.org/Reference/1/fs_setcrypt.html" target="_blank">http://docs.openafs.org/Reference/1/fs_setcrypt.html</a></li><li><a
href="http://web.mit.edu/kerberos/krb5-1.8/krb5-1.8.3/doc/krb5-admin.html#Supported%20Encryption%20Types" target="_blank">http://web.mit.edu/kerberos/krb5-1.8/krb5-1.8.3/doc/krb5-admin.html#Supported%20Encryption%20Types</a></li><li><a
href="http://en.wikipedia.org/wiki/Needham-Schroeder_protocol" target="_blank">http://en.wikipedia.org/wiki/Needham-Schroeder_protocol</a></li><li><a
href="http://en.wikipedia.org/wiki/Kerberos_%28protocol%29#Client_Service_Authorization" target="_blank">http://en.wikipedia.org/wiki/Kerberos_%28protocol%29#Client_Service_Authorization</a></li><li><a
href="http://web.mit.edu/Kerberos/dialogue.html" target="_blank">http://web.mit.edu/Kerberos/dialogue.html</a></li><li><a
href="http://openafs.org/" target="_blank">http://openafs.org/</a></li><li><a
href="http://web.mit.edu/kerberos/" target="_blank">http://web.mit.edu/kerberos/</a></li><li><a
href="http://web.fe.up.pt/~jmcruz/ssi/acetat/4-autentica.pdf" target="_blank">http://web.fe.up.pt/~jmcruz/ssi/acetat/4-autentica.pdf</a></li></ul> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/4xsSjyIhRPY" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/08/openafs-encryption-and-kerberos-v/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/08/openafs-encryption-and-kerberos-v/</feedburner:origLink></item> <item><title>Code Design</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/z5sDBKBCrPM/</link> <comments>http://blog.andrecardoso.eu/2010/07/code-design/#comments</comments> <pubDate>Wed, 28 Jul 2010 12:11:14 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Academic]]></category> <category><![CDATA[Dev]]></category> <category><![CDATA[code]]></category> <category><![CDATA[design]]></category> <category><![CDATA[good practices]]></category> <category><![CDATA[programming]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=504</guid> <description><![CDATA[Code Design quotation, by Martin Fowler.]]></description> <content:encoded><![CDATA[<p><em>“Any fool can write code that a computer can understand. Good  programmers write code that humans can understand.”<br
/> -Martin Fowler et  al, Refactoring: Improving the Design of Existing Code, 1999</em></p> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/z5sDBKBCrPM" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/07/code-design/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/07/code-design/</feedburner:origLink></item> <item><title>Thesis Presentations – DRRs from 3D anatomical models</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/7gxdTizB3IM/</link> <comments>http://blog.andrecardoso.eu/2010/07/thesis-presentations-drrs-from-3d-anatomical-models/#comments</comments> <pubDate>Wed, 14 Jul 2010 21:21:01 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Academic]]></category> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[cuda]]></category> <category><![CDATA[drr]]></category> <category><![CDATA[feup]]></category> <category><![CDATA[glsl]]></category> <category><![CDATA[radiographs]]></category> <category><![CDATA[thesis]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=499</guid> <description><![CDATA[The presentations made by me on the first phase of the thesis. Generation of planar radiographs from 3D anatomical models using the GPU.
Till here, was just about gathering information, reading papers...from now on, I start coding.]]></description> <content:encoded><![CDATA[<p>Well, I&#8217;ve made my second presentation about my thesis theme. I was about presenting information gathered about the area.</p><p>As the previous post with my first presentation seems to have vanished from my blog (VPS problems :S), I leave here the first presentation as well.</p><div
id="__ss_4754023" style="width: 425px;"><strong
style="display: block; margin: 12px 0 4px;"><a
title="Generation of planar radiographs from 3D anatomical models using the GPU" href="http://www.slideshare.net/thyandrecardoso/presentation-4754023">Generation of planar radiographs from 3D anatomical models using the GPU &#8211; 14/07/2010</a></strong><object
id="__sse4754023" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param
name="allowFullScreen" value="true" /><param
name="allowScriptAccess" value="always" /><param
name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=presentation-100714114159-phpapp01&amp;stripped_title=presentation-4754023" /><param
name="name" value="__sse4754023" /><param
name="allowfullscreen" value="true" /><embed
id="__sse4754023" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=presentation-100714114159-phpapp01&amp;stripped_title=presentation-4754023" name="__sse4754023" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><div
style="padding: 5px 0 12px;">View more <a
href="http://www.slideshare.net/">presentations</a> from <a
href="http://www.slideshare.net/thyandrecardoso">thyandrecardoso</a>.</div></div><div
id="__ss_4056896" style="width: 425px;"><strong
style="display: block; margin: 12px 0 4px;"><a
title="Generation of planar radiographs from 3D anatomical models using the GPU " href="http://www.slideshare.net/thyandrecardoso/presentation-4056896">Generation of planar radiographs from 3D anatomical models using the GPU &#8211; 10/05/2010 </a></strong><object
id="__sse4056896" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param
name="allowFullScreen" value="true" /><param
name="allowScriptAccess" value="always" /><param
name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=presentation-100511175011-phpapp02&amp;stripped_title=presentation-4056896" /><param
name="name" value="__sse4056896" /><param
name="allowfullscreen" value="true" /><embed
id="__sse4056896" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=presentation-100511175011-phpapp02&amp;stripped_title=presentation-4056896" name="__sse4056896" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><div
style="padding: 5px 0 12px;">View more <a
href="http://www.slideshare.net/">presentations</a> from <a
href="http://www.slideshare.net/thyandrecardoso">thyandrecardoso</a>.</div></div><h2>Update (31/07/2010):</h2><p>The term has ended, and I&#8217;ve finished the report for the course dedicated to prepare us for the thesis development on the next school term.</p><p>So, I leave here the link for the report, to complete the documentation:</p><p><a
href="ftp://andrecardoso.eu/ftp/PDIS/report.pdf">ftp://andrecardoso.eu/ftp/PDIS/report.pdf</a></p><p>(It&#8217;s far from perfect though:)</p> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/7gxdTizB3IM" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/07/thesis-presentations-drrs-from-3d-anatomical-models/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/07/thesis-presentations-drrs-from-3d-anatomical-models/</feedburner:origLink></item> <item><title>Keyboard Prayer</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/-sl_lquvY0k/</link> <comments>http://blog.andrecardoso.eu/2010/06/keyboard-prayer/#comments</comments> <pubDate>Thu, 24 Jun 2010 15:52:24 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Dev]]></category> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[geek]]></category> <category><![CDATA[keyboard prayer]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=496</guid> <description><![CDATA[A prayer :)]]></description> <content:encoded><![CDATA[<h2><em>Keyboard Prayer</em></h2><p><em>Our program who art in memory, Hello be thy Name. Thy Operating System come, thy Commands be done, at the Printer as it is on the screen. Give us this day our daily data, and forgive us our I/O Errors as we forgive those whose Logic Circuits are faulty. Lead us not into frustration, and deliver us from Power Surges. For Thin is the Algorithm, the Application, and the Solution, looping forever and ever.</em></p><p><em>Return.</em></p><p>(Credits go to the author, whom I don&#8217;t know. It is a nice prayer though..:P)</p> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/-sl_lquvY0k" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/06/keyboard-prayer/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/06/keyboard-prayer/</feedburner:origLink></item> <item><title>CUDA on Mac OS X 10.6.3</title><link>http://feedproxy.google.com/~r/andrecardoso/bYoR/~3/TJm-gtDevaQ/</link> <comments>http://blog.andrecardoso.eu/2010/06/cuda-on-mac-os-x-10-6-3/#comments</comments> <pubDate>Thu, 10 Jun 2010 20:29:48 +0000</pubDate> <dc:creator>belerophon</dc:creator> <category><![CDATA[Academic]]></category> <category><![CDATA[Dev]]></category> <category><![CDATA[cuda]]></category> <category><![CDATA[errors]]></category> <category><![CDATA[library]]></category> <category><![CDATA[mac os x 10.6.3]]></category> <category><![CDATA[no table of contents]]></category> <guid isPermaLink="false">http://blog.andrecardoso.eu/?p=490</guid> <description><![CDATA[Installing and compiling the sample programs throws "no table of contents" when linking against libcutil_i386.a library. This problem has an easy fix, the hard part is the lack of support and information.]]></description> <content:encoded><![CDATA[<p>Yesterday I&#8217;ve downloaded the CUDA SDK for Mac OS X, from <a
href="http://developer.nvidia.com/object/cuda_3_0_downloads.html" target="_blank">here</a>. I&#8217;ve installed the drivers, toolkit and samples. Everything installs fine.</p><p>Then, if you look to the &#8220;<a
href="http://developer.download.nvidia.com/compute/cuda/3_0/docs/GettingStartedMacOS.pdf" target="_blank">Getting Started Guide for Mac</a>&#8220;, they tell you to make sure your gpu is supported and then compile the sample code provided in <strong>/Developer/GPU Computing/C/.</strong></p><p>This part failed for me, because I kept getting the &#8220;<strong>no table of contents</strong>&#8221; error when the linker tried to link against the libraries, namely the <strong>libcutil_i386.a. </strong></p><p>I&#8217;ve managed to compile the samples after googling for this and reading the posts in <a
href="http://forums.nvidia.com/index.php?showtopic=105940&amp;st=20&amp;p=989833&amp;#entry989833" target="_blank">this nvidia forum</a>. So, following some recommendations found in the forum I opened the file <strong>common.mk</strong> found in <strong>/Developer/GPU Computing/C/common</strong> and changed lines 39 and 306 to the following:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
39: SNOWLEOPARD = $(strip $(findstring 10.6, $(shell egrep &quot;&lt;string&gt;10\.6\.3&quot; /System/Library/CoreServices/SystemVersion.plist)))
306: LINKLINE  = ar rucvs $(TARGET) $(OBJS)
</pre><p>Note the different version number of the OS and the <strong>s</strong> switch in the LINKLINE, which forces the creation of an index.</p><p>Then I tried to <strong>make clean</strong> and <strong>make</strong> again, but the error persisted. This time, I read <a
href="http://forums.nvidia.com/index.php?showtopic=79189" target="_blank">this</a> and found the solution, which is to run the <strong>ranlib</strong> command in the directories containing the libraries used during the compilation of the samples:</p><pre class="brush: bash; collapse: false; light: false; title: ; toolbar: true; notranslate">
cd &quot;/Developer/GPU Computing/C/lib&quot;
ranlib *.a
cd &quot;/Developer/GPU Computing/shared/lib&quot;
ranlib *.a
</pre><p>By the way, apparently, the ranlib command creates a table of contents&#8230;</p><p>This got me rid of the errors.</p><p>Hope this helps.</p><h2>References</h2><ul><li><a
href="http://developer.nvidia.com/object/cuda_3_0_downloads.html" target="_blank">http://developer.nvidia.com/object/cuda_3_0_downloads.html</a></li><li><a
href="http://forums.nvidia.com/index.php?showtopic=79189" target="_blank">http://forums.nvidia.com/index.php?showtopic=79189</a></li><li><a
href="http://forums.nvidia.com/index.php?showtopic=105940&amp;st=20&amp;p=989833&amp;#entry989833" target="_blank">http://forums.nvidia.com/index.php?showtopic=105940&amp;st=20&amp;p=989833&amp;#entry989833</a></li></ul> <img src="http://feeds.feedburner.com/~r/andrecardoso/bYoR/~4/TJm-gtDevaQ" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://blog.andrecardoso.eu/2010/06/cuda-on-mac-os-x-10-6-3/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <feedburner:origLink>http://blog.andrecardoso.eu/2010/06/cuda-on-mac-os-x-10-6-3/</feedburner:origLink></item> </channel> </rss>

