Compilers Review

While studying for my compilers final, I made a map of the information covered (using kdissert):

Tagged Tags: , on May 14, 2010 at 7:31 pm

Pyth Compiler

An x86 compiler for Pyth (a Python dialect)

The core lexer and parser are generated using Flex and Bison, from which the parser outputs an AST tree. Static analysis is preformed on the tree generating errors or producing a tree decorated with declaration, type and scope information. The tree is then transformed into an intermediate language (IL) for a virtual machine. Optionally, the IL can also be compiled down to assembly language (IA32) and used to produce a standalone executable.

Download: Source (C++)

Tagged on May 1, 2010 at 12:00 am

Angry Beard: Distortion Pedal

An audio distortion circuit

This was built based on the classic Angry Beard III circuit schematic, but heavily modified. A different OpAmp and transistor were used, the high-low switch was removed, added dual-power supply, I used an additional voltage divider to bring the gain down to a reasonable level at the output and I also added an on/off switch. The super-cheap OpAmp I used gives it a much grungier sound, which turned out surprisingly cool.

Download: Schematic (original)

Tagged on April 27, 2010 at 12:00 am

Path/Ray Tracer

A ray tracer and Monte Carlo path tracer

The core engine supports two modes of rendering: path tracing or ray tracing. The geometry of the scene and the various renderer settings are specified in a simple text file format.

Noteworthy features: tweakable multi-threading, variable anti-aliasing (2x, 4x, …), an OBJ file format parser, area lights, soft shadows, video export, Python API for controlling the renderer.

Download: Source (C++, Python)

Tagged on April 26, 2010 at 12:00 am

Mandelbrot Zoom



I created this last semester for a class on simulations (which also had a heavy emphasis on fractals). A Mandelbrot fractal is generated and then analyzed for the most “interesting” area to zoom in on.

The following animated gif shows the algorithm in action. The left side is the generated Mandelbrot fractal and the right side is a visualization of the activity detection algorithm. The algorithm is choosing how to zoom into the fractal in real-time (when the image was recorded).

I’ve also posted the Matlab code if you are interested in seeing how it works.

Tagged Tags: , on March 22, 2010 at 11:46 am

reCAPTCHA

Apparently using WordPress makes you a huge target for spam, so unfortunately I’ve had to resort to using a CAPTCHA again.

I’ve tried some alternative non-CAPTCHA filters, but none of them seem very reliable (some very simple tests were giving false positives).

On a (non-false) positive note, since this is my spring break, I’m trying to get some of my recent projects together and post them this week :)

Tagged Tags: , on March 22, 2010 at 11:34 am

Mandelbrot Zoom

An auto-zooming Mandelbrot fractal

A Mandelbrot fractal is generated and then analyzed for the most “interesting” area to zoom in on.

The following animated gif shows the algorithm in action. The left side is the generated Mandelbrot fractal and the right side is a visualization of the activity detection algorithm. The algorithm is choosing how to zoom into the fractal in real-time (when the image was recorded).

Download: Source (Matlab)

Tagged on March 22, 2010 at 12:00 am

PacMW

A master-worker distributed AI tournament

PacMW is specifically the distributed server component of U.C. Berkeley’s Pacman AI tournament. It provides basic primitives for distributed communication, schedules work to be preformed, collects results and stores the outcomes of individual matches in a sqlite database on the master server. It can be used to execute individual tournaments or run as a daemon process.

To learn more about the Pacman AI projects, check out the Official Site

Tournament Download: Source (Python)

Tagged on December 16, 2009 at 12:00 am

PyMW: Summer-y of Code

Today is the “suggested pencils down” date for Summer of Code and I’m very happy to say that my proposal is complete and I feel the summer was a great success!

For those of you who don’t know, PyMW is a Master-Worker computing framework in Python. It wraps several other Master-Worker frameworks such as MPI, Condor, BOINC or even just using multi-core processors, and exposes them as a simple and elegant API.

The way it works is, you create tasks and submit them to a Master and the master uses an interface/wrapper (BOINC, Condor, MPI, etc) to process those tasks. The master distributes the tasks out to compute nodes (or processor cores), called Workers, and the results get sent back to the Master. This allows you to debug using the multi-core interface (a single machine) and then, by changing one switch on the command line, you can run the same code on thousands of machines using BOINC or any other supported interface.

My proposal was to improve BOINC integration with PyMW by 1) eliminating the startup script and the need to compile C code; 2) adding pure-Python support for BOINC Assimilators and Validators; and 3) by adding a new checkpointing mechanism for long running jobs (optional).

I completed (2) very quickly by virtue of some old Python code I found in BOINC, but (1) took a lot of sweat and tears — the existing BOINC interface was functional, but in need of some serious work. It was running under Mac and Linux, however the Windows client was crashing on every task. To get it working under Windows I ended up creating a C++ launcher application to avoid using batch scripts.

In addition to my proposal, I also added a few other tasks. When working with BOINC, the existing interface assumed that Python was already installed and on the system PATH environment variable. This is not a very safe assumption and so I also crated a portable Python interpreter integrated with the BOINC API. PyMW will now install this interpreter as your BOINC application so that clients no longer need to have Python installed to run PyMW-BOINC compute jobs. Along the way I also created a new logo and graphic design for the PyMW web site and setup WordPress, check it out.

Sadly goal (3) was not completed, however, it was originally proposed as an optional part of the project. I actively chose to pursue the BOINC-Python interpreter over (3) because I felt it was more important to the BOINC interface. In the end, checkpointing can always be done manually, but sending the Python interpreter is a considerably harder task.

I am still wrapping up a few odds and ends, but for the most part, I feel very happy with the state of the BOINC interface. If you are looking for a distributed or parallel processing framework for a future project, please consider PyMW.

If you have any questions or comments, I would love to hear them!

Tagged Tags: , , on August 10, 2009 at 12:45 pm

PyBOINC Work Continues

I am still working on PyBOINC (the embedded Python interpreter with support for BOINC). The actual integration (exposing the BOINC API to Python) was easy, it’s the cross-platform build that’s most difficult.

The problem is that when running an application on BOINC, you have no guarantee of what libraries will be available, so you must either distribute the libraries you need or compile them statically. I chose the later, which also caused lots of issues with the Python standard library. It’s mostly working now, with the exception of the sqlite module.

I moved the repo over to my bit bucket account since Nicolas is busy with other projects. The latest code can be found here.

Tagged Tags: , , , on July 31, 2009 at 4:11 pm

Next Page »