Changeset 3223


Ignore:
Timestamp:
03/08/10 15:13:33 (15 years ago)
Author:
Eric.Larour
Message:

Introduced petsc 3 in coexistence with petsc2.

Location:
issm/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/configs/linux64/linux64.sh.petsc2

    r2065 r3223  
    11#!/bin/sh
    22
    3 ./configure --prefix=$ISSM_DIR --with-matlab-dir=$MATLAB_DIR --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install --with-metis-dir=$ISSM_DIR/externalpackages/metis/install --with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install --with-mpi-include=$ISSM_DIR/externalpackages/mpich2/install/include  --with-mpi-lib="-L$ISSM_DIR/externalpackages/mpich2/install/lib/ -lmpich" --with-petsc-arch=$ISSM_ARCH --with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install --with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/fblaslapack/$ISSM_ARCH --with-plapack-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/PLAPACKR32/$ISSM_ARCH --with-blacs-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/blacs-dev/$ISSM_ARCH --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/SCALAPACK/$ISSM_ARCH --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/MUMPS_4.6.3/$ISSM_ARCH --with-fortran-lib="-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/ -lgfortran" --with-graphics-lib=/usr/lib64/libX11.so --with-cxxoptflags="-march=opteron -O2"
     3./configure --prefix=$ISSM_DIR --with-matlab-dir=$MATLAB_DIR --with-triangle-dir=$ISSM_DIR/externalpackages/triangle/install --with-metis-dir=$ISSM_DIR/externalpackages/metis/install --with-petsc-dir=$ISSM_DIR/externalpackages/petsc/install --with-mpi-include=$ISSM_DIR/externalpackages/mpich2/install/include  --with-mpi-lib="-L$ISSM_DIR/externalpackages/mpich2/install/lib/ -lmpich" --with-petsc-arch=$ISSM_ARCH --with-dakota-dir=$ISSM_DIR/externalpackages/dakota/install --with-blas-lapack-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/fblaslapack/$ISSM_ARCH --with-plapack-lib="-L$ISSM_DIR/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/$ISSM_ARCH -lPLAPACK" --with-plapack-include="-I$ISSM_DIR/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/$ISSM_ARCH/INCLUDE" --with-blacs-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/blacs-dev/$ISSM_ARCH --with-scalapack-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/SCALAPACK/$ISSM_ARCH --with-mumps-dir=$ISSM_DIR/externalpackages/petsc/install/externalpackages/MUMPS_4.6.3/$ISSM_ARCH --with-fortran-lib="-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/ -lgfortran" --with-graphics-lib=/usr/lib64/libX11.so --with-cxxoptflags="-march=opteron -O2" --with-numthreads=32 --with-petsc-version=2
  • issm/trunk/m4/issm_options.m4

    r3131 r3223  
    286286                fi
    287287        fi
    288        
     288
     289        AC_ARG_WITH([petsc-version],
     290                          AS_HELP_STRING([--with-petsc-version = VERSION],
     291                                                         [petsc version -- 2 or 3]),
     292                          [PETSC_VERSION=$withval],[PETSC_VERSION=""])
     293
     294        if test "$PARALLEL_VALUE" = "yes" ; then
     295                if test "$PETSC_VERSION" = "" ; then
     296                        AC_MSG_ERROR([missing --with-petsc-version argument for parallel compilation!])
     297                fi
     298                if test "$PETSC_VERSION" = "2" ; then
     299                AC_DEFINE([_PETSC_VERSION_],[2],[ Petsc version number])
     300                fi
     301
     302                if test "$PETSC_VERSION" = "3" ; then
     303                AC_DEFINE([_PETSC_VERSION_],[3],[ Petsc version number])
     304                fi
     305        fi
     306       
     307               
    289308        AC_ARG_WITH([petsc-arch],
    290309                          AS_HELP_STRING([--with-petsc-arch = DIR],
     
    315334                        ;;
    316335                esac
    317                                                                  
     336       
    318337
    319338
     
    481500       
    482501        dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%plapack-beginning%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    483         AC_ARG_WITH([plapack-dir],
    484                           AS_HELP_STRING([--with-plapack-dir = DIR],
    485                                                          [plapack root directory]),
    486                           [PLAPACK_ROOT=$withval],[PLAPACK_ROOT=""])
    487                          
    488         AC_MSG_CHECKING(for Plapack headers and libraries in $PLAPACK_ROOT)
    489         if test -d "$PLAPACK_ROOT"; then
    490 
    491                 dnl defaults
    492                 HAVE_PLAPACK=yes
    493                 PLAPACKINCL=-I"$PLAPACK_ROOT/INCLUDE"
    494                 PLAPACKLIB=-L"$PLAPACK_ROOT/ -lPLAPACK"
    495 
    496                 AC_DEFINE([_HAVE_PLAPACK_],[1],[with Plapack in ISSM src])
    497                 AC_SUBST([PLAPACKINCL])
    498                 AC_SUBST([PLAPACKLIB])
     502        AC_ARG_WITH([plapack-lib],
     503                          AS_HELP_STRING([--with-plapack-lib = lib],
     504                                                         [plapack library]),
     505                          [PLAPACK_LIB=$withval],[PLAPACK_LIB=""])
     506        AC_MSG_CHECKING(for Plapack libraries)
     507       
     508        AC_ARG_WITH([plapack-include],
     509                          AS_HELP_STRING([--with-plapack-include = include],
     510                                                         [plapack include ]),
     511                          [PLAPACK_INCLUDE=$withval],[PLAPACK_INCLUDE=""])
     512        AC_MSG_CHECKING(for Plapack headers)
     513         
     514        if test -n "$PLAPACK_LIB"; then
     515                if test -n "$PLAPACK_INCLUDE"; then
     516               
     517                        dnl defaults
     518                        HAVE_PLAPACK=yes
     519                        PLAPACKINCL="$PLAPACK_INCLUDE"
     520                        PLAPACKLIB="$PLAPACK_LIB"
     521
     522                        AC_DEFINE([_HAVE_PLAPACK_],[1],[with Plapack in ISSM src])
     523                        AC_SUBST([PLAPACKINCL])
     524                        AC_SUBST([PLAPACKLIB])
     525                else
     526                        HAVE_PLAPACK=no
     527                fi
    499528        else
    500529                HAVE_PLAPACK=no
     
    521550                HAVE_MUMPS=yes
    522551                MUMPSINCL=-I"$MUMPS_ROOT/include"
    523                 dnl MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps  -lmumps_common -lpord -lparmetis"
     552                if test "$PETSC_VERSION" = "2" ; then
    524553                MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps  -lpord "
     554                else
     555                MUMPSLIB=-L"$MUMPS_ROOT/lib -ldmumps -lcmumps  -lmumps_common -lpord -lparmetis"
     556                fi
    525557
    526558                AC_DEFINE([_HAVE_MUMPS_],[1],[with Mumps in ISSM src])
  • issm/trunk/src/c/Reduceloadfromgtofx/Reduceloadfromgtofx.cpp

    r2063 r3223  
    22 * \brief reduce loads from g set to f set
    33 */
     4
     5#ifdef HAVE_CONFIG_H
     6        #include "config.h"
     7#else
     8#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
     9#endif
     10
    411
    512#include "./Reduceloadfromgtofx.h"
     
    3643               
    3744                        /*Create G_mn'*/
     45                        #if _PETSC_VERSION_ == 2
    3846                        MatTranspose(G_mn,&tG_mn); 
     47                        #else
     48                        MatTranspose(G_mn,MAT_INITIAL_MATRIX,&tG_mn); 
     49                        #endif
    3950
    4051                        /*Create G_mn' * pm*/
  • issm/trunk/src/c/Reducematrixfromgtofx/Reducematrixfromgton.cpp

    r2061 r3223  
    5050                       
    5151                        //K_nn = K_nn + G_mn' * K_mn;
     52                        #if _PETSC_VERSION_ == 2
    5253                        MatTranspose(Gmn,&tGmn);
     54                        #else
     55                        MatTranspose(Gmn,MAT_INITIAL_MATRIX,&tGmn);
     56                        #endif
    5357                        MatMatMult(tGmn,Kmn,MAT_INITIAL_MATRIX,PETSC_DEFAULT,&tGmnKmn);
    5458                        MatAXPY(Knn,a,tGmnKmn,DIFFERENT_NONZERO_PATTERN);
  • issm/trunk/src/c/Solverx/Solverx.cpp

    r2060 r3223  
    1919       
    2020        /*Solver*/
    21         KSP ksp=NULL;
     21        KSP ksp=NULL;
     22        PC  pc=NULL;
    2223        int iteration_number;
    2324        PetscTruth flag;
     
    3940        PetscOptionsDetermineSolverType(&solver_type,solver_string);
    4041
     42        #if _PETSC_VERSION_ == 2
    4143        if (solver_type==MUMPSPACKAGE_LU){
    4244                /*Convert Kff to MATTAIJMUMPS: */
     
    5961                MatConvert(Kff,MATSUPERLU_DIST,MAT_REUSE_MATRIX,&Kff);
    6062        }
    61 
     63        #endif
    6264
    6365        /*Prepare solver*/
     
    6567        KSPSetOperators(ksp,Kff,Kff,DIFFERENT_NONZERO_PATTERN);
    6668        KSPSetFromOptions(ksp);
     69
     70        #if _PETSC_VERSION_ == 3
     71        /*specific solver?: */
     72        KSPGetPC(ksp,&pc);
     73        if (solver_type==MUMPSPACKAGE_LU){
     74                PCFactorSetMatSolverPackage(pc,MAT_SOLVER_MUMPS);
     75        }
     76        #endif
     77
    6778
    6879        /*If initial guess for solution, use it, except if we are using the MUMPS direct solver, where any initial
  • issm/trunk/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp

    r2552 r3223  
    4545
    4646        /*The list of options is going to be pairs of the type "-option option_value"*/
     47        #if _PETSC_VERSION_ == 2
    4748        PetscToken *token=NULL;
     49        #else
     50        PetscToken token=NULL;
     51        #endif
    4852        char* first=NULL;
    4953        char* second=NULL;
  • issm/trunk/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp

    r2064 r3223  
    2525
    2626        /*The list of options is going to be pairs of the type "-option option_value"*/
    27         PetscToken *token=NULL;
     27        #if _PETSC_VERSION_ == 2
     28                PetscToken *token=NULL ;
     29        #else
     30                PetscToken token=NULL;
     31        #endif
    2832        char* first=NULL;
    2933        char* second=NULL;
Note: See TracChangeset for help on using the changeset viewer.