Skip to content
akshmakov edited this page Jun 7, 2014 · 25 revisions

Formatting

Table of Contents

Freesurfer

FREESURFER

Simplified Installation Instructions

Much progress has been made to make Fijee easily distributed and compiled on other system, here we describe the simplified process for installing Fijee dependencies and building Fijee on your system

Installing Dependencies

Dependencies for Building FIJEE are now packaged into Debian Packages for simplified distribution. These packages are available in a Personal Package Archive. Ubuntu users can use a ppa by invoking the command sudo add-apt-repository ppa:akshmakov/fijee-dev-ppa , because PPA packages are simply debian packages targeted for ubuntu releases debian users can also use them by following these instructions . After adding the ppa sudo apt-get update must be done to fetch the new packages

Users on other systems can either use their own packaging system or install dependencies from Source. With the CMAKE build system, dependencies can be installed from source and still be configured properly to build Fijee. All the dependencies used for Fijee either provide a UseLIBRARY.cmake or have a cmake maintained FindLIBRARY.cmake script. In order to use libraries installed in non-standard locations (cmake scripts look in a handful of standard system locations to find these scripts), it is necessary to indicate where these scripts are located.

Dependencies are listed in the following sections, to install them sudo apt-get install libeigen3-dev libcgal-dev libvtk5-dev dolfin-dev libviennacl-dev python-vtk libnifti-dev libtrilinos-dev

OpenCL

Fijee uses Dolfin with a ViennaCL backend for parallelizing matrix tasks. ViennaCL is a header only Linear Algebra library that can use OpenCL, CUDA, or OpenMP as its backend. Fijee development is currently targeted at OpenCL, but in principle it should be able to run on any backend, provided that Dolfin and other dependencies are built against the same libraries.

OpenCL is an Open Source parallel computing platform. OpenCL consists of three components. The OpenCL Headers which define the interface; The OpenCL loader library (OpenCL.so) which is a compiled library that interfaces with the hardware; The OpenCL compute kernels, which are vender provided "drivers" for running OpenCL on various Hardware.

The packaged Fijee dependencies are built against the Khronos OpenCL headers and against the open source loader library ocl-icd. Various vendors (AMD / Intel / NVIDIA) provide their own loader library (implementation of OpenCL.so), as well as the necessary kernel files (.icd) and internal libraries for running OpenCL on their hardware. In order to run Fijee on opencl hardware, it is necessary to install the opencl dependencies from the debian packages and to obtain .icd files and related libraries from the vendor. Please note, that vendor OpenCL implementations will typically provide their own OpenCL.so file and may attempt to overwrite the open source ocl-icd. While OpenCL kernels should be agnostic to the loader used, Fijee and Fijee dependencies require that OpenCL.so is the one that it was built against. On linux systems, the nvidia provided graphics driver should ship with the necessary kernel files to run OpenCL, for cpu systems and ATI video cards please refer to the vendor pages AMD , Intel for obtaining the necessary kernel files. It is recommended (on linux systems) to use the AMD openCL kernel even on Intel CPU's.

Building Fijee

Fijee can now be built using the cmake build system. If all dependencies are installed from the package archive then no additional configuration is neccessary. After cloning the repository:

$mkdir build

$cmake ../

$make

If Dependencies are installed in non-standard locations, it is necessary to indicate to cmake where to look for necessary configuration files by pointing to the prefix used to install the dependency from source, like in the following example:

$VTK_DIR=/usr/local NAMEOFLIBRARY_DIR=/path/to/install/prefix/ cmake ../

Afterwards, $make should work as needed.

Prerequisites - Third Party Libraries

FIJEE analysis FreeSurfer's outputs. FreeSurfer must be installed and must produce useful outputs for FIJEE. The main libraries that have to be installed before building FIJEE are:

  1. Computational Geometry Algorithms Library (CGAL)
    • install Eigen3 headers before installing CGAL: '$EIGEN3'
    • Set environment variable CGAL: '$CGAL'
  2. Visualization Toolkit (VTK)
    • Set environment variable VTK: '$VTK'
  3. Portable, Extensible Toolkit for Scientific Computation (PETSc)
    • Set environment variable PETSC_DIR: '$PETSC_DIR'
    • Set environment variable PETSC_ARCH: '$PETSC_ARCH'
  4. FEniCS
    • Set environment variable FENICS: '$FENICS'

Computational Geometry Algorithms Library (CGAL)

The goal of the CGAL - 4.3 Open Source Project is to provide easy access to efficient and reliable geometric algorithms in the form of a C++ library. CGAL is used in various areas needing geometric computation, such as: computer graphics, scientific visualization, computer aided design and modeling, geographic information systems, molecular biology, medical imaging, robotics and motion planning, mesh generation, numerical methods...

