On 8/19/22 03:25, Uclus Heis wrote:
> /
> /
> The way of extracting and exporting the solution with
> /testvec=locally_relevant_solution / is a bad practice? I am saving the
> locally relevant solution from many different processes in one single file for
> a given frequency. I am afraid that there is no synchronization between
> processes and the results will be saved without following the right order of
> DOF (which is needed for me). Is this statement correct?
Assuming that testvec is a vector that has all elements stored on the current
process, then the assignment
testvec = locally_relevant_solution;
synchronizes among all processes.
That said, from your code, it looks like all processes are opening the same
file and writing to it. Nothing good will come of this. There is of course
also the issue that importing all vector elements to one process cannot scale
to large numbers of processes.
> Another issue that I found is that this approach increases dramatically the
> computational time of the run() function. For a particular case, solving the
> domain takes 1h without exporting the domain, while it takes 8h adding the
> previous piece of code to export the domain. Is this because the print
> function is slow or there is some sync going on when calling
> /testvec=locally_relevant_solution?/
You can not tell which part of a code is expensive unless you actually time
it. Take a look at the TimerOutput class used in step-40, for example, and how
you can use it to time individual code blocks.