Simon,

The best way to profile a code is to use a profiler. It can give a lot more 
information than what simple timers can do. You say that your code is not 
parallelized but by default deal.II is multithreaded . Did you set 
DEAL_II_NUM_THREADS=1? That could explain why CPU and Wall time are 
different. Finally, if I understand correctly, you are calling the 
constructor of FEValues about 2.5 million times. That means that the call 
to one FEValues constructor is 100/2.5e6 seconds about 40 microseconds. 
That doesn't seem too slow.

Best,

Bruno

On Wednesday, October 19, 2022 at 7:51:55 AM UTC-4 Simon wrote:

> Dear all,
>
> I implemented two different versions to compute a stress for a given 
> strain and want to compare the associated computation times in release mode.
>
> version 1: stress = fun1(strain)      cpu time:  4.52  s      wall time:   
> 4.53 s
> version 2: stress = fun2(strain)     cpu time: 32.5    s      wall time: 
> 167.5 s 
>
> fun1 and fun2, respectively, are invoked for all quadrature points 
> (1,286,144 in the above example) defined on the triangulation. My program 
> is not parallelized.
> In fun2, I call  find_active_cell_around_point 
> <https://www.dealii.org/current/doxygen/deal.II/namespaceGridTools.html#a2e10aeb1c8e76110a84b6945eac3aaf0>
>  
> twice for two different points on two different (helper) triangulations and 
> initialize two FEValues objects 
> with the points ' ref_point_vol' and 'ref_point_dev' 
> as returned by find_active_cell_around_point 
> <https://www.dealii.org/current/doxygen/deal.II/namespaceGridTools.html#a2e10aeb1c8e76110a84b6945eac3aaf0>
>  
> .
> FEValues<1> fe_vol(dof_handler_vol.get_fe(), 
>                                         Quadrature<1>(ref_point_vol),
>                                         update_gradients | update_values); 
>                                                        
> FEValues<1> fe_values_energy_dev(this->dof_handler_dev.get_fe(), 
>                                         Quadrature<1>(ref_point_dev),
>                                         update_gradients | update_values); 
>   
>
> I figured out that the initialization of the two FEValues objects is the 
> biggest portion of the above mentioned times.  In particular, if I comment 
> the initialization out, I have 
> cpu time: 6.54 s     wall time: 6.55 s .
>
> The triangulations associated with dof_handler_vol and dof_handler_dev are 
> both 1d and store only 4 and 16 elements, respectively. That said, I am 
> wondering why the initialization takes so long (roughly 100 seconds wall 
> time in total) and why this causes a gap between the cpu and wall time.
> Unfortunately, I have to reinitialize them anew whenever fun2 is called, 
> because  the point 'ref_point_vol' (see Quadrature<1>(ref_point_vol)) is 
> different in each call to fun2. 
>
> Best
> Simon
>
>
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/d955e8e6-78c8-41f7-9f6c-f5339c22b319n%40googlegroups.com.

Reply via email to