Links - 2009 Nov 19

Sunday 8k

2009nov15_8k

Any snow and ice that was on the streets is gone again and +4C with little wind is quite ideal for running. 8.10km in 54 minutes makes for a leisurely 6:46min/km pace.

OpenMP test on i7

Here's a simple piece of c-code (try zipped version) for testing how to parallelize code with OpenMP. It compiles with
gcc -fopenmp -lm otest.c

The CPU-load while running looks like this:

cpuload

Looks like two logical CPUs never get used (two low lines beyond "5" in the chart). It outputs some timing information:

running with 1 threads: runtime = 17.236827 s clock=17.230000
running with 2 threads: runtime = 8.624231 s clock=17.260000
running with 3 threads: runtime = 5.791805 s clock=17.090000
running with 4 threads: runtime = 5.241023 s clock=20.820000
running with 5 threads: runtime = 4.107738 s clock=20.139999
running with 6 threads: runtime = 4.045839 s clock=20.240000
running with 7 threads: runtime = 4.056122 s clock=20.280001
running with 8 threads: runtime = 4.062750 s clock=20.299999

which can be plotted like this:
chart
I'm measuring the clock-cycles spent by the program using clock(), which I hope is some kind of measure of how much work is performed. Note how the amount of work increases due to overheads related to creating threads and communication between them. Another plot shows the speedup:
speedup

The i7 uses Hyper Threading to present 8 logical CPUs to the system with only 4 physical cores. Anyone care to run this on a real 8-core machine ? 🙂

Next stop is getting this to work from a Boost Python extension.

Carbide-insert Lathe Tools

tools

I got tired of sharpening dull high-speed steel tools, so tried some carbide-insert tooling today. Seems to work fine in brass and aluminium. Note ca 1.5 mm thick piece of PCB-material underneath tool which elevates the 12x12mm tool-holder to the center of the chuck (within maybe 0.1mm).

tools2

A set of five different tools with 12x12 mm holders. Not sure what all the different shapes are good for, but I'll find out eventually. Would still need a small tool that fits into a 12-13mm hole for internal turning.

alu_bit

Surface finish is better than before. The carbide inserts like high speeds, with our lathe that means running it at the max 1500 rpm for most of the time.

Learning VTK

I'm trying to learn how to render and animate things using VTK. This is the result of a python-script which outputs a series of PNG-frames. These are then converted to jpegs by this command:

mogrify -format jpg -quality 97 *.png

mogrify -format jpg -quality 97 *.png

and converted to a DIVX movie like this:
mencoder mf://*.jpg -mf fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -ac copy -o output.avi -ffourcc DX50

This should lead to the revival of my old Drop-Cutter code in the near future. This time it's going to be in C++, with Python bindings, and hopefully use OpenMP. Stay tuned.