MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / Timing

Method Timing

fem/hdivdivfe.cpp:16–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14{
15 template<int D>
16 list<tuple<string,double>> HDivDivFiniteElement<D> :: Timing () const
17 {
18 list<tuple<string,double>>timings;
19 IntegrationRule ir(ElementType(), 2*Order());
20 SIMD_IntegrationRule simdir(ElementType(), 2*Order());
21 Vector<> coefs(GetNDof());
22 Matrix<> shape(GetNDof(),(D+1)*D/2);
23 Matrix<> divshape(GetNDof(),D);
24 Vector<> values(ir.Size());
25 Matrix<> dvalues(ir.Size(), D);
26 Matrix<SIMD<double>> simd_shapes(D*D*GetNDof(), simdir.Size());
27 FE_ElementTransformation<D,D> trafo(ElementType());
28 static LocalHeap lh (10000000, "FE - Timing");
29 HeapReset hr(lh);
30 // auto & mir = trafo(ir, lh);
31 auto & mir = trafo(ir, lh);
32 auto & simdmir = trafo(simdir, lh);
33
34 coefs = 1;
35
36 double maxtime = 0.5;
37 double time;
38
39 constexpr size_t steps = 1000;
40 time = RunTiming([&]() {
41 for (size_t i = 0; i < steps; i++)
42 for (size_t j = 0; j < ir.Size(); j++)
43 this -> CalcShape(ir[j], shape);
44 });
45 timings.push_back(make_tuple("CalcShape", time/steps*1e9/(D*(D+1)/2*GetNDof()*ir.Size())));
46
47 time = RunTiming([&]() {
48 for (size_t i = 0; i < steps; i++)
49 for (size_t j = 0; j < ir.Size(); j++)
50 this -> CalcDivShape(ir[j], divshape);
51 });
52 timings.push_back(make_tuple("CalcDivShape", time/steps*1e9/(D*GetNDof()*ir.Size())));
53
54 time = RunTiming([&]() {
55 for (size_t i = 0; i < steps; i++)
56 for (size_t j = 0; j < ir.Size(); j++)
57 this -> CalcMappedDivShape(mir[j], divshape);
58 });
59 timings.push_back(make_tuple("CalcMappedDivShape", time/steps*1e9/(D*GetNDof()*ir.Size())));
60
61
62 time = RunTiming([&]() {
63 for (size_t i = 0; i < steps; i++)
64 this -> CalcMappedShape_Matrix(simdmir, simd_shapes);
65 }, maxtime);
66 timings.push_back(make_tuple("CalcShape (SIMD)", time/steps*1e9/(D*D*GetNDof()*simdir.GetNIP())));
67 cout << "simd_shape mem = " << simd_shapes.Height()*simd_shapes.Width()*sizeof(SIMD<double>) << endl;
68 return timings;
69 }
70
71 template class HDivDivFiniteElement<2>;
72 template class HDivDivFiniteElement<3>;

Callers

nothing calls this directly

Calls 11

ElementTypeFunction · 0.85
OrderFunction · 0.70
GetNDofFunction · 0.70
SizeMethod · 0.45
CalcShapeMethod · 0.45
CalcDivShapeMethod · 0.45
CalcMappedDivShapeMethod · 0.45
GetNIPMethod · 0.45
HeightMethod · 0.45
WidthMethod · 0.45

Tested by

no test coverage detected