Eigen

Eigen is a C++ library of template headers for linear algebra, matrix and vector operations, numerical solvers and related algorithms. Eigen is an open source library licensed under MPL2 starting from version 3.1.1.

cd build_dir
cmake -DCMAKE_INSTALL_PREFIX=$EIGEN3/install $EIGEN3/sources
make install
make check
release
cmake  \
   -DCMAKE_BUILD_TYPE=Release   \
   -DCMAKE_INSTALL_PREFIX=$CGAL/install/  \  
   -DWITH_Eigen3:BOOL=ON   \
   -DEIGEN3_INCLUDE_DIR=$EIGEN3/install/include/eigen3/  \  
   -DWITH_MPFI=ON   \
   -DWITH_NTL=ON   \
   -DWITH_OpenGL=ON  \ 
   -DWITH_ZLIB=ON   \
 $CGAL/CGAL-4.3
debug
cmake \ 
 -DCMAKE_BUILD_TYPE=Debug  \ 
 -DCMAKE_INSTALL_PREFIX=$CGAL/install.debug/  \ 
 -DBUILD_SHARED_LIBS=true  \ 
 -DWITH_EIGEN3=ON  \ 
 -DEIGEN3_INCLUDE_DIR=$Eigen3/install/include/eigen3/ \ 
 -DWITH_MPFI=ON  \ 
 -DWITH_NTL=ON \ 
 -DWITH_OpenGL=ON \ 
 -DWITH_ZLIB=ON \ 
 \# -DWITH_VTK:BOOL=TRUE \ 
 -DVTK_DIR=$VTK/install/lib/vtk-5.10 \ 
$CGAL/source/ \ 

make -j4            
ctest install                                                                                                     


http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Installation/Chapter_main.html#thirdparty:Eigen 3.8 Essential Third Party Libraries -> libboost-thread and libboost-system -> Gmp and Mpfr

Visualization Toolkit (VTK)

The Visualization Toolkit VTK - 5.10.1 is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK consists of a C++ class library.

release
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$VTK/install.release/ \
-DBUILD_SHARED_LIBS=true \
$VTK/sources

make
ctest
make install
debug
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$VTK/install.debug/ \
-DBUILD_SHARED_LIBS=true \
$VTK/sources

make
ctest
make install

Neuroimaging Informatics Technology Initiative (nifti)

Niftilib is a set of i/o libraries for reading and writing files in the nifti-1 data format. nifti-1 is a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images.

cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$NIFTI/install/ \
-DBUILD_SHARED_LIBS=true \
$NIFTI/nifticlib-2.0.0

make
make test
make install

FEniCS

FEniCS Project

The FEniCS Project is a collaborative project for the development of innovative concepts and tools for automated scientific computing, with a particular focus on automated solution of differential equations by finite element methods. FEniCS offers the possibility of using several type of solver; mainly PETSc. FEniCS strongly depend on Third Party Libraries, and other optional, but handy, libraries.

Not optional

PETSc - Portable, Extensible Toolkit for Scientific Computation

PETSc, is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modelled by partial differential equations. It supports MPI, shared memory pthreads, and NVIDIA GPUs, as well as hybrid MPI-shared memory pthreads or MPI-GPU parallelism. We setted up the version 3.4.2. PETSc interfaces to the optional external software.

export PETSC_DIR=/$PETSC/petsc-3.4.2
export PETSC_ARCH=install-3.4.2.release.gpu
export PETSC_ARCH=install-3.4.2.release
export PETSC_ARCH=install-3.4.2.debug
GPU
./configure --with-cc=gcc --with-fc=gfortran --with-debugging=0 COPTFLAGS='-O3 -march=p4 -mtune=p4' FOPTFLAGS='-O3 -qarch=p4 -qtune=p4' --download-f-blas-lapack --download-mpich --with-cuda=1 --with-cusp=1 --with-cusp-dir=/usr/local/cuda/include/cusp --with-thrust=1 --download-txpetscgpu=1 --with-precision=double --with-clanguage=c --with-cuda-arch=sm_13

