Flow engines on ubuntu 12.04

From Yade

1. download openblas and compile it

Openblas is a packaged version of 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.

Therefore, you should download the sources at github: https://github.com/xianyi/OpenBLAS/zipball/master

prerequisites:

  • gfortran

Compile somewhere in your home dir (be sure to have gfortran installed and type make FC=gfortran so as to use the right compiler) and keep the /path/to/libopenblas.so.0 in mind for the next steps.

Make a symlink to /path/to/openblas.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

2. Compile taucs

Download taucs sources from the CGAL project or, simpler, download the version that I already configured for 12.04 + openblas here)

If you want to change the build config, see /config/linux.mk (for instance to set the path to openblas).

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.

make
make install

prerequisites:

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.