Commit 34edbcab authored by Lukas Renelt's avatar Lukas Renelt

Merge branch 'scalability-timings-AMG' into sky-scalability-timings

parents 5f9fb6f8 f587ad4d
Pipeline #10477 passed with stage
in 5 minutes and 19 seconds
......@@ -98,3 +98,48 @@ dune_add_test(NAME multirhsperftest-jacobi-vectorclass-8
LINK_LIBRARIES dunecommon
CMAKE_GUARD dune-istl_FOUND
)
set(RUNS 10)
dune_add_test(NAME multirhsperftest-AMG-scalar
SOURCES multirhsperftest-AMG-scalar.cc
COMPILE_DEFINITIONS -DRUNS=${RUNS}
LINK_LIBRARIES dunecommon
CMAKE_GUARD dune-istl_FOUND
)
foreach(LANES IN ITEMS 2 4 8)
dune_add_test(NAME multirhsperftest-AMG-loop-${LANES}
SOURCES multirhsperftest-AMG-loop.cc
COMPILE_DEFINITIONS -DLANES=${LANES} -DRUNS=${RUNS}
LINK_LIBRARIES dunecommon
CMAKE_GUARD dune-istl_FOUND
)
endforeach(LANES)
dune_add_test(NAME multirhsperftest-AMG-vectorclass-2
SOURCES multirhsperftest-AMG-vectorclass.cc
COMPILE_DEFINITIONS -DMAX_VECTOR_SIZE=${MAX_VECTOR_SIZE}
COMPILE_DEFINITIONS -DTYPE=Vec2d -DRUNS=${RUNS}
COMPILE_FLAGS -msse2
LINK_LIBRARIES dunecommon
CMAKE_GUARD dune-istl_FOUND
)
dune_add_test(NAME multirhsperftest-AMG-vectorclass-4
SOURCES multirhsperftest-AMG-vectorclass.cc
COMPILE_DEFINITIONS -DMAX_VECTOR_SIZE=${MAX_VECTOR_SIZE}
COMPILE_DEFINITIONS -DTYPE=Vec4d -DRUNS=${RUNS}
COMPILE_FLAGS -mavx2 -mfma
LINK_LIBRARIES dunecommon
CMAKE_GUARD dune-istl_FOUND
)
dune_add_test(NAME multirhsperftest-AMG-vectorclass-8
SOURCES multirhsperftest-AMG-vectorclass.cc
COMPILE_DEFINITIONS -DMAX_VECTOR_SIZE=${MAX_VECTOR_SIZE}
COMPILE_DEFINITIONS -DTYPE=Vec8d -DRUNS=${RUNS}
COMPILE_FLAGS -mavx512f -mfma
LINK_LIBRARIES dunecommon
CMAKE_GUARD dune-istl_FOUND
)
#include "config.h"
#include <dune/common/simd/loop.hh>
#include "multirhsperftest.hh"
int main(int argc, char ** argv)
{
runInformation times;
times = runAMGCGTest<Dune::LoopSIMD<double, LANES>>(RUNS);
printRunInformation(times);
return 0;
}
#include "config.h"
#include "multirhsperftest.hh"
int main(int argc, char ** argv)
{
runInformation times;
times = runAMGCGTest<double>(RUNS);
printRunInformation(times);
return 0;
}
#include "config.h"
#include <dune/vectorclass/vectorclass.hh>
#include "multirhsperftest.hh"
int main(int argc, char ** argv)
{
runInformation times;
times = runAMGCGTest< TYPE >(RUNS);
printRunInformation(times);
return 0;
}
......@@ -59,14 +59,77 @@ runInformation runJacobiCGTest(unsigned int Runs) {
return out;
}
template<class T>
runInformation runAMGCGTest(unsigned int Runs) {
runInformation out;
out.className = Dune::className<T>();
out.runs = Runs;
// define Types
typedef typename Dune::Simd::Scalar<T> MT;
typedef Dune::FieldVector<T,1> VB;
typedef Dune::FieldMatrix<MT,1,1> MB;
typedef Dune::AlignedAllocator<VB> AllocV;
typedef Dune::BlockVector<VB,AllocV> Vector;
typedef Dune::BCRSMatrix<MB> Matrix;
// size
unsigned int size = 100;
unsigned int N = size*size;
// make a compressed row matrix with five point stencil
Matrix A;
setupLaplacian(A,size);
typedef Dune::MatrixAdapter<Matrix,Vector,Vector> Operator;
Operator op(A); // make linear operator from A
// AMG
typedef Dune::Amg::RowSum Norm;
typedef Dune::Amg::CoarsenCriterion<Dune::Amg::UnSymmetricCriterion<Matrix,Norm> >
Criterion;
typedef Dune::SeqSSOR<Matrix,Vector,Vector> Smoother;
typedef typename Dune::Amg::SmootherTraits<Smoother>::Arguments SmootherArgs;
SmootherArgs smootherArgs;
smootherArgs.iterations = 1;
smootherArgs.relaxationFactor = 1;
unsigned int coarsenTarget = 1000;
unsigned int maxLevel = 10;
Criterion criterion(15,coarsenTarget);
criterion.setDefaultValuesIsotropic(2);
criterion.setAlpha(.67);
criterion.setBeta(1.0e-4);
criterion.setMaxLevel(maxLevel);
criterion.setSkipIsolated(false);
criterion.setNoPreSmoothSteps(1);
criterion.setNoPostSmoothSteps(1);
Dune::SeqScalarProduct<Vector> sp;
typedef Dune::Amg::AMG<Operator,Vector,Smoother,Dune::Amg::SequentialInformation> AMG;
Smoother smoother(A,1,1);
AMG amg(op, criterion, smootherArgs);
//CG-Solver
using VectorType = decltype(detectVectorType(op));
double reduction = 1e-1;
int verb = 1;
Dune::CGSolver<VectorType> cg(op,amg,reduction,8000,verb);
std::vector<double> measuredTime = run_test("Jacobi","CG",op,cg,N,Runs);
out.timestamps = measuredTime;
return out;
}
void printRunInformation(runInformation info, bool verbose = false){
std::cout << "========================================" << std::endl;
std::cout << "type: " << info.className << std::endl;
if(verbose)
if(verbose){
for(int i=0; i<info.runs; ++i)
std::cout << "Run " << i+1 << " took " << info.timestamps[i] << std::endl;
std::cout << "----------------------------------------" << std::endl;
}
if(info.runs > 1){
info.timestamps.erase(info.timestamps.begin());
......
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