<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>nonzen journal</title>
 <link href="http://nonzen.in/atom.xml" rel="self"/>
 <link href="http://nonzen.in/"/>
 <updated>2012-02-08T03:35:39-05:00</updated>
 <id>http://nonzen.in/</id>
 <author>
   <name>Sajith Sasidharan</name>
   <email>sajith@nonzen.in</email>
 </author>

 
 <entry>
   <title>Shiny yak: shave all HTML email!</title>
   <link href="http://nonzen.in/2012/02/06/shiny-yak-shave-email.html"/>
   <updated>2012-02-06T00:00:00-05:00</updated>
   <id>http://nonzen.in/2012/02/06/shiny-yak-shave-email</id>
   <content type="html">&lt;p&gt;
The year is 2012.  Some curmudgeonly persons that missed the memo
still refuse to embrace web 2.0 and hold on to their beloved, but
old-fashioned, &lt;a href=&quot;http://www.fetchmail.info/&quot;&gt;fetchmail&lt;/a&gt; + &lt;a href=&quot;http://www.procmail.org/&quot;&gt;procmail&lt;/a&gt; + &lt;a href=&quot;http://www.mutt.org/&quot;&gt;mutt&lt;/a&gt; + emacs + &lt;a href=&quot;http://msmtp.sourceforge.net/&quot;&gt;msmtp&lt;/a&gt; setups for
email processing.  Your humble correspondent is one of these persons.
This blog thing (how quaint) is obviously an evidence.
&lt;/p&gt;
&lt;p&gt;
At some point in the past, I was so curmudgeonly that my email
signature was this:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;sigs waste bandwidth.
&lt;/pre&gt;



&lt;p&gt;
If you're in the above-stated curmudgeonly group, you might even
recall this blast from the past:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;:    /&quot;\
:    \ /    ASCII Ribbon Campaign
:     X   against HTML email &amp;amp; vCards
:    / \
&lt;/pre&gt;



