Re: [deal.II] Re: Shared Memory Parallel Linear Solver

2020-02-26 Thread Bruno Turcksin
Paras,

Le mer. 26 févr. 2020 à 12:27, Paras Kumar  a écrit :
> For the vectors (solution & rhs), the idea was to copy the values from the 
> dealii::Vector to dealii::LinearAlgebra::EpetraWrappers::Vector. As an 
> intermediate step I first copy the dealii::Vector to 
> dealii::LinearAlgebra::Vector using the constructor : 
> https://www.dealii.org/current/doxygen/deal.II/classLinearAlgebra_1_1Vector.html#af441b2c23134f8e6e08c833f91a2.
>  This works fine. However, when I try to call 
> dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(dealii::LinearAlgebra::Vector)
>  the following error occurs:
>
> An error occurred in line <85> of file 
> 
>  in function
> virtual void dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(const 
> dealii::LinearAlgebra::VectorSpaceVector&, bool)
> The violated condition was:
> dynamic_cast()!=nullptr
> Additional information:
> (none)
You are not allow to use reinit with a vector of a different type. I
am afraid you will have to copy the elements yourself. I would advise
you to choose this vector
https://www.dealii.org/current/doxygen/deal.II/classTrilinosWrappers_1_1MPI_1_1Vector.html
It is easier to fill in.

Best,

Bruno

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAGVt9eOSbng0MS%3D2ziAASOVtX7PhH-wyZs_2XG9h8Y%3DEMLyVbw%40mail.gmail.com.


[deal.II] Re: Shared Memory Parallel Linear Solver

2020-02-26 Thread Paras Kumar

Dear Bruno,

Thank you  for your response.

