From NA-Wiki

Revision as of 15:43, 11 July 2007 by Stockli (Talk | contribs)
Jump to: navigation, search


DOLFIN Related Material

Some information regarding the DOLFIN package of the FeniCS project.


To be able to use DOLFIN at CSC, just add the modules na-hacks and fenics by typing
>> module add na-hacks fenics

To compile and run programs, you must be using a Linux based system, i.e., NOT SOLARIS. The easiest and fastest way to compile and run programs is to use one of the following three servers carleman, fredholm, beurling.

Using Local and CSC based DOLFIN packages

Developing for DOLFIN at CSC means that you have to somehow separate two distinct DOLFIN packages. One DOLFIN package is the one which sits inside your home/<user>/ directory somewhere which is the DOLFIN that you work on and make changes to. Another DOLFIN package is inside the CSC file system and is the package you get access to by following the above steps in DOLFIN at CSC. Since we are given access to most of the FeniCS packages through CSC's file system, we only need local copies of DOLFIN and FFC.

Throughout the entire process which follows, it is advised that you should use a Linux based installation to carry out your work. In this how to, we will use one of the three linux servers available carleman, fredholm, buerling.

Installation of the Local DOLFIN and FFC packages

  1. Log on to one of the servers. As an example, we will use carleman as our server.
    >> ssh carleman.nada.kth.se
    If you are already somehow connected to the NADA network, you can save yourself a few key strokes by leaving out the .nada.kth.se.
  2. Type
    >> module add na-hacks fenics
    This should give you access to Mercurial which is used to fetch the latest snapshots of the KTH distributions.
  3. Now we want to fetch both DOLFIN and FFC in to our local directory. Make sure that you are now in a directory that suits you for saving DOLFIN and FFC source files, e.g. ~/SourceFiles/FeniCS and type the following
    >> hg clone http://www.nada.kth.se/cgi-bin/jjan/hgwebdir.cgi/dolfin-kth
    ...wait a bit, and then type
    >> hg clone http://www.nada.kth.se/cgi-bin/jjan/hgwebdir.cgi/ffc-kth
    We should now have two additional directories dolfin-kth, ffc-kth
  4. When we now install DOLFIN and FFC, we must tell the installer/compiler that the resulting files should be saved locally. We do this by first creating another directory where we choose to keep all the locally stored binary files generated by the compiler. As an example, we could generate the directory ~/Library by typing
    >> mkdir ~/Library
    Then go to your ffc-kth directory and type
    >> python setup.py install --prefix=$HOME/Library
  5. Next we do the same for dolfin-kth. Go to your dolfin-kth directory and type
    ./configure --prefix=$HOME/Library --with-boost=/afs/nada.kth.se/dept/na/hacks/pkg/boost/1.33.1/ --enable-petsc --with-petsc-dir=/afs/nada.kth.se/dept/na/hacks/pkg/petsc/2.3.2/@sys --disable-pydolfin
    Note that we have disabled PyDOLFIN, feel free to enable it if you need to use it.
  6. All we have to do now is to compile the source files. While still in your dolfin-kth directory, type
    >> make && make modules && make install && modules_install && make demo
    If all went well, you should now have a local copy of DOLFIN and FFC. The next section will tell you how to identify which installation you would like to use.

Identifying which (Local or CSC) DOLFIN installation to use

What tells the system which libraries and executables to use is governed by a set of environment variables. When we wish to compile a main.cpp file using the DOLFIN library, which DOLFIN installation will be used? The CSC installation, since this is the installation that the system is told to use by the environment variables. To change this, we have to create/edit an environment file which tells the system to use our local copy of DOLFIN.

To do this, go to your home directory and type
>> emacs .environment
Insert the following text at the end:
if ( $?PATH ) then
setenv PATH ""

if ( $?PYTHONPATH ) then
setenv PYTHONPATH ""
if ( $?LD_LIBRARY_PATH ) then
if ( $?PKG_CONFIG_PATH ) then

setenv PATH "$HOME/Library/bin:$PATH"
setenv PYTHONPATH "$HOME/Library/lib/python2.3/site-packages:$PYTHONPATH"
setenv PKG_CONFIG_PATH "$HOME/Library/lib/pkgconfig:$PKG_CONFIG_PATH"

When you want to use your local copy of DOLFIN, type

>> source ~/.environment

DOLFIN Automated Installer for Debian based Linux distributions

The target audience of this script is people who wish to install DOLFIN on their home computers. If you would like to use DOLFIN at CSC, please consult the DOLFIN at CSC guide above. Note also that this is the KTH distribution of DOLFIN.

The installation of the DOLFIN C++ library can be somewhat cumbersome if one is not familiar with the Linux environment. There are many dependencies that have to be satisfied in order to be able to successfully use DOLFIN to create efficient programs. An automated installer was thus created with the single task of removing the job of satisfying dependencies from the user. This automated installer has been tested on Ubuntu Feisty Fawn and Dapper Drake. What follows is a step-by-step guide to using the installer script.

You are encouraged to inspect the script. Understanding the script will ultimately allow you to create a script which is more targeted at your specific needs. Right now, PyDOLFIN is disabled in the script and DOLFIN uses PETSc as the algebraic back-end.

  1. First, decide where you would like to store all the files associated with DOLFIN. I usually have the following folder structure /home/<user>/SourceFiles/FeniCS. Now, inside the FeniCS folder, place the file installer.sh, the installer script.
  2. Make the script executable
    >> chmod +x installer.sh 
  3. Finally, just execute the script.
    >> ./installer.sh
    If a download fails or something goes wrong, the best thing to do is to delete all the generated directories and start fresh.
  4. You may also need to add the following (if the demos do not work) to your ~/.bashrc file:
     export PATH=$PATH:/usr/local/lib 

And that is all. You should now have a working DOLFIN installation. --Stockli 17:38, 11 July 2007 (CEST)

Personal tools