Using PetscWrappers::TimeStepper with LinearAlgebra::distributed::Vector

35 views
Skip to first unread message

Praveen C

unread,
Oct 2, 2024, 1:48:57 AM10/2/24
to Deal. II Googlegroup
Hello

In a time explicit DG code, I am trying to use petsc timerstepper. But it looks like it does not work with LinearAlgebra::distributed::Vector

Is this not supported, or it is not possible to support this vector type ?

Thanks
praveen

Here is the compile time error, when I use docker dealii/dealii:latest

dealii@2ea11578dc08:~/shared/dg2d/system_lagrange_mpi$ make
[ 50%] Building CXX object CMakeFiles/main.dir/main.cc.o
[100%] Linking CXX executable main
/home/dealii/shared/dg2d/system_lagrange_mpi/dg.h:876: error: undefined reference to 'dealii::PETScWrappers::TimeStepper<dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>, dealii::PETScWrappers::MatrixBase, dealii::PETScWrappers::MatrixBase>::TimeStepper(dealii::PETScWrappers::TimeStepperData const&, ompi_communicator_t*)'
/home/dealii/shared/dg2d/system_lagrange_mpi/dg.h:877: error: undefined reference to 'dealii::PETScWrappers::TimeStepper<dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>, dealii::PETScWrappers::MatrixBase, dealii::PETScWrappers::MatrixBase>::petsc_ts()'
/home/dealii/shared/dg2d/system_lagrange_mpi/dg.h:878: error: undefined reference to 'dealii::PETScWrappers::TimeStepper<dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>, dealii::PETScWrappers::MatrixBase, dealii::PETScWrappers::MatrixBase>::petsc_ts()'
/home/dealii/shared/dg2d/system_lagrange_mpi/dg.h:910: error: undefined reference to 'dealii::PETScWrappers::TimeStepper<dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>, dealii::PETScWrappers::MatrixBase, dealii::PETScWrappers::MatrixBase>::solve(dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>&)'
/home/dealii/shared/dg2d/system_lagrange_mpi/dg.h:911: error: undefined reference to 'dealii::PETScWrappers::TimeStepper<dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>, dealii::PETScWrappers::MatrixBase, dealii::PETScWrappers::MatrixBase>::~TimeStepper()'
/home/dealii/shared/dg2d/system_lagrange_mpi/dg.h:911: error: undefined reference to 'dealii::PETScWrappers::TimeStepper<dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Host>, dealii::PETScWrappers::MatrixBase, dealii::PETScWrappers::MatrixBase>::~TimeStepper()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/main.dir/build.make:411: main] Error 1
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/main.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Marc Fehling

unread,
Oct 2, 2024, 9:56:34 AM10/2/24
to deal.II User Group
Hi Praveen,

PETScWrappers::TimeStepper has only been explicitly instantiated for the PETScWrappers Vectors:
https://github.com/dealii/dealii/blob/25495718f4bb6aa45a8f6c8cc4f2aedbe8d62231/source/lac/petsc_ts.cc#L82-L89

Will deal.II compile if you add the corresponding instantiations for the LinearAlgebra Vectors?

Best,
Marc

Praveen C

unread,
Oct 2, 2024, 10:17:21 AM10/2/24
to Deal. II Googlegroup
Hello Marc

The documentation says


VectorType must provide a petsc_vector() function but the LA distributed vector does not seem to have this, right ?

best
praveen

Wolfgang Bangerth

unread,
Oct 2, 2024, 1:17:46 PM10/2/24
to dea...@googlegroups.com

On 10/2/24 08:17, Praveen C wrote:
>
> The documentation says
>
> https://dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1TimeStepper.html
>
> VectorType must provide a petsc_vector() function but the LA distributed
> vector does not seem to have this, right ?

In C++20 we actually check which vector classes are allowed:
https://github.com/dealii/dealii/blob/25495718f4bb6aa45a8f6c8cc4f2aedbe8d62231/include/deal.II/lac/petsc_ts.h#L326-L338
In short, you really can only use PETSc vectors (not even block vectors).

You could try the SUNDIALS wrappers. They are more flexible and allow
you to use any kind of vector type.

Best
W.
Reply all
Reply to author
Forward
0 new messages