On Friday, February 14, 2020 at 2:34:41 PM UTC+1, Bruno Turcksin wrote:
>
> Paras,
>
> You could try to use SuperLU_MT (see 
> https://portal.nersc.gov/project/sparse/superlu/) but we don't have 
> wrapper for it. The Krylov solver in deal.II are multithreaded but the 
> preconditioners are not. What you can try is to use deal.II solvers and 
> STRUMPACK (https://github.com/pghysels/STRUMPACK) for the preconditioner 
> but again we don't have wrapper for it. 
>
> Best,
>
> Bruno
>


A bit more search let to the fact that the SuperLu-MT solver is also 
available in Trilinos-Ameso2 package (see 
https://docs.trilinos.org/latest-release/packages/amesos2/doc/html/classAmesos2_1_1Superlumt.html#a102812eafbb572475b7330b825809b09).
 


The current code uses dealii::SparseMatrix and 
dealii::Vector objects to store the system matrix and, the solution 
and rhs vectors respectively.

In order to test it out, my idea was to use a 
dealii::TrilinosWrappers::SparseMatrix (which would be reinit from the 
already assembled dealii::SparseMatrix) and then extract the underlying 
matrix (using the TrilinosWrappers::SparseMatrix::trilinos_matrix() 
function) for use with the Superlu-MT solver. This works fine.

For the vectors (solution & rhs), the idea was to copy the values from the 
dealii::Vector to dealii::LinearAlgebra::EpetraWrappers::Vector. As an 
intermediate step I first copy the dealii::Vector to 
dealii::LinearAlgebra::Vector using the constructor : 
https://www.dealii.org/current/doxygen/deal.II/classLinearAlgebra_1_1Vector.html#af441b2c23134f8e6e08c833f91a2.
 
This works fine. However, when I try to call 
dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(dealii::LinearAlgebra::Vector)
 
the following error occurs:

An error occurred in line <85> of file 

 
in function
virtual void 
dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(const 
dealii::LinearAlgebra::VectorSpaceVector&, bool)
The violated condition was: 
dynamic_cast()!=nullptr
Additional information: 
(none)

Stacktrace:
---
#0  
/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/dealii-9.0.1-ssxm6qr7mlmymdmjssazlr4s32qar5cv/lib/libdeal_II.g.so.9.0.1:
 
dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(dealii::LinearAlgebra::VectorSpaceVector
 
const&, bool)
#1  
/calculate/Paras_Work/PhD_Work/FRASCAL-CODE/MNC-Frac/_build/libmncfrac.so: 
std::pair mncfrac::Solve_linearEquationSystem<2u, 
double>(mncfrac::LinearAlgebraItems&, 
mncfrac::buildingblocks::inputreader::LinearSolverParameters const&, 
dealii::Vector&)
#2  ./variants/homogenization: mncfrac::homogenization::RVE<2u, 
double>::Solve_timeStep(dealii::Tensor<2, 2, double> const&, 
mncfrac::utilities::BoundaryConditionType const&, dealii::Vector&)
#3  ./variants/homogenization: mncfrac::homogenization::RVE<2u, 
double>::Homogenize(dealii::Tensor<2, 2, double> const&, 
mncfrac::utilities::BoundaryConditionType)
#4  ./variants/homogenization: main


I could not understand why does the conversion fails? Could you please help 
me understand where am I doing wrong. Any better alternatives you would 
suggest?

It is clear that copying matrices and vectors for each solver call is 
probably not very efficient, but this is just for trying out the solver.


Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/9384e043-e49c-42e6-b72b-a08328addb62%40googlegroups.com.


[deal.II] Re: Shared Memory Parallel Linear Solver

2020-02-14 Thread Bruno Turcksin
Paras,

You could try to use SuperLU_MT (see 
https://portal.nersc.gov/project/sparse/superlu/) but we don't have wrapper 
for it. The Krylov solver in deal.II are multithreaded but the 
preconditioners are not. What you can try is to use deal.II solvers and 
STRUMPACK (https://github.com/pghysels/STRUMPACK) for the preconditioner 
but again we don't have wrapper for it. 

Best,

Bruno

On Friday, February 14, 2020 at 7:22:15 AM UTC-5, Paras Kumar wrote:
>
> Dear deal.ii Community,
>
> I am working  on finite deformation hyperelasticity problem which is 
> essentially a nonlinear-vector-valued problem with displacement as the 
> unknown at each support point(dim=2,3).  *With regards to parallelism, we 
> currently restrict ourselves to shared memory parallel (SMP) only.* The 
> FE assembly process has been paralleized using the workstream function.
>
> This question pertains to (possibly faster) linear solvers. Currently. For 
> the current 2D problem, we use the SparseDirectUMFPACK solver. As can been 
> seen in the time log below (ths example was computed on a 36 core machine 
> with 64 threads), the linear solver consumes the most time. I also tried 
> using the CG solver, but it was much much slower, probably due to the large 
> condition number stemming out of  highly refined mesh in regions of 
> interest.
>
> Triangulation:
>  Number of active cells: 2059646
>  Number of Degrees of Freedom: 4119454
>
> +-+++
> | Total wallclock time elapsed since start|  7.81e+03s ||
> | |||
> | Section | no. calls |  wall time | % of total |
> +-+---+++
> | Assemble Linear System  |50 |   875s |11% |
> | Linear Solver   |40 |  5.55e+03s |71% |
> | Make Constraints|50 |   255s |   3.3% |
> | PBC setup   | 1 |  1.02s | 0% |
> | Set Boundary IDs| 1 | 0.109s | 0% |
> | Stress Output Computation   |11 |   464s |   5.9% |
> | Stress Output Overall   |12 | 1e+03s |13% |
> | Stress Output Writing   |11 |   379s |   4.9% |
> | Stress output initialize| 1 |   158s | 2% |
> | System Setup| 1 |   260s |   3.3% |
> +-+---+++
>
> While going through the documentation, I came across options for DMP 
> linear solvers but couldn't find any with SMP. 
>
> Could somenone please guide me to any such possibilities within the 
> library or through interface to some external library.
>
> Best regards,
> Paras
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/2a2ce382-894d-42ff-a9ea-d1c15612a309%40googlegroups.com.