Flow engines on ubuntu 12.04

From Yade

Download Yade

You can install either a release (numbered version, which is frozen) or the current developement version (updated by the developers frequently).

Release version

Releases can be downloaded from the download page[1], as compressed archive. Uncompressing the archive gives you a directory with the sources.

Once you downloaded the sources, you have to install dependencies following the instructions from here: https://yade-dem.org/doc/installation.html#prerequisities

Current development version

Developement version (trunk) can be obtained from the code repository at github. Follow instructions from here to download: https://www.yade-dem.org/wiki/Yade_on_github#Setup

Once you downloaded the sources, you have to install dependencies following the instructions from here: https://yade-dem.org/doc/installation.html#prerequisities

Flow Engine

To add the flow engine and perform coupled fluid-particle simulations, follow the instructions below. Basically there are just a number of dependencies that need to be satisfied.

Openblas

Openblas is a packaged version of Kazushige Goto's gotoblas, which is recommended by most matrix library developpers. It is available precompiled in 12.04 but it breaks python's matplotlib because it provides a different version of lapack, which is a dependency of matplotlib.

Download and compilation

You should download the sources at github: https://github.com/xianyi/OpenBLAS/zipball/master

Prerequisites:

  • gfortran - type on a terminal "sudo apt-get install gfortran"

Optional:

  • pthread - type on a terminal "sudo apt-get install libpthread-stubs0-dev"

Open a terminal and place you into the folder where the openblas sources have been downloaded. Unpack the compressed file. To compile, do this:

  • type "make FC=gfortran" so as to use the right compiler;
  • type "sudo make install", to install the library.

Make a symlink to /path/to/libopenblas.so.0 in the standard path so that yade will find it at startup:

  • sudo ln -s /path/to/libopenblas.so.0 /usr/lib/libopenblas.so.0

Note for ubuntu 10.04 users: it may be easier on 10.04 to compile the ancestor of openblas: gotoblas

Taucs

TAUCS is a C library of sparse linear solvers. You have two options:

  • Download taucs sources already configured for 12.04 + openblas here
  • Download taucs sources from the CGAL project

In this case you'll have to configure the build by editing /config/linux.mk (you need at least to set the path to openblas, or to other libs you may want to use).

Prerequisities and Compilation

As a prerequisite, you have to install ParMETIS (Parallel Graph Partitioning and Fill-reducing Matrix Ordering). To do this open a terminal and type:

  • sudo apt-get install libparmetis-dev

You can also download and compile your own metis-4.0.1 (it doesn't really matter both ways should work)

To compile, open a terminal and place you into the folder where the taucs sources have been downloaded. To compile, do this:

  • type "make"
  • type "sudo make install", to install the library (this step may give harmless error messages even if it actually compiled (it failed at post-built test stages), ignore them and just check that /src/taucs.h and /lib/linux/libtaucs.a are present).

Compiling taucs may give harmless error messages even if it actually compiled (it failed at post-built test stages), ignore them and just check that /src/taucs.h and /lib/linux/libtaucs.a are present.

3. configure the compilation of yade/lib/triangulation

It should be possible to do it all in the scons.profile, but for the moment I just modified /trunk/lib/sconscript like this:

# vim: set filetype=python :
env.Install('$LIBDIR/lib',env.SharedLibrary('yade-support',[
   env.Combine('yade-support.cpp',['base/Math.cpp']+
       ['factory/ClassFactory.cpp','factory/DynLibManager.cpp','multimethods/Indexable.cpp','serialization/Serializable.cpp','pyutil/gil.cpp']
       # compile TesselationWrapper only if cgal is enabled in features
       +(Split('triangulation/KinematicLocalisationAnalyser.cpp triangulation/Timer.cpp triangulation/basicVTKwritter.cpp
triangulation/FlowBoundingSphere.cpp triangulation/PeriodicFlow.cpp triangulation/Tenseur3.cpp triangulation/TriaxialState.cpp')
if 'cgal' in env['features'] else [])
       +(['opengl/GLUtils.cpp'] if 'opengl' in env['features'] else [])
       ),
        ],LIBS=['dl','m']+(['taucs','metis','openblas','gomp','gfortran'] if 'cgal' in env['features'] else [])
+[l for l in env['LIBS'] if l!='yade-support']+(['glut','GL','GLU'] if 'opengl' in env['features'] else []),
LINKFLAGS=env['LINKFLAGS']+['-L/path/to/taucs_full/lib/linux','-L/path/to/metis-4.0 (if compiled) ',
'-L/path/to/lib/openblas/lib/','-pthread','-Wl','-Bsymbolic-function','-ansi'],CXXFLAGS=env['CXXFLAGS']+['-fPIC','-frounding-math','-ansi']
))

5. Compile Yade with linsolv enabled

As usual, get the "linsolv" version of flow engines and compile yade with cgal enabled, and -DFLOW_ENGINE, -DLINSOLV in Yade's compile flags.