Git Product home page Git Product logo

adcomp's Introduction

Template Model Builder (TMB)

Build Status

TMB is an R package with functionality similar to ADMB. It requires R at least version 3.0.0 and development tools needed to install R packages from source. Standard install instructions are available here.

Install the development version (Linux)

It is recommended to install TMB into your local R package library (if you do not yet have a local R package library, create one by running install.packages("") from the R prompt and follow the instructions). The package is installed from the command line by entering the adcomp folder and typing

make install

To build the user manual type

make pdf

Once the package is successfully installed it can be tested by starting R and running

library(TMB)
runExample(all=TRUE)

To build API-Function reference see instructions here. Once the documentation is built open dox/html/index.html in your web browser. Use the search field to find functions and their documentation.

It is recommended to test that models can be changed, re-compiled and re-loaded without problems:

setwd("tmb_syntax")
source("test_reload.R")

If everything works as intended this script should display "TRUE". The script has only been observed to fail for certain combinations of Linux and the gcc compiler, see below.

Advanced notes

Metis orderings

For large 3D random field models the ordering algorithms shipping with R's Matrix package are far from optimal. To get better orderings available run the extended TMB install script (Linux/Mac only):

make install-metis-full

The new orderings are available from R through the function runSymbolicAnalysis(). For a quick example of how to use it try the ar1_4D example:

cd tmb_examples
make ar1_4D

You should see a significant speedup.

Issues with library unloading

On recent versions of gcc the following problem may be encountered: When the user cpp file is changed, re-compiled and re-loaded, the changes do not take place. To see if you are affected by this issue, assuming your compiled DLL is called "mymodel.so", try running:

readelf -s mymodel.so | grep UNIQUE

If this gives any output it is not possible to unload the library, and R will have to be restarted every time the model is re-compiled. There are at least two alternative solutions to this problem:

  1. Use gcc with compilation flag -fno-gnu-unique (version 4.8.3 and newer): Add CXX = g++ -fno-gnu-unique to a file ~/.R/Makevars (create it if it doesn't exist).

  2. Use the clang compiler instead of gcc: Install clang and add CXX = clang++ to a file ~/.R/Makevars (create it if it doesn't exist).

Note: If you have precompiled TMB using precompile() prior to (1) or (2) you must repeat the precompilation with the new compiler settings.

adcomp's People

Contributors

kaskr avatar skaug avatar casperwberg avatar mebrooks avatar colemonnahan avatar bbolker avatar alko989 avatar jgbabyn avatar fishfollower avatar aforren1 avatar bradbell avatar calbertsen avatar johnrsibert avatar mmaechler avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.