make PETSC_DIR=/home/cobigo/devel/C++/PETSc/petsc-3.4.2 PETSC_ARCH=install-3.4.0.release.gpu all
make PETSC_DIR=/home/cobigo/devel/C++/PETSc/petsc-3.4.2 PETSC_ARCH=install-3.4.0.release.gpu test
make all test
release
./configure --with-cc=gcc --with-fc=gfortran --with-debugging=0 COPTFLAGS='-O3 -march=p4 -mtune=p4' FOPTFLAGS='-O3 -qarch=p4 -qtune=p4' --download-f-blas-lapack --download-mpich --download-scalapack --download-mumps --download-superlu_dist --download-metis --download-parmetis --download-pastix=1 --download-ptscotch=1
make PETSC_DIR=/home/cobigo/devel/C++/PETSc/petsc-3.4.2 PETSC_ARCH=install-3.4.0.release all
make PETSC_DIR=/home/cobigo/devel/C++/PETSc/petsc-3.4.2 PETSC_ARCH=install-3.4.0.release test
make all test
debug (mode de compillation par défaut)
./configure --with-cc=gcc --with-fc=gfortran --download-f-blas-lapack --download-mpich --download-scalapack --download-mumps --download-superlu_dist --download-metis --download-parmetis --download-pastix=1 --download-ptscotch=1
make PETSC_DIR=/home/cobigo/devel/C++/PETSc/petsc-3.4.2 PETSC_ARCH=install-3.4.0.debug all
make PETSC_DIR=/home/cobigo/devel/C++/PETSc/petsc-3.4.2 PETSC_ARCH=install-3.4.0.debug test
make all test

Trilinos

The Trilinos Project is an effort to develop algorithms and enabling technologies within an object-oriented software framework for the solution of large-scale, complex multi-physics engineering and scientific problems. We setted up the version 11.4.1. Or

git clone https://software.sandia.gov/trilinos/repositories/publicTrilinos
export TRILINOS=/PATH/TO/TRILINOS/

mkdir build.release build.debug build.gpu install.release install.debug
release
cd build.release
cmake \
  -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON \
  -D Trilinos_ENABLE_TESTS:BOOL=OFF \
  -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \
  -D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
  -D CMAKE_BUILD_TYPE:STRING=RELEASE \
  -D CMAKE_INSTALL_PREFIX:PATH=$TRILINOS/install.release/ \
  -D Trilinos_ENABLE_COVERAGE_TESTING:BOOL=ON \
  -D Trilinos_ENABLE_CHECKED_STL:BOOL=ON \
  -D Trilinos_ENABLE_OpenMP:BOOL=ON \
  -D BUILD_SHARED_LIBS:BOOL=ON \
  -D TPL_ENABLE_BLAS:BOOL=ON \
  -D TPL_ENABLE_Boost:BOOL=ON \
  -D TPL_ENABLE_CUDA:BOOL=ON \
  -D TPL_ENABLE_CUSPARSE:BOOL=ON \
  -D TPL_ENABLE_Eigen:BOOL=ON \
  -D TPL_ENABLE_MPI:BOOL=ON \
  -D Eigen_INCLUDE_DIRS:PATH=$EIGEN3/install \
  -D TPL_ENABLE_LAPACK:BOOL=ON \
  -D LAPACK_LIBRARY_DIRS:PATH=/usr/lib64/ \
  ../../trilinos/ >& cmake.log &

$ make -j4 VERBOSE=1 && ctest -j4 && make -j4 install
debug
cd build.debug
cmake \
  -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON \
  -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \
  -D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
  -D CMAKE_BUILD_TYPE:STRING=DEBUG \
  -D CMAKE_INSTALL_PREFIX:PATH=$TRILINOS/install.debug/ \
  -D Trilinos_ENABLE_COVERAGE_TESTING:BOOL=OFF \
  -D Trilinos_ENABLE_CHECKED_STL:BOOL=ON \
  -D Trilinos_ENABLE_OpenMP:BOOL=ON \
  -D BUILD_SHARED_LIBS:BOOL=ON \
  -D TPL_ENABLE_BLAS:BOOL=ON \
  -D TPL_ENABLE_Boost:BOOL=ON \
  -D TPL_ENABLE_CUDA:BOOL=ON \
  -D TPL_ENABLE_CUSPARSE:BOOL=ON \
  -D TPL_ENABLE_Eigen:BOOL=ON \
  -D TPL_ENABLE_MPI:BOOL=ON \
  -D Eigen_INCLUDE_DIRS:PATH=$EIGEN3/install \
  -D TPL_ENABLE_LAPACK:BOOL=ON \
  -D LAPACK_LIBRARY_DIRS:PATH=/usr/lib64/ \
  ../../trilinos/ >& cmake.log &

$ make -j4 VERBOSE=1 && ctest -j4 && make -j4 install

ViennaCL dev version only

ViennaCL - 1.4.2 is a free open-source linear algebra library for computations on many-core architectures (GPUs, MIC) and multi-core CPUs. The library is written in C++ and supports CUDA, OpenCL, and OpenMP. In addition to core functionality and many other features including BLAS level 1-3 support and iterative solvers. We setted up the version 1.4.2.

