← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/main] Rev 4878: Use nested parameters in PETScPreconditioner.

 

I had to compile PETSc with:

--download-hypre=1

to link against DOLFIN with this changeset. Otherwise I get this error:

mpic++ -o demo -Wl,-rpath,/home/oelgaard/local/lib/slepc-3.0.0-p7/linux-gnu-cxx-debug/lib
-Wl,-rpath,/home/oelgaard/local/lib/petsc-3.0.0-p12/linux-gnu-cxx-debug/lib
main.o -L/home/oelgaard/software/fenics/dolfin/local/lib
-L/usr/lib/atlas
-L/home/oelgaard/local/lib/slepc-3.0.0-p7/linux-gnu-cxx-debug/lib
-L/home/oelgaard/local/lib/petsc-3.0.0-p12/linux-gnu-cxx-debug/lib
-L/home/oelgaard/local/lib/scotch_5.1/lib -ldolfin
-lboost_program_options -lboost_filesystem -lxml2 -larmadillo -lCGAL
-ltrilinos_ml -ltrilinos_ifpack -ltrilinos_amesos -ltrilinos_aztecoo
-ltrilinos_teuchos -ltrilinos_epetra -ltrilinos_epetraext
-ltrilinos_galeri -lumfpack -lcholmod -lamd -lcamd -lcolamd -lccolamd
-lslepc -lz -lscotch -lscotcherr -lptscotch -lptscotcherr -llapack
-lblas -lpetscts -lpetscsnes -lpetscksp -lpetscdm -lpetscmat
-lpetscvec -lpetsc -lX11
/home/oelgaard/software/fenics/dolfin/local/lib/libdolfin.so:
undefined reference to `PCHYPREGetType(_p_PC*, char const**)'
collect2: ld returned 1 exit status

Kristian


On 23 July 2010 18:08,  <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 4878
> committer: Garth N. Wells <gnw20@xxxxxxxxx>
> branch nick: dolfin-all
> timestamp: Fri 2010-07-23 18:04:51 +0100
> message:
>  Use nested parameters in PETScPreconditioner.
> modified:
>  dolfin/la/PETScPreconditioner.cpp
>
>
> --
> lp:dolfin
> https://code.launchpad.net/~dolfin-core/dolfin/main
>
> Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
> To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
>
> === modified file 'dolfin/la/PETScPreconditioner.cpp'
> --- dolfin/la/PETScPreconditioner.cpp   2010-07-23 16:15:47 +0000
> +++ dolfin/la/PETScPreconditioner.cpp   2010-07-23 17:04:51 +0000
> @@ -9,6 +9,7 @@
>  #ifdef HAS_PETSC
>
>  #include <boost/assign/list_of.hpp>
> +#include <boost/lexical_cast.hpp>
>  #include <petscksp.h>
>  #include <petscmat.h>
>  #include <dolfin/la/KrylovSolver.h>
> @@ -40,8 +41,24 @@
>  {
>   Parameters p(KrylovSolver::default_parameters());
>   p.rename("petsc_preconditioner");
> -  p.add("ilu_fill_level", 0);
>   p.add("schwarz_overlap", 1);
> +
> +  // ILU parameters
> +  Parameters p_ilu("ilu");
> +  p_ilu.add("fill_level", 0);
> +
> +  // Hypre/parasails parameters
> +  Parameters p_parasails("parasails");
> +  p_parasails.add("threshold", 0.15);
> +  p_parasails.add("levels", 0);
> +
> +  // Hypre package parameters
> +  Parameters p_hypre("hypre");
> +  p_hypre.add(p_parasails);
> +
> +  p.add(p_ilu);
> +  p.add(p_hypre);
> +
>   return p;
>  }
>  //-----------------------------------------------------------------------------
> @@ -76,7 +93,17 @@
>     if (type == "amg_hypre" || type == "hypre_amg")
>       PCHYPRESetType(pc, "boomeramg");
>     else if (type == "hypre_parasails")
> +    {
>       PCHYPRESetType(pc, "parasails");
> +      const double thresh = parameters("hypre")("parasails")["threshold"];
> +      const int levels = parameters("hypre")("parasails")["levels"];
> +
> +      PetscOptionsSetValue("-pc_hypre_parasails_thresh", boost::lexical_cast<std::string>(thresh).c_str());
> +      PetscOptionsSetValue("-pc_hypre_parasails_nlevels", boost::lexical_cast<std::string>(levels).c_str());
> +      //PetscOptionsSetValue("-pc_hypre_parasails_thresh", "0.15");
> +      //PetscOptionsSetValue("-pc_hypre_parasails_nlevels", "0");
> +
> +    }
>     else if (type == "hypre_euclid")
>       PCHYPRESetType(pc, "euclid");
>     else
> @@ -87,9 +114,6 @@
>             "algebraic multigrid. Default PETSc solver will be used. "
>             "For performance, installation of HYPRE is recommended.");
>     #endif
> -
> -    PCFactorSetLevels(pc, parameters["ilu_fill_level"]);
> -    //PetscOptionsSetValue(const char iname[],const char value[])
>   }
>   else if (type == "amg_ml")
>   {
> @@ -128,7 +152,7 @@
>       //PCFactorSetMatSolverPackage(sub_pc, MAT_SOLVER_UMFPACK);
>       //PCSetType(sub_pc, PCILU);
>       //KSPSetType(sub_ksps[i], KSPGMRES);
> -      PCFactorSetLevels(sub_pc, parameters["ilu_fill_level"]);
> +      PCFactorSetLevels(sub_pc, parameters("ilu")["fill_level"]);
>       //PCFactorSetLevels(sub_pc, 4);
>       //PCView(sub_pc, PETSC_VIEWER_STDOUT_WORLD);
>     }
> @@ -147,9 +171,10 @@
>     #else
>     PCFactorSetShiftNonzero(pc, parameters["shift_nonzero"]);
>     #endif
> -    PCFactorSetLevels(pc, parameters["ilu_fill_level"]);
>   }
>
> +  PCFactorSetLevels(pc, parameters("ilu")["fill_level"]);
> +
>   // Make sure options are set
>   PCSetFromOptions(pc);
>   PCView(pc, PETSC_VIEWER_STDOUT_WORLD);
>
>
>



Follow ups