Vensim Compiled Simulation on the Mac

Speed freaks on Windows have long had access to 2 to 5x speed improvements from compiled simulations. Now that’s available on the Mac in the latest Vensim release.

Here’s how to do it, in three easy steps:

  • Get a Mac.
  • Get the gcc compiler. The only way I know to get this is to sign up as an Apple Developer (free) and download Xcode (I grabbed 3.2.2, which is much smaller than the 3.2.6+iOS SDK, but version shouldn’t matter much). There may be other ways, but this was easy.
  • Get Vensim DSS. After you install (checking the Install external function and compiled simulation support to: box), launch the program and go to Vensim DSS>Preferences…>Startup and set the Compiled simulation path to /Users/Shared/Vensim/comp. Now move to the advanced tab and set the compilation options to Query or Compile (you may want to skip this for normal Simulation, and just do it for Optimization and Sensitivity, where speed really counts).

OK, so I cheated a little on the step count, but it really is pretty easy. It’s worth it, too: I can run World3 1000 times in about 8 seconds interpreted; compiled gets that down to about 2.

Update: It turns out that an installer bug prevents 5.10d on the Mac from installing a needed file; you can get it here.

3 thoughts on “Vensim Compiled Simulation on the Mac”

  1. Cool! I love the expanding Mac support.

    Btw, another way (easier) to get XCode is the Mac App Store on 10.6.7. Apple released XCode 4 for $5 on the app store. I think they changed their policy and the latest version of XCode isn’t available for free developer accounts, which is why you could only download 3.2.x.

  2. Thanks for the tip. Maybe the $5 covers the bandwidth for the giant download of the newer versions.

    I also should have mentioned that it’s possible to write external functions for the Mac now – there’s an example extern.mdl in the comp folder that illustrates use. I haven’t looked at the code yet, but will write something up when I do.

  3. One more quick note.

    As of Feb 2017, the latest version of Xcode (8.2.1) fails to compile models (it compiles, but immediately throws a floating point error).

    The only solution at the moment is to revert to Xcode version 7.3.

    Tony.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.