amgcl icon indicating copy to clipboard operation
amgcl copied to clipboard

Does amgcl support the trillinos csrmatrix format.

Open ztdepztdep opened this issue 2 years ago • 7 comments

I have a code writing with trillinos, and i want to call the amgcl routine from my trillinos code. Does amgcl supoor thtis?

ztdepztdep avatar Apr 04 '22 06:04 ztdepztdep

There is the epetra_map adapter that should allow to use Trilinos matrices as inputs to amgcl solvers.

ddemidov avatar Apr 04 '22 06:04 ddemidov

`  amgcl::mpi::init mpi();
	amgcl::mpi::communicator world(MPI_COMM_WORLD);
	amgcl::profiler<> prof("Heat Condcution");
   	typedef amgcl::backend::builtin<double> DBackend;
        typedef amgcl::mpi::make_solver<amgcl::mpi::amg<DBackend,
                                        amgcl::mpi::coarsening::smoothed_aggregation<DBackend>,
                                        amgcl::mpi::relaxation::spai0<DBackend>>,
                                        amgcl::mpi::solver::bicgstab<DBackend>> Solver;
        
   Solver solve(world, amgcl::adapter::epetra_map(EpetraA_Diffusion));
     std::vector<double> x(NumMyRows);
   std::vector<double> rhs(NumMyRows);
   std::tie(NumIters, TrueResidual) = solve(rhs, x);

`

great, it works. But it is very slow compared to the trillinos's bicgstab solver. trillinos 0.15s amgcl 1.6s

ztdepztdep avatar Apr 04 '22 07:04 ztdepztdep

I don't have much experience with Trilinos, may be @RiccardoRossi may comment?

Also, make sure you have enabled full optimization for compilation of the amgcl test.

ddemidov avatar Apr 04 '22 16:04 ddemidov

mmm,

as i understand you have a backend in the middle, and as i understand that is making a copy of the matrix. @ddemidov am I wrong?

having said this we benchmarked against ML and it was very competitive... are u sure you properly defined the NDEBUG flag?

RiccardoRossi avatar Apr 05 '22 07:04 RiccardoRossi

Yes, there is a copy being made from the adapter into amgcl distributed matrix. @ztdepztdep, if you measure the construction and the application of the solver separately, it should be clear which part takes more time (the matrix is copied inside the constructor).

ddemidov avatar Apr 05 '22 08:04 ddemidov

Could you please give me some advices about how to define NDEBUG in the cmake file?

ztdepztdep avatar Aug 13 '22 15:08 ztdepztdep

Cmake should do this for you if you set CMAKE_BUILD_TYPE=Release

ddemidov avatar Aug 13 '22 15:08 ddemidov