How to use the PaStiX solver in Kratos

From KratosWiki
(Difference between revisions)
Jump to: navigation, search
(How to use the PaStiX solver in Kratos)
(Compile the Scotch library)
Line 26: Line 26:
  
 
  cp ./Make.inc/Makefile.inc.x86-64_linux2 Makefile.inc
 
  cp ./Make.inc/Makefile.inc.x86-64_linux2 Makefile.inc
 +
 +
Additionally libraries are necessary, which can be installed by:
 +
 +
sudo apt-get install flex bison zlib1g-dev
 +
  
  

Revision as of 09:10, 3 January 2017

Contents

How to use the PaStiX solver in Kratos

The PaStiX (Parallel Sparse matriX package) is a open-source scientific library that provides a high performance parallel solver for very large sparse linear systems based on direct methods. Numerical algorithms are implemented in single or double precision (real or complex) using LLt, LDLt and LU with static pivoting (for non symmetric matrices having a symmetric pattern). This solver provides also an adaptive blockwise iLU(k) factorization that can be used as a parallel preconditioner using approximated supernodes to build a coarser block structure of the incomplete factors ([1]).

It can be linked to the Kratos by the ExternalSolversApplication. The following steps have to be made in order to use be able to use it in Ubuntu version 14.04 LTS 64 bit or 16.04 LTS 64 bit.

Compile the Scotch library

PaStiX needs the Scotch library as a prerequisite to work.

You can download version 6.0.4 here:

http://gforge.inria.fr/projects/scotch/

Copy it to a folder of your choice. In the following we are using "~/compiled_libraries" as a reference.

Extract the files by the command:

tar -xf scotch_6.0.4.tar.gz

Navigate into the source directory by:

cd scotch_6.0.4/src

Copy the correct MakeFile.inc for the version of your system to the source directory. Ín the case of the Ubuntu versions mentioned above it is the Makefile.inc.x86-64_linux2:

cp ./Make.inc/Makefile.inc.x86-64_linux2 Makefile.inc

Additionally libraries are necessary, which can be installed by:

sudo apt-get install flex bison zlib1g-dev






Add the following line in the file CMakeLists.txt of your application:

 set_target_properties(KratosFooApplication PROPERTIES COMPILE_DEFINITIONS "FOO_APPLICATION=EXPORT,API")

Export your variables

In order to make your variables visible, you will need to change its declaration with the define name from the step 1. We provide a couple of replacements for do that:

KRATOS_DEFINE_VARIABLE
KRATOS_DEFINE_3D_VARIABLE_WITH_COMPONENTS

will become:

KRATOS_DEFINE_APPLICATION_VARIABLE
KRATOS_DEFINE_3D_APPLICATION_VARIABLE_WITH_COMPONENTS

For example:

KRATOS_DEFINE_VARIABLE(int, VAR_1)

will become

KRATOS_DEFINE_APPLICATION_VARIABLE(FOO_APPLICATION, int, VAR_1)

Export your classes

Finally you will also need to indicate which classes are available to be used from other applications. In order to do it you will need to use the KRATOS_API() macro with the define name of your applications in the declaration of the class.

For example

 class myclass() {
 }

will become:

 class KRATOS_API(FOO_APPLICATION) myclass() {
 }

If your class depends on a template parameter, you will also need to instantiate such class, as no code exists in compile time and otherwise will be impossible to export:


For instance, if you want to use class myclass with double:

 temaplte<class T>
 class myclass() {
    ...
 };

becomes

 temaplte<class T>
 class KRATOS_API(FOO_APPLICATION) myclass() {
    ...
 };
 
 ...
 
 template class KRATOS_API(FOO_APPLICATION) myclass<double>;
Personal tools
Categories