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

Method Timing

fem/scalarfe.cpp:287–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285
286 template<int D>
287 list<tuple<string,double>> ScalarFiniteElement<D> :: Timing () const
288 {
289 list<tuple<string,double>>timings;
290 IntegrationRule ir(ElementType(), 2*Order());
291 SIMD_IntegrationRule simdir(ElementType(), 2*Order());
292 Vector<> shape(GetNDof()), coefs(GetNDof());
293 Vector<> values(ir.Size());
294 Matrix<> dvalues(ir.Size(), D);
295 Vector<SIMD<double>> avalues(simdir.Size());
296 Matrix<SIMD<double>> advalues(D, simdir.Size());
297 Matrix<SIMD<double>> simd_shapes(GetNDof(), simdir.Size());
298 FE_ElementTransformation<D,D> trafo(ElementType());
299 static LocalHeap lh (10000000, "FE - Timing");
300 HeapReset hr(lh);
301 // auto & mir = trafo(ir, lh);
302 auto & simdmir = trafo(simdir, lh);
303
304 coefs = 1;
305
306 double maxtime = 0.5;
307 double time;
308
309 constexpr size_t steps = 1000;
310 time = RunTiming([&]() {
311 for (size_t i = 0; i < steps; i++)
312 this -> CalcShape(ir[0], shape);
313 });
314 timings.push_back(make_tuple("CalcShape", time/steps*1e9/GetNDof()));
315
316 time = RunTiming([&]() {
317 for (size_t i = 0; i < steps; i++)
318 this -> CalcShape(simdir, simd_shapes);
319 });
320 timings.push_back(make_tuple("CalcShape (SIMD)", time/steps*1e9/(simdir.GetNIP()*GetNDof())));
321
322 time = RunTiming([&]() {
323 for (size_t i = 0; i < steps; i++)
324 this -> Evaluate(ir, coefs, values);
325 }, maxtime);
326 timings.push_back(make_tuple("Evaluate",time/steps*1e9/(GetNDof()*ir.GetNIP())));
327
328 time = RunTiming([&]() {
329 for (size_t i = 0; i < steps; i++)
330 this -> Evaluate(simdir, coefs, avalues);
331 }, maxtime);
332 timings.push_back(make_tuple("Evaluate(SIMD)", time/steps*1e9/(GetNDof()*ir.GetNIP())));
333
334 time = RunTiming([&]() {
335 for (size_t i = 0; i < steps; i++)
336 this -> EvaluateGrad(ir, coefs, dvalues);
337 }, maxtime);
338 timings.push_back(make_tuple("Evaluate Grad", time/steps*1e9/(D*GetNDof()*ir.GetNIP())));
339
340 time = RunTiming([&]() {
341 for (size_t i = 0; i < steps; i++)
342 this -> EvaluateGrad(simdmir, coefs, advalues);
343 }, maxtime);
344 timings.push_back(make_tuple("Evaluate Grad(SIMD)", time/steps*1e9/(D*GetNDof()*ir.GetNIP())));

Callers

nothing calls this directly

Calls 11

ElementTypeFunction · 0.85
EvaluateGradMethod · 0.80
EvaluateGradTransMethod · 0.80
AddGradTransMethod · 0.80
OrderFunction · 0.70
GetNDofFunction · 0.70
SizeMethod · 0.45
CalcShapeMethod · 0.45
GetNIPMethod · 0.45
EvaluateMethod · 0.45
AddTransMethod · 0.45

Tested by

no test coverage detected