Optional

  1. MUMPS
  2. UMFPACK
  3. METIS & parMETIS (MPI)
  4. MTL-4 Matrix Template Library
  5. SCOTCH & PT-SCOTCH
  6. PaStiX
  7. CUSP

Installation

All needed packages are available on Manual installation from source, or the development sources are available on the FEniCS's github

git clone https://github.com/FEniCS/ufl.git                                          
git clone https://github.com/FEniCS/ffc.git                                          
git clone https://github.com/FEniCS/instant.git                                      
git clone https://github.com/FEniCS/fiat.git                                         
git clone https://github.com/FEniCS/ferari.git                                       
git clone https://github.com/FEniCS/uflacs.git                                       

Python packages (FFC, FIAT, Instant, Ferari, UFLacs and UFL)

All those packages follow the same installation process:

python setup.py install --prefix=$FENICS/install.release/

UFC (Unified Form-assembly Code) is a unified framework for finite element assembly. More precisely, it defines a fixed interface for communicating low level routines (functions) for evaluating and assembling finite element variational forms. The UFC interface consists of a single header file ufc.h that specifies a C++ interface that must be implemented by code that complies with the UFC specification.

mkdir build-UFC.release
cd build-UFC.release

cmake \
   -D CMAKE_BUILD_TYPE:STRING=RELEASE \
   -D CMAKE_INSTALL_PREFIX:PATH=$FENICS/install.release \
   -D PYTHON_LIBRARY:FILEPATH=/usr/lib64/ \
   $FENICS/Dependencies/fenics-project-ufc/
make
make install

Dolfin

DOLFIN is the C++/Python interface of FEniCS, providing a consistent PSE (Problem Solving Environment) for ordinary and partial differential equations.

The FEniCS documentation is generated by Sphinx and uses reStructuredText (reST) as the markup language. Good starting points are reStructuredText primer and Sphinx Markup Constructs. easy_install -U Sphinx

git clone https://github.com/YannCobigo/dolfin.git
ln -s dolfin DOLFIN

mkdir build-DOLFIN.release build-DOLFIN.dev

make sure the following env variables are set:

export PYTHONPATH=$FENICS/install/lib64/python2.7/site-packages:$FENICS/install/lib/python2.7/site-packages
export PATH=$FENICS/install/bin:$PATH
export LD_LIBRARY_PATH=$FENICS/install/lib64:$FENICS/install/lib:$LD_LIBRARY_PATH

export BOOST_LIBRARYDIR=/usr/lib64/lib:/usr/lib64/openmpi/lib:/usr/lib64/mpich2/lib

cmake \
   -D CMAKE_BUILD_TYPE:STRING=RELEASE \
   -D CMAKE_CXX_FLAGS:STRING=-DVIENNACL_WITH_OPENMP \
   -D CMAKE_INSTALL_PREFIX:PATH=$FENICS/install \
   -D BUILD_SHARED_LIBS:BOOL=ON \
   -D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
   -D PYTHON_LIBRARY:FILEPATH=/usr/lib/ \
   -D DOLFIN_ENABLE_TESTING=true \
   -D DOLFIN_ENABLE_BENCHMARKS=true \
   -D DOLFIN_ENABLE_VTK:BOOL=OFF \
   -D DOLFIN_ENABLE_CGAL:BOOL=OFF \
   -D MPI_CXX_COMPILER:FILEPATH=/usr/bin/mpicxx.mpich2 \
   -D MPI_C_COMPILER:FILEPATH=/usr/bin/mpicc.mpich2 \
   -D MPI_Fortran_COMPILER:FILEPATH=/usr/bin/mpif90.mpich2 \
   -D EIGEN3_INCLUDE_DIR:PATH=$EIGEN3/install/include/eigen3/ \
   -D VIENNACL_DIR:FILEPATH=$VIENNACL/include/ \
   -D VIENNACL_INCLUDE_DIRS:FILEPATH=$VIENNACL/include/ \
   -D VIENNACL_LIBRARY_DIRS:FILEPATH=/usr/lib/ \
   $FENICS/Dependencies/DOLFIN/ >& cmake.log &

make -j4 VERBOSE=1
make install

Those options has to be considerate in function of the hardware targeted:

-D CMAKE_CXX_FLAGS:STRING= -fopenmp -D CMAKE_CXX_FLAGS:STRING=VIENNACL_WITH_OPENCL -D CMAKE_CXX_FLAGS:STRING=VIENNACL_WITH_OPENMP

Building Fijee

git clone https://github.com/YannCobigo/Fijee.git