Maximum Zeal ~ Emphatic prose on indulged fascinations

How to print assembly for your Java code in OS X

0. Write program. 1. Add JVM arguments to your program. -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly 2. Run your program. You will probably see the output below. Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output Could not load hsdis-amd64.dylib; library not loadable; PrintAssembly is disabled Hello World! Process finished with exitContinue Reading

Happy Birthday to me

And what better way to celebrate than to be granted my own personal Google doodle? Thanks Google. You made my day.Continue Reading

Upcoming Coursera course: Principles of Reactive Programming

Just a quick note to say that a new Coursera course begins on 4th Nov 2013 that looks very interesting indeed titled ‘Principles of Reactive Programming‘ taught by Martin Odersky, Erik Meijer and Roland Kuhn. It is intended as a follow on course from its precursor course ‘Functional Programming Principles in Scala‘ also taught byContinue Reading

Scala Cookbook: Simplifying nested pattern matching

Pattern matching in Scala is a natural and intuitive way of expressing branched logic and can greatly simplify complex branched logic in terms of readability but what if you need to branch within a branch? This can result in unsightly code and duplication of logic. Let’s see this first hand with an example. Let’s tryContinue Reading

Scala Cookbook: Tail recursive factorial

The direct port of a human readable description of the factorial algorithm may look as follows. However – this isn’t tail recursive and will fail for large inputs. Exception in thread “main” java.lang.StackOverflowError at java.math.BigInteger.getInt(BigInteger.java:3014) The classic nested accumulator helper function idiom can be used to make this tail recursive. So what’s going on here?Continue Reading

Scala Cookbook: Pattern matching on BigInt

Let’s take the factorial algorithm as an example. One might expect to convert this into a pattern matched equivalent as follows. In fact this will give you the error below. type mismatch; found : Int(0) required: BigInt Factorial.scala The reason is that BigInt is not a case class and does not have an unapply() methodContinue Reading

OpenCL Cookbook: 10 tips for high performance kernels

Today we adorn our performance hat in the OpenCL Cookbook series. OpenCL kernel optimisation is a black art and very very hard. Recently when I came across a list of 10 tips for high performance kernels in Matthew Scarpino’s excellent book: OpenCL in Action I just had to share it as it was a trueContinue Reading

AMD release APP SDK 2.8, CodeXL 1.0 and Bolt

This is old news now that AMD have released APP SDK 2.8, CodeXL 1.0 and Bolt. Bolt is a C++ abstraction of OpenCL which allows you to write OpenCL applications without actually writing OpenCL. I personally haven’t tried it as we are not going to be using it at work but it sounds a goodContinue Reading

OpenCL Cookbook: Multi-device utilisation strategies

A quick note on all the different ways in which one can utilise multiple devices in OpenCL. This overlaps with my previous post on the same subject in the series but is a higher level overview than that previous post. Here are the different ways one can load balance across multiple devices. Use CPU andContinue Reading

Project Rogue: Conception and specification

Introduction Project Rogue was conceived out of necessity in September 2012. Constituent components were researched in October 2012 and then subsequently ordered end of October 2012. A week later the project was complete in the sense that it functioned as a whole. It was alive and breathing. One month later, in December 2012, Project RogueContinue Reading