Compiling Models Within Continuity

Description

  • This will show how to setup the computer environment to be able to compile models within Continuity.
  • In order to compile models within Continuity the computer needs to have certain tools already installed. The tools required include a C compiler along with the necessary build tools that actually turn the source code into a compiled binary.
  • Once Continuity is properly configured to compile models, Continuity will now (as of release 8090) automatically compile your models if they have not been previously compiled when running a simulation.
  • Upon a successful compilation, Continuity will place the models at $HOME/.continuity/dynamicBinaries (for Linux/Mac) and at /Users/<username>/.continuity/dynamicBinaries (for Windows 7). The name of the binaries are hexstrings based on the generated source code.

  • The steps that Continuity takes prior to importing a binary are:
    • Generate the necessary C/C++/Cuda code.
    • Generate the hexstring based on the generated code.
    • Search in the proper location for a binary with the hexstring in the name.
    • If the binary is not found, Continuity will then compile the model.
    • Lastly, Continuity will import the model (either just compiled or previously compiled) and execution will continue.
  • If there is an error during compilation, the error message will appear in the server window. The full compilation error log can be found at Linux/Mac: $HOME/.instant/error and for Windows 7:/Users/<username>/.instant/

Windows XP and 7

For Continuity release 7087 and above

  • All of the required tools are installed when Continuity is installed, so no separate plug-in installation is required to compile and run problems on the CPU. However, should the user wish to run problems on the GPU, they will need to install the Nvidia Cuda Compiler (nvcc) and additional tools separately.

For Continuity release 6734

  • There is an automated installer that will install all the required tools a user needs to compile models within Continuity to run on the CPU. The user just needs to download and run the installer and after the installer completes, the user would then be able to compile models within Continuity.
  • The user will need to accept some license agreements during installation, but no further interaction is required as the installer will install everything into their proper locations and will finish the installation process by setting up your environment to be able to compile a model within Continuity.
  • The installer can be found here: Continuity Plugin Page

  • For the more advanced user, it might be useful to know that the installer installs MSYS and MinGW, which are essentially a subset of standard UNIX tools. If the user runs ‘MSYS’ that will open up a UNIX console on their Windows computer. An important thing to note is that in the users home directory in the MSYS environment is a file named: ‘.profile’ which contains all the important environmental variables and their settings which allow Continuity to compile models. While that .profile file should not need to be changed by default, it could be extended to include other things if necessary.

Mac OS X

Installing Required Software

  • There is currently no automated installer for the Mac operating system to install the extra tools needed, and the user will have to install the required tools themselves.
  • There are three tools that are needed to run Continuity and compile models within Continuity: X11 and gcc and the autotools suite. For the most recent Macs X11 is now called XQuartz and is available at (XQuartz). Continuity 7926 and above are fully compatible with XQuartz.

  • For gcc and the autotools suite, if you don’t already have them you can install them from a Terminal window (/Applications/Utilities/Terminal.app) by typing xcode-select –install.
  • The last build tool that you’ll need is autoconf and that can be obtained by downloading/extracting and running install_autoconf.app.zip.

  • Prior to Lion, you should be able to install Xcode from the installation disk if you still have it, as shown below.
  • For OSX Catalina and above, standard headers are no longer included, and you will need to install GNU gcc and alias ‘gcc’ to point to GNU gcc. To install GNU gcc, use homebrew. Instructions on aliasing gcc can be found here.

Setting Up Build Environment

  • As of Continuity version 7470, Continuity will attempt to set up the build environment for you. However, if you do not have Xcode/compiler tools installed the setup will fail and you will need to follow the instructions below after installing Xcode/compiler tools.
  • The following script will attempt to set up the build environment automatically. The script will just need to be told the location of your Continuity installation. Should there be issues running the script, the manual steps are provided for completeness.
    setup_continuity_env.app.zip

  • The manual steps for setting up Continuity’s environment are:
    1. Open the Terminal application (found at Applications/Utilities)
    2. Go to the directory where Continuity is installed, which by default is /Applications/continuity
        cd /Applications/continuity
      

       

    3. Run the following 4 commands
        sh setup
        source mglinit
        autoconf
        ./configure
      

       

    4. Continuity now is setup to compile models.