Installing Cvode

Cvode is still an optional dependency, but extremely recommended for anyone wanting to perform simulations based on solving ODEs.

These instructions are mostly redundant if you are using the UbuntuPackage, as this will install Cvode for you, but read on for some optional optimisation by compiling it yourself.

NB: PETSc 3.2 onwards can be configured with the flag --download-sundials which will download, compile and install CVODE for you, in which case these instructions can be ignored.

For simulations with intensive ODE solving, it can make sense to compile CVODE with highly optimised settings. We've found a roughly 20% speedup for cardiac action potential models using the intel compiler with the settings below, rather than optimised gcc (which seems to be the one shipped with Ubuntu - see #2479 for detailed timings). The PETSc-install route will probably use intel for cvode, if you use intel for PETSc (I haven't checked!).

Newer instructions (using cmake)

Download the source code from https://computation.llnl.gov/casc/sundials/download/download.html (at time of writing, the latest version was cvode-2.7.0). A registration form will probably need to be filled in.

  • Download latest CVODE, extract tarball somewhere.
    tar -zxf cvode-2.7.0.tar.gz
    cd cvode-2.7.0
    
  • There's a bug that makes it think it is part of Sundials 2.4 instead of 2.5, so change lines 31 & 33 of CMakeLists.txt to read 2.5.0 instead of 2.4.0.
  • Make a new 'build' folder somewhere outside cvode source.
    mkdir ~/cvode_build_dir
    # Go to the new 'build' folder 
    cd ~/cvode_build_dir
    # and type the following to do a graphical cmake configuration
    ccmake ../<path to cvode-2.7.0 source folder>
    
  • Change the following settings (press 'c' a few times and eventually 'g'):
    BUILD_SHARED_LIBS ON
    CMAKE_BUILD_TYPE Release
    CMAKE_INSTALL_PREFIX <wherever you want the includes and libraries to end up - e.g. $CHASTE_LIBS>
    
  • exit the configuration tool, then type
    make
    make install
    
  • New: cmake, configure cmake to recognise the CVODE libraries ChasteGuides/CmakeBuildGuide#ConfigureStep
  • Old: scons, adjust your scons hostconfig to pick up the new cvode includes and libraries, see SconsArchive/HostconfigSystem.
  • If running an executable, make sure the new libraries are included at the start of LD_LIBRARY_PATH.

Highly optimised build

If you have the intel installer present (see if typing icc is recognised), then at the configure step it is worth changing these settings too (in addition to the ones above)

CMAKE_C_COMPILER icc
CMAKE_C_FLAGS_RELEASE -O3 -ip -ipo1 -DNDEBUG

Older instructions (using autotools)

These instructions are for Cvode 2.5.0 using the attached files.

If you will be running memory testing, and if dealing with a standard CVODE source, you'll need to use the attached patch to avoid memory test failures.

Unpack, configure, build, and install:

tar -zxf cvode-2.5.0.tar.gz
cd cvode-2.5.0
patch -p0 < ../cvode.patch
./configure --prefix=$HOME/cvode --with-cflags=-O3 --with-fflags=-O3 --disable-mpi
make
make install