archives

techniques for JIT (parallel?) compilation of straight line numerical code

Reading A Methodology for Generating Verified Combinatorial Circuits, which involved some code generation/staging and AST optimization, I found myself wondering if there are libraries for just-in-time compilation (and then dynamic loading/linking) of simple numerical code. C seems like a decent language as a generation target (in that it's fairly assembly-like, and in its later (C99?) incarnations has fairly portable support for low level types like (and operations for) e.g. 80-bit floating point values.

Further, although I'm tempted to write everything in one language (currently C++) since it has made interoperability trivial, there must be some reasonable argument that the overhead of launching an optimizing C compiler surely gives you the leeway to say, invoke Meta-Ocaml routines that do the code-generation magic (never having embedded another language in a C++ program or called wrapped C++ in another language, I'm not sure how expensive or hard this is).

Anyone have some good references (to theory or practical implementations) or advice? Even the basic technique necessary to say, compile and dynamically load/link C code into another language (while probably somewhat platform specific) is foreign to me :)

I'm not at all committed to C as the code generation target; I just want something that compiles and optimizes loopless straight-line numerical computation well, and bonus points if it can split up the computation so that it runs in a distributed parallel fashion (N cpus per node, local memory on each node, relatively expensive network communication). It would also be great if code could be reordered to take advantage of cache locality and processor parallel-numeric abilities as well (of course this should be handled by the compiler and not addressed directly by the person generating the numerical code?). I have no idea which compilers (Intel's C compiler might be good) can do such analyses and how to encourage them to do so; by default I use gcc, which I understand is somewhat basic.

My intended application is repeated Estimation-Maximization (EM) parameter optimization; the computation for accumulating counts for each parameter as a function of the previous iteration's count can be compiled and made branchless, optimized (sharing common subexpressions, etc.), and then run a few hundred times. Thus I want to compile and load compiled code on the fly (the generated code of course depends on the input automata I'm estimating parameters for). For historical reasons, my work so far has been entirely C++, but obviously, switching to code generation/compilation would allow me to use any language as the driver as long as it can access the results of the compiled code without expensive marshalling or interprocess communication.

(apologies if this is more a compilers/tools than a language question)

Cookie expiration

Have the settings for cookie expiration changed after the last code update? AFAICS it's now set for end of session expiration and I have to login again every time I open the browser, which is mildly annoying.

Three interesting discussions

Since we are having a slow week, I thought it might be a good idea to mention three interesting threads from the discussion group. Most regulars read the discussion group, but not everyone is aware of it, and we are still working on an RSS feed for new discussion group messages. So, in case you missed them, you might want to check out,

  1. Understanding continuations.
  2. Explaining monads.
  3. Why type systems are interesting (this is a long thread, so consider starting a new one if you want to move the discussion in a new direction).

Introduction to MDX Scripting in Microsoft SQL Server 2005 Beta 2

This document describes how Multidimensional Expressions (MDX) for Microsoft SQL Server 2005 Beta 2 can be applied to common business problems.

Given the interest in database integration exhibited in the past, I guess this may be of interest to some readers.

MDX is the server-based calculation engine provided by SQL Server's Analysis Services. MDX scripts appear to execute like programs, however the MDX script does not really "run." It is a declared set of commands that are always in effect. The contents of the cube are always consistent with the script. The scripting language is explained along with examples.

You might call it declarative programming...