&lt;p&gt;
That war was valiantly fought, and lost.  (It seems that the old
warriors have silently admitted defeat and fatigue.  Maybe winning the
war against vCards was a reasonable compromise.)  One reason would be
that most email clients (notably Gmail's web interface and Outlook)
chose to ignore the outcry and their default is to compose HTML email.
Another reason would be that bandwidth and disk space are not
expensive and scarce anymore.  Yet another reason would be that,
unlike days of the olde, majority of email users are not nerds that
care about this stuff.
&lt;/p&gt;
&lt;p&gt;
This however bothers our curmudgeonly person, who has faithfully
subscribed to a number of old-fashioned mailing lists that are (of
course!) is affected by the the &quot;problem&quot; of HTML email.  (Dealing
with HTML email from friends and associates was enough, but you'd
expect better from fellow nerds in &lt;i&gt;bloody mailing lists&lt;/i&gt;.  But alas.)
On confronting this nasty problem &lt;i&gt;everywhere&lt;/i&gt;, our curmudgeonly
person would think: &quot;I know, I will unleash the might of procmail on
these bastards!&quot;
&lt;/p&gt;
&lt;p&gt;
Now he has a buttload of butt-ugly problems.  You've got to pay
attention to this anyway, because this is a kinda-sorta shiny yak.
&lt;/p&gt;

&lt;div id=&quot;outline-container-1&quot; class=&quot;outline-3&quot;&gt;
&lt;h3 id=&quot;sec-1&quot;&gt;What didn't work &lt;/h3&gt;
&lt;div class=&quot;outline-text-3&quot; id=&quot;text-1&quot;&gt;


&lt;p&gt;
One trouble with HTML email is that it is usually really composed of
two parts: a text/plain part, and a text/html part.  With procmail, it
should be fairly straightforward to add a filter to get rid of the
text/html part, but it wasn't.  I tried a couple of things that didn't
work:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;a href=&quot;http://www.nongnu.org/procmail-lib/manual/index-body.html#144&quot;&gt;pm-jamime-kill.rc&lt;/a&gt; from &lt;a href=&quot;https://savannah.nongnu.org/projects/procmail-lib/&quot;&gt;procmail-lib&lt;/a&gt;: this didn't work since it
    depends on mimencode which is &lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=212342&quot;&gt;not available in Debian&lt;/a&gt; any more.
    See, even those curmudgeonly Debian people have given upon you!

&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://pwet.fr/man/linux/commandes/mimefilter&quot;&gt;mimefilter&lt;/a&gt; would suit old-fashioned curmudgeonly mailing list
    admins.  It scrubs the offending email clean of text/html part
    before forwarding it to a list, and sends a stern warning to the
    originator of the email.  I might be curmudgeonly but I'm not a
    mailing list admin, so I don't want to warn anyone. I just want
    &quot;cleaner&quot; email.  There's no configuration parameter to change
    this behavior, and I wasn't inclined to hack on the script.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/div&gt;

&lt;/div&gt;

&lt;div id=&quot;outline-container-2&quot; class=&quot;outline-3&quot;&gt;
&lt;h3 id=&quot;sec-2&quot;&gt;What did work &lt;/h3&gt;
&lt;div class=&quot;outline-text-3&quot; id=&quot;text-2&quot;&gt;


&lt;p&gt;
The solution was finally found in a little script found in an old
&lt;a href=&quot;http://www.perlmonks.org/?node_id=53404&quot;&gt;Perlmonks.org post&lt;/a&gt;.  (The title of that post, &lt;i&gt;Strip Brain-Damaged Mails of &quot;HTML Alternative&quot; Evilness!&lt;/i&gt;, is perhaps reflective of
global nerd community's sentiments of the time.)  I saved the script,
and stuck this to my ~/.procmailrc:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;CLEANMAIL=$HOME/bin/clean-mail.pl

:0
* ^((List-Id|X-(Mailing-)?List):(.*[&amp;lt;]\/[^&amp;gt;]*))
{
    LISTID=$MATCH

    :0:
    * LISTID ?? ^\/[^@\.]*
    | $CLEANMAIL &amp;gt;&amp;gt; $MATCH
}
&lt;/pre&gt;



&lt;p&gt;
This will &quot;automagically&quot; sort mailing list mail into folders by name
of the list, while cleaning the suckers of any evil text/html.
(There's a bit of Org-mode fail in there: please ignore the
&lt;code&gt;ORG-LIST-END-MARKER&lt;/code&gt; line if you see it.)
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id=&quot;outline-container-3&quot; class=&quot;outline-3&quot;&gt;
&lt;h3 id=&quot;sec-3&quot;&gt;Conclusion &lt;/h3&gt;
&lt;div class=&quot;outline-text-3&quot; id=&quot;text-3&quot;&gt;


&lt;p&gt;
You might be inclined to make fun of Perl (and procmail) because (a)
you're too cool to use this old ugly hippie proletarian stuff, or (b)
your complain that Perl and the such it ignores advancements made in
programming language research over the last twenty or so years, or (c)
you tend to compare ParrotVM to Duke Nukem Forever, or (d) all of the
above.
&lt;/p&gt;
&lt;p&gt;
But I've got to advocate: it works, and it works flawlessly, for
certain values of &quot;works&quot;.  It's a &lt;i&gt;shiny enough&lt;/i&gt; yak.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Building Copperhead</title>
   <link href="http://nonzen.in/2011/10/16/copperhead.html"/>
   <updated>2011-10-16T00:00:00-04:00</updated>
   <id>http://nonzen.in/2011/10/16/copperhead</id>
   <content type="html">&lt;p&gt;
This semester, I've signed up for three courses:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.cs.indiana.edu/~dfried/&quot;&gt;Dan Friendman&lt;/a&gt;'s &lt;a href=&quot;https://www.cs.indiana.edu/cgi-pub/c311/doku.php&quot;&gt;Programming Language Principles&lt;/a&gt;,
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.cs.indiana.edu/~rrnewton/&quot;&gt;Ryan Newton&lt;/a&gt;'s &lt;a href=&quot;http://www.cs.indiana.edu/~rrnewton/courses/B629_DSLs/&quot;&gt;Domain Specific Languages and Compilers&lt;/a&gt;, and
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.cs.indiana.edu/~achauhan/&quot;&gt;Arun Chauhan&lt;/a&gt;'s &lt;a href=&quot;https://www.cs.indiana.edu/~achauhan/Teaching/B649/2011-Fall/&quot;&gt;Parallel Architectures and Programming&lt;/a&gt;.
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;
All of them have been great so far.  The last two are graduate seminar
classes and both classes have a project.  I'm happy about this setup
since there is some overlap in what I'm doing - the DSL class
specifically focuses on various forms of parallelism, so I get to
study more of the same thing.  Projects for both these classes involve
some amount of GPU computation, so it's more of more of the same
thing, or something.
&lt;/p&gt;

&lt;div class=&quot;figure&quot;&gt;
&lt;p&gt;&lt;img src=&quot;http://nonzen.in/images/posts/2011-10-16-copperhead.png&quot; alt=&quot;copperhead!&quot; title=&quot;copperhead!&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Copperhead&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
(The image is from &lt;a href=&quot;http://research.nvidia.com/publication/copperhead-compiling-embedded-data-parallel-language&quot;&gt;nvidia's site&lt;/a&gt;.)
&lt;/p&gt;
&lt;p&gt;
For the DSL class, the project I've signed up for is a comparative
study of &lt;a href=&quot;http://code.google.com/p/copperhead/&quot;&gt;Copperhead&lt;/a&gt; and &lt;a href=&quot;http://hackage.haskell.org/package/accelerate&quot;&gt;Accelerate&lt;/a&gt;, which are GPGPU DSLs for Python
and Haskell respectively.  There is some literature available: mainly,
the PPoPP paper, &lt;a href=&quot;http://www.eecs.berkeley.edu/Pubs/TechRpts/2010/EECS-2010-124.html&quot;&gt;Compiling an Embedded Data Parallel Language&lt;/a&gt; and
Brian Catanzaro's PhD thesis, &lt;a href=&quot;http://www.eecs.berkeley.edu/Pubs/TechRpts/2011/EECS-2011-45.html&quot;&gt;Compilation Techniques for Embedded Data Parallel Languages&lt;/a&gt; on Copperhead; and &lt;a href=&quot;http://www.cse.unsw.edu.au/~chak/papers/CKLM+11.html&quot;&gt;Accelerating Haskell Array Codes with Multicore GPUs&lt;/a&gt; on Accelerate.
&lt;/p&gt;
&lt;p&gt;
I'd been having some trouble with building Copperhead &amp;ndash; mainly
because I haven't done any Python in a long time, and because I'm
installing stuff into non-default directories, &lt;i&gt;and&lt;/i&gt; because I've been
lax in reading documentation.  So I thought of writing down the
exercise here.
&lt;/p&gt;
&lt;p&gt;
The machine happens to run Gentoo 2.0.3; and I do not have admin
access to this machine.  So some of the dependencies are installed in
my home directory, under &lt;code&gt;~/software&lt;/code&gt;.  Therefore I also need to set
some environment variables:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;export PYTHONPATH=\
        $HOME/software/lib64/python2.7/site-packages:\
        $HOME/software/lib/python2.7/site-packages:\
        $PYTHONPATH
export PATH=~/software/bin:$PATH
&lt;/pre&gt;




&lt;p&gt;
The dependencies are:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python 2.7.  We have Python 2.7.1 on this machine.

&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.nvidia.com/object/cuda_home_new.html&quot;&gt;CUDA&lt;/a&gt; 3.0.  We have 4.0.

&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://numpy.scipy.org/&quot;&gt;numpy&lt;/a&gt; 1.3.  We have 1.6.0.

&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.boost.org/&quot;&gt;Boost&lt;/a&gt; 1.38, though only boost-python and boost-thread are really
    needed.  We have boost 1.42.

&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mathema.tician.de/software/pycuda&quot;&gt;PyCUDA&lt;/a&gt; - this was a pain point.  PyCUDA's build.py doesn't seem to
    support installing with non-root permissions (&quot;&lt;code&gt;python setup.py&lt;/code&gt;&quot;
    would say: &quot;&lt;code&gt;--prefix&lt;/code&gt;? We don't know what that is!&quot;).  Finally I
    actually read Python &lt;a href=&quot;http://docs.python.org/distutils/index.html&quot;&gt;distutils&lt;/a&gt; documentation and figured out this
    should have been actually really painless, and felt quite
    embarrassed:
&lt;/li&gt;
&lt;/ul&gt;





&lt;pre class=&quot;example&quot;&gt;git clone http://git.tiker.net/trees/pycuda.git
cd pycuda
easy_install --prefix=~/software .
&lt;/pre&gt;




&lt;p&gt;
This installs PyCUDA, including the dependencies.  (decorator, py,
pytest, pytools etc.)
&lt;/p&gt;
&lt;p&gt;
(This doesn't quite work &amp;ndash; see the January 3 update below.)
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mathema.tician.de/software/codepy&quot;&gt;CodePy&lt;/a&gt;, which is a C/C++ metaprogramming toolkit in Python!  It's
    &quot;meta&quot; in the sense that it supports:

&lt;ul&gt;
&lt;li&gt;Generating C/C++ code;
&lt;/li&gt;
&lt;li&gt;And then compiling the generated code and, then loading it
        dynamically into Python runtime.
&lt;/li&gt;
&lt;/ul&gt;

&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;
 Installing CodePy turned out to be straightforward:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;git clone http://git.tiker.net/trees/codepy.git
cd codepy
easy_install --prefix=~/software .
&lt;/pre&gt;




&lt;p&gt;
    There's some noise about a missing &lt;code&gt;cgen&lt;/code&gt; dependency; I chose to
    ignore it for now.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/thrust/&quot;&gt;Thrust&lt;/a&gt;, a C++ CUDA library that resembles STL.  Since this is a
    template library, there's really nothing to &quot;build&quot; and install;
    furthermore, CUDA 4.0 ships with Thrust.  Squee!
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;
(As a side note, the last three projects appear to be very interesting
on their own and deserve further investigation.  This I will hopefully
get to do before the end of the semester.)
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, installed copperhead itself:
&lt;/li&gt;
&lt;/ul&gt;





&lt;pre class=&quot;example&quot;&gt;hg clone https://code.google.com/p/copperhead/
cd copperhead
easy_install --prefix=~/software .
&lt;/pre&gt;




&lt;p&gt;
No trouble there either.  However:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;$ python -c &quot;import copperhead;&quot;
Traceback (most recent call last):
  File &quot;&amp;lt;string&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
  File &quot;[...] copperhead/__init__.py&quot;, line 20, in &amp;lt;module&amp;gt;
    from prelude import *
  File &quot;[...] copperhead/prelude.py&quot;, line 46, in &amp;lt;module&amp;gt;
    import copperhead.runtime.places as PL
  File &quot;[...] copperhead/runtime/__init__.py&quot;, line 29, in &amp;lt;module&amp;gt;
    cuda.init()
pycuda._driver.RuntimeError: cuInit failed: no device
&lt;/pre&gt;




&lt;p&gt;
This probably means we're in trouble:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;$ python -c &quot;import pycuda.driver as cuda; cuda.init()&quot;
Traceback (most recent call last):
  File &quot;&amp;lt;string&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
pycuda._driver.RuntimeError: cuInit failed: no device
&lt;/pre&gt;




&lt;p&gt;
&lt;a href=&quot;http://lists.tiker.net/pipermail/pycuda/2010-March/002258.html&quot;&gt;Bummer&lt;/a&gt;.  It looks the machine doesn't have a CUDA driver installed
yet:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;$ /opt/cuda/sdk/C/bin/linux/release/deviceQuery
[deviceQuery] starting...
/opt/cuda/sdk/C/bin/linux/release/deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 38
-&amp;gt; no CUDA-capable device is detected
[deviceQuery] test results...
FAILED

Press ENTER to exit...
&lt;/pre&gt;




&lt;p&gt;
Double bummer!  
&lt;/p&gt;
&lt;p&gt;
Turns out that the nVidia GeForce 7300 GT &lt;a href=&quot;http://developer.nvidia.com/cuda-gpus&quot;&gt;isn't listed as a CUDA device&lt;/a&gt; in nVidia's website.  This is surprising because: two weeks
back I wrote and executed a simple OpenCL program just fine with
&lt;code&gt;CL_DEVICE_TYPE_GPU&lt;/code&gt; &lt;i&gt;with&lt;/i&gt; nVidia's SDK.  The other option,
&lt;code&gt;CL_DEVICE_TYPE_CPU&lt;/code&gt; did not work &amp;ndash; my guess is that nVidia's OpenCL
doesn't do CPUs yet, despite the &quot;heterogeneous&quot; moniker.  The machine
has Intel CPU, but no Intel OpenCL SDK installed.
&lt;/p&gt;
&lt;p&gt;
On the other hand, my Thinkpad, which is a recent Sandy Bridge
machine, could do &lt;code&gt;CL_DEVICE_TYPE_CPU&lt;/code&gt; with Intel OpenCL SDK, but they
don't do &lt;code&gt;CL_DEVICE_TYPE_GPU&lt;/code&gt; yet.  But of course, no CUDA since this
is Intel.
&lt;/p&gt;
&lt;p&gt;
(Yes, there are several vendors in this space: nVidia, which pushes
both their own CUDA as well as OpenCL; Apple, Intel, AMD, PowerVR, IBM
&lt;i&gt;et al.&lt;/i&gt; which work with &lt;a href=&quot;http://www.khronos.org/opencl/&quot;&gt;Khronos&lt;/a&gt; industry consortium and has support
for OpenCL in varying degrees.)
&lt;/p&gt;
&lt;p&gt;
Now to go look for a machine with an actual CUDA device.  The perils
of bleeding edge&amp;hellip;
&lt;/p&gt;

&lt;div id=&quot;outline-container-1&quot; class=&quot;outline-2&quot;&gt;
&lt;h2 id=&quot;sec-1&quot;&gt;Updates &lt;/h2&gt;
&lt;div class=&quot;outline-text-2&quot; id=&quot;text-1&quot;&gt;




&lt;small&gt;&lt;em&gt;(Updated on 22 Oct 2011)&lt;/em&gt;&lt;/small&gt;

&lt;p&gt;
It turned out that &lt;i&gt;I was wrong&lt;/i&gt;, which is really awesome, because:
GeForce 7300 GT is actually a CUDA device!  The actual problem was
that I wasn't in the &lt;code&gt;video&lt;/code&gt; group, and once that was solved, I could
run some CUDA demo programs (such as &lt;code&gt;deviceQuery&lt;/code&gt;), and they agreed
that there indeed is some CUDA device.  (Which is: &lt;code&gt;Device 0: Tesla C1060&lt;/code&gt;.)
&lt;/p&gt;
&lt;p&gt;
It didn't end here though.
&lt;/p&gt;
&lt;p&gt;
The next trouble was with Python package &lt;a href=&quot;http://pypi.python.org/pypi/cgen/2011.1&quot;&gt;cgen&lt;/a&gt;, which was mentioned
earlier.  Cgen used to be a part of &lt;code&gt;codepy&lt;/code&gt;, but these days it is a
separate project with a separate Python package and everything.  And
this package turned out to be uninstallable via the usual means:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;$ pip install cgen
Downloading/unpacking cgen
  Could not find any downloads that satisfy the requirement cgen
No distributions at all found for cgen

$ easy_install cgen 
Checking existing site.py in $PYTHONPATH
Searching for cgen
Reading http://pypi.python.org/simple/cgen/
Reading http://mathema.tician.de/software/codepy
No local packages or download links found for cgen
error: Could not find suitable distribution for Requirement.parse('cgen')
&lt;/pre&gt;




&lt;p&gt;
(I suppose I should alert the maintainer.  I've been busy.)
&lt;/p&gt;
&lt;p&gt;
So I installed cgen like so: 
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;git clone http://git.tiker.net/trees/cgen.git
cd cgen
easy_install --prefix=$HOME/software cgen
&lt;/pre&gt;




&lt;p&gt;
I should be almost ready to run some simple test programs, but wait!
Now it's CUDA turn to complain: gcc-4.5 is not supported, and this is
presumbaly because of gcc's move to &lt;a href=&quot;http://dwarfstd.org/&quot;&gt;DWARF&lt;/a&gt;.  gcc-4.4 is supported and
was available, so I created a symlink &lt;code&gt;~/bin/gcc&lt;/code&gt; to
&lt;code&gt;/usr/bin/gcc-4.4.5&lt;/code&gt;, and placed &lt;code&gt;$HOME/bin&lt;/code&gt; ahead in the &lt;code&gt;$PATH&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
Next problem was a missing &lt;code&gt;libboost_python-gcc4.3-mt&lt;/code&gt;.  The system
has &lt;code&gt;boost_python&lt;/code&gt; installed; however codepy's default is to use the
former.  This was solved by having an &lt;code&gt;~/.aksetup-defaults.py&lt;/code&gt;, with
the following:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;BOOST_PYTHON_LIBNAME=[&quot;boost_python&quot;]
BOOST_THREAD_LIBNAME=[&quot;boost_thread&quot;]
&lt;/pre&gt;




&lt;p&gt;
This obscure piece of information came from &lt;a href=&quot;http://wiki.tiker.net/Hedge/HowTo/InstallingFromGit&quot;&gt;here&lt;/a&gt;.  I have no idea what
does &lt;code&gt;aksetup&lt;/code&gt; mean; nor could I find an explanation in codepy where
they look for the said file.
&lt;/p&gt;
&lt;p&gt;
We have one more environment variable to set up:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;export THRUST_PATH=/opt/cuda/include
&lt;/pre&gt;




&lt;p&gt;
At this point one of the sample programs bundles with copperhead run.
Yay!
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;$ python simple_tests.py 

---- Simple INTEGER tests ----
Procedure 'incr'                                   ... PASSED
   copperhead : [1, 2, 3, 4, 5, 6, 7]
Procedure 'incrList'                               ... PASSED
   copperhead : [1, 2, 3, 4, 5, 6, 7]
Procedure 'as_ones'                                ... PASSED
   copperhead : [1, 1, 1, 1, 1, 1, 1]
Procedure 'idm'                                    ... PASSED
   copperhead : [0, 1, 2, 3, 4, 5, 6]
Procedure 'idx'                                    ... PASSED
   copperhead : [0, 1, 2, 3, 4, 5, 6]
Procedure 'saxpy'                                  ... PASSED
   copperhead : [1, 3, 5, 7, 9, 11, 13]
Procedure 'saxpy2'                                 ... PASSED
   copperhead : [1, 3, 5, 7, 9, 11, 13]
Procedure 'saxpy3'                                 ... PASSED
   copperhead : [1, 3, 5, 7, 9, 11, 13]
Procedure 'sxpy'                                   ... PASSED
   copperhead : [0, 2, 4, 6, 8, 10, 12]

---- Simple FLOAT tests ----
Procedure 'as_ones'                                ... PASSED
   copperhead : [1, 1, 1, 1, 1, 1, 1]
Procedure 'idm'                                    ... PASSED
   copperhead : [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
Procedure 'idx'                                    ... PASSED
   copperhead : [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
Procedure 'sxpy'                                   ... PASSED
   copperhead : [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0]
&lt;/pre&gt;




&lt;p&gt;
Sadly that is the only sample I have managed to run.  None of the
other sample code worked, despite trying to get &lt;i&gt;their&lt;/i&gt; dependencies
also (&lt;code&gt;matplotlib&lt;/code&gt;, &lt;code&gt;plac&lt;/code&gt;, &lt;code&gt;scipy&lt;/code&gt;&amp;hellip;) to work, and grinding teeth
&lt;i&gt;harder&lt;/i&gt;.  They all &lt;i&gt;try hard&lt;/i&gt;, spew out some compiler messages and a
Python backtrace, and finally fail with the same error:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;codepy.CompileError: module compilation failed
&lt;/pre&gt;




&lt;p&gt;
This is, in fact, consistent with the disclaimer, so I guess I should
not complain too much. :-)
&lt;/p&gt;
&lt;blockquote&gt;

&lt;p&gt;Copperhead is currently under development. Many valid Copperhead
programs do not yet compile, and the compiler does not produce helpful
error messages. Code that does compile and run may execute
inefficiently, compared to hand-coded CUDA.  Join the mailing list and
let us know of your experiences, but don't expect things to work right
out of the box.
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;
Alright, off to join the mailing list then.
&lt;/p&gt;
&lt;p&gt;
(&lt;i&gt;Update&lt;/i&gt;: eventually rest of the tests also worked after rebuilding
PyCUDA with system-installed version of Boost &amp;ndash; see the January 3
update below.)
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id=&quot;outline-container-2&quot; class=&quot;outline-2&quot;&gt;
&lt;h2 id=&quot;sec-2&quot;&gt;Afterword &lt;/h2&gt;
&lt;div class=&quot;outline-text-2&quot; id=&quot;text-2&quot;&gt;


&lt;p&gt;
Needless to say, overall I found this whole experience
very&amp;hellip; tedious.  I documented the whole process nevertheless so that
(hopefully!)  I or my suffering partner in this project would not have
to figure all this stuff out again if there is another time.  I
understand this is the natural price one pays for using software that
has gone through very limited field testing, and that Copperhead did
not had a chance to gather a community around it, at least yet, and
that it's been a one-man project.  Still, I'd have liked the setup
part to be less work than this.
&lt;/p&gt;
&lt;p&gt;
Further, sadly, little work has been done after Copperhead's author
graduated from Berkeley.  There are precisely &lt;a href=&quot;http://code.google.com/p/copperhead/source/list&quot;&gt;three commit messages&lt;/a&gt; in
the repository and all of them are from September 2010 and the project
hardly seems to have made any progress after that.  There's some talk
about a roadmap in the mailing list though.
&lt;/p&gt;
&lt;p&gt;
What is really interesting, however, is that Accelerate is nicely
chugging along, in spite of Haskell's seemingly smaller community.
(You'd agree that it's &lt;i&gt;way smaller&lt;/i&gt; as opposed to Python community,
yes?)  Freshly checked out Accelerate &lt;i&gt;builds&lt;/i&gt; just fine on my
Thinkpad T420 (with the alternate CPU backend, not CUDA) without any
of the bothersome setup that Copperhead demanded; there are hundreds
of commits in the &quot;main&quot; github repository; and ten other forks not
counting mine.  (Which is yet to see some activity.  If only the
semester would let me!)
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id=&quot;outline-container-3&quot; class=&quot;outline-2&quot;&gt;
&lt;h2 id=&quot;sec-3&quot;&gt;Another round of updates &lt;/h2&gt;
&lt;div class=&quot;outline-text-2&quot; id=&quot;text-3&quot;&gt;




&lt;small&gt;&lt;em&gt;(Updated on 3 January 2012)&lt;/em&gt;&lt;/small&gt;

&lt;p&gt;
I was wrong in assuming that work on Copperhead has come to a stop
after Bryan's graduation and move to nVidia.  Bryan is still working
on this project, and his updates are present on a &lt;a href=&quot;http://code.google.com/r/bryancatanzaro-copperhead/source/browse&quot;&gt;cloned&lt;/a&gt; repository.
Hopefully we'll get to see a release soon; and I sincerely hope that
Copperhead, just like Thrust, will eventually become part of nVidia's
official CUDA SDK release.  That would seriously help in putting an
end to the era of boilerplate-ridden, highly error-prone, highly
frustrating process of writing GPGPU code.
&lt;/p&gt;
&lt;p&gt;
Secondly, PyCUDA as installed as above does not quite work, and &lt;a href=&quot;http://groups.google.com/group/copperhead-devel/browse_thread/thread/ff1c3d558674b656&quot;&gt;after asking in the mailing list&lt;/a&gt; it turned out that this is because of
PyCUDA shipping with a version of Boost.  The solution is to use
system-installed Boost.  These settings, from from PyCUDA's
&lt;code&gt;siteconf.py&lt;/code&gt;, are what worked for me:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;BOOST_INC_DIR=[&quot;/usr/include/boost-1_42/&quot;]
BOOST_LIB_DIR=[&quot;/usr/lib&quot;]
BOOST_COMPILER = 'gcc'
USE_SHIPPED_BOOST = False
BOOST_PYTHON_LIBNAME = ['boost_python']
BOOST_THREAD_LIBNAME = ['boost_thread']
&lt;/pre&gt;




&lt;p&gt;
That made rest of the tests also work.
&lt;/p&gt;
&lt;p&gt;
My impressions with Copperhead, in spite of the rather painful
installation procedure, are extremely positive: for code that is
practically developed by one person, it works quite well; and in our
benchmarks Copperhead code outperformed Accelerate.  This is not quite
surprising if you consider the fact that Copperhead-decorated Python
code in reality is loaded and run as native code, and not interpreted.
Admittedly our benchmarks are by no means exhaustive or even complete;
we merely benchmarked what's found to be the &quot;common surface area&quot; of
code that we could get working.  Which was, hopefully, Good Enough
(TM) for a course project.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Bulb Song Man</title>
   <link href="http://nonzen.in/2011/09/25/bulb-song-man.html"/>
   <updated>2011-09-25T00:00:00-04:00</updated>
   <id>http://nonzen.in/2011/09/25/bulb-song-man</id>
   <content type="html">&lt;div class=&quot;figure&quot;&gt;
&lt;p&gt;&lt;img src=&quot;http://nonzen.in/images/posts/bulb-600x600.png&quot; alt=&quot;bulb&quot; title=&quot;Bulb Song Man&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Bulb Song Man.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
This I drew using Gimp and a Wacom Bamboo, on request from Shiv.  I
would claim that this drawing bears some resemblance to Shiv, but let
us hear from our man first!
&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Meow!</title>
   <link href="http://nonzen.in/2011/08/21/meow.html"/>
   <updated>2011-08-21T00:00:00-04:00</updated>
   <id>http://nonzen.in/2011/08/21/meow</id>
   <content type="html">&lt;div class=&quot;figure&quot;&gt;
&lt;p&gt;&lt;img src=&quot;http://nonzen.in/images/posts/meow.jpg&quot; alt=&quot;meow!&quot; title=&quot;Meow!&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Meow!&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
I have been slowly slowly moving stuff into &lt;i&gt;my&lt;/i&gt; new apartment.  It is
&lt;i&gt;technically mine&lt;/i&gt; now since I have signed the lease and paid the
deposit and everything, but &lt;i&gt;not quite mine&lt;/i&gt; since I haven't moved in
&lt;i&gt;entirely&lt;/i&gt;.  It is kinda &lt;i&gt;nuanced&lt;/i&gt; like that.
&lt;/p&gt;
&lt;p&gt;
I took over the lease of this apartment from Roshan, and he has left a
ton of stuff behind.  The furniture and kitchen appliances and
utensils are certainly useful and saves me a great deal of hassle with
piling up all that stuff again.  Some of the stuff will be shipped to
wherever Rosh is finally settling down.  He has done quite a job of
leaving a clean apartment behind.
&lt;/p&gt;
&lt;p&gt;
But there are certain kind of stuff, like computer cables, that just
refuse to be clean.  While clearing a dusty cable mess from beneath
the computer table, I found a Wacom Bamboo tablet.
&lt;/p&gt;
&lt;p&gt;
Awesome.  I've been meaning to get one of these for many years now.
Finders ought to be keepers, yes?  Especially when it works in my
favor, yes?
&lt;/p&gt;
&lt;p&gt;
Even if I don't get to keep this one, I'm convinced that I should
eventually get one.  This tablet just worked with Debian wheezy/sid,
and Debian has mypaint, gimp, inkscape etc. which works quite well
with this Bamboo.  That is a really sweet deal.  
&lt;/p&gt;
&lt;p&gt;
I do need some practice with my wobbly hands though.  I'm really not
keeping my hopes up since the acrylic paint and sketchbook I bought
for using in my &lt;i&gt;summer skills development plan&lt;/i&gt; haven't been touched
yet.
&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hello world!</title>
   <link href="http://nonzen.in/2011/08/18/hello-world.html"/>
   <updated>2011-08-18T00:00:00-04:00</updated>
   <id>http://nonzen.in/2011/08/18/hello-world</id>
   <content type="html">&lt;div class=&quot;figure&quot;&gt;
&lt;p&gt;&lt;img src=&quot;http://nonzen.in/images/posts/bud.jpg&quot; alt=&quot;bud&quot; title=&quot;Bloomington, August 2011&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Bloomington, August 2011.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Text files are pretty awesome.  So are distributed version control
systems, such as git and mercurial.  Not everyone would agree, but I
think Emacs is &lt;i&gt;really&lt;/i&gt; awesome.  I've been seriously using Emacs 
&lt;a href=&quot;http://orgmode.org/&quot;&gt;Org-mode&lt;/a&gt; for a while now, as a todo-list and
calendar/agenda software, and for keeping notes and stuff, and for
putting a quick webpage together.  Org-mode is pretty neat.
&lt;/p&gt;
&lt;p&gt;
Weblogs are nice too.  That people can publish their thoughts and
ideas and stories, and have them read by friends are strangers in the
Internet, and sometimes hear back from them, is pretty nice.  They're
sort of out of fashion these days, since the kids are all now using
the new shiny social network &lt;i&gt;platforms&lt;/i&gt;.  Weblogs still serve some
useful function, in my opinion.
&lt;/p&gt;
&lt;p&gt;
But do you know what's really awesome?  Version controlled text files,
written using Org-mode, published in weblog form.  &lt;i&gt;Those&lt;/i&gt; are pretty
grand.  You don't need pesky database connections and pesky PHP code
which runs on the server, which really slow down things and make
things annoying.  Really nifty.
&lt;/p&gt;
&lt;p&gt;
I &lt;del&gt;have&lt;/del&gt; had been a regular user or
&lt;a href=&quot;http://sajith.livejournal.com&quot;&gt;livejournal&lt;/a&gt; for some years, which
had been a pretty decent deal in its days; but poor old livejournal is
practically a ghost town these days.  The servers are kind of shaky,
and are often bought to their knees by random DDOS attackers, and
there's fly-by advertising everywhere.  Furthermore, most of the
people that really &lt;i&gt;made&lt;/i&gt; the place, they're no longer using
livejournal, and a large number of those journals are practically dead
for lack of updates.  It's not the kind of place you would want to
invite your friends anymore.  This appears to be the fate of social
networks of all fashion: they rise and fall in popularity.  I do
however respect and admire the few friends who continue using
livejournal; I just have lost the resolve and desire to do so.
&lt;/p&gt;
&lt;p&gt;
In the meanwhile, I have been missing out on telling the story of my
life.  I might have done a few interesting things in the last few
years; but I have no written memory of those events.  For example, I
left my career of several years as a humble working class programmer
and came to graduate school at Indiana University.  It's been a fairly
big change, and I have been having a whale of a time.  I would have
liked to keep a record of what I've been doing and how much of a
doofus I have been, but alas.
&lt;/p&gt;
&lt;p&gt;
In the past I have learned much as a result of those attempts, and I
would like to continue doing so.  This is that attempt.  I want to
keep a record of my graduate school experience, as well as other life
experiences here; and I want to stay relatively unaffected by the
shenanigans of platforms run by other people.  Yup, that is the goal.
&lt;/p&gt;
&lt;p&gt;
This is a test post made using Emacs, Org-mode and
&lt;a href=&quot;https://github.com/mojombo/jekyll&quot;&gt;Jekyll&lt;/a&gt; site generator.
&lt;/p&gt;
</content>
 </entry>
 
 
</feed>

