Commit d464d6e6 authored by Naumann, Andreas's avatar Naumann, Andreas
Browse files

timings for mtl4 solver

parent 2e196286
......@@ -141,6 +141,7 @@ SET(AMDIS_SRC ${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/SubQuadrature.cc
${SOURCE_DIR}/SurfaceQuadrature.cc
${SOURCE_DIR}/Tetrahedron.cc
${SOURCE_DIR}/Timer.cc
${SOURCE_DIR}/Traverse.cc
${SOURCE_DIR}/Triangle.cc
${SOURCE_DIR}/VertexVector.cc
......
......@@ -51,6 +51,14 @@ namespace AMDiS {
ITL_OEMSolver(std::string name) :
MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_OEMSolver_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >(name) {}
int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
SystemVector& x,
SystemVector& b,
VectorialMapper& m)
{
return MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_OEMSolver_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >::solve(A,x,b,m);
}
~ITL_OEMSolver() {}
......@@ -87,6 +95,14 @@ namespace AMDiS {
}
int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
SystemVector& x,
SystemVector& b,
VectorialMapper& m)
{
return MTL4Solver< MTLMatrix, MTLVector, ITL_OEMSolver_para_runner< ITLSolver, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >::solve(A,x,b,m);
}
~ITL_OEMSolver_para() {}
/// Set parameter of iterative solver
......
......@@ -22,6 +22,7 @@
#include "OEMSolver.h"
#include "MatrixStreams.h"
#include "Timer.h"
#include <iostream>
#include <boost/mpl/bool.hpp>
#include <boost/numeric/mtl/utility/is_distributed.hpp>
......@@ -67,6 +68,7 @@ namespace AMDiS {
template< typename Matrix, typename Vector, typename Mapper >
int solve(const Matrix& A, Vector& x, Vector& b, Mapper& mapper)
{
Timer t;
if(num_rows(matrix) == 0 || !getMultipleRhs() ) {
init(mapper, mtl::traits::is_distributed<MTLMatrix>());
......@@ -88,7 +90,11 @@ namespace AMDiS {
VecMap< Vector, Mapper> bVecMap(b, mapper);
mtl_b << bVecMap;
MSG("fill MTL4 matrix needed %5.f seconds\n", t.elapsed());
t.reset();
error = worker.solve(matrix ,mtl_x, mtl_b);
MSG("solve MTL4 matrix needed %5.f seconds\n", t.elapsed());
MTLVector r(mtl_b);
r -= matrix * mtl_x;
......
......@@ -96,7 +96,12 @@ namespace AMDiS {
virtual int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
SystemVector& x,
SystemVector& b,
VectorialMapper&) = 0;
VectorialMapper&)
{
FUNCNAME("OEMSolver::solveSystem()");
TEST_EXIT(false)("This linear solver is not suitable for sequentiell problems\n");
return -1;
}
inline int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
SystemVector& x,
......
#include "Timer.h"
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include <mpi.h>
#endif
namespace AMDiS {
Timer::Timer():
first_seq(clock())
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
,first_mpi(MPI::Wtime())
#endif
{}
void Timer::reset()
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
first_mpi = MPI::Wtime();
#else
first_seq = clock();
#endif
}
double Timer::elapsed()
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
return MPI::Wtime() - first_mpi;
#else
return ((double)(clock() - first_seq))/((double)CLOCKS_PER_SEC);
#endif
}
}
#ifndef AMDIS_TIMER_H
#define AMDIS_TIMER_H
#include <time.h>
namespace AMDiS {
/// Helper class to destinct between different time measurement methods
class Timer {
/// begin value for sequentiell measurement
clock_t first_seq;
/// begin value for parallel measurement
double first_mpi;
public:
///initializes the timer with current time
Timer();
/// resets the timer to current time
void reset();
/// returns the elapsed time (from construction or last reset) to now in seconds
double elapsed();
};
}
#endif
......@@ -138,6 +138,14 @@ namespace AMDiS {
{
}
int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
SystemVector& x,
SystemVector& b,
VectorialMapper& m)
{
return solve(A,x,b,m);
}
